From 0d57df17d5ef7cdc9cd39c9a5914006d9a76667f Mon Sep 17 00:00:00 2001 From: robot-ratatosk Date: Tue, 11 Nov 2025 03:18:19 +0300 Subject: [PATCH 01/17] New version of the tld SKIP_CHECK SKIP_REVIEW commit_hash:f5f4e6f04728a8e4dd9d6e5e5ae7a0f12e5f45d0 --- library/cpp/tld/tlds-alpha-by-domain.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index 7336989ccde2..83e5ee6dc2cf 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2025110700, Last Updated Fri Nov 7 07:07:01 2025 UTC +# Version 2025111000, Last Updated Mon Nov 10 07:07:02 2025 UTC AAA AARP ABB From 00b254ef6f96b6aea8bc21ca37dbf4c7e2a07519 Mon Sep 17 00:00:00 2001 From: pazus Date: Tue, 11 Nov 2025 09:31:17 +0300 Subject: [PATCH 02/17] =?UTF-8?q?Kotlin=202.2.21=20=E2=80=93=C2=A0Fix=20de?= =?UTF-8?q?tekt-cli=20to=20use=20its=20own=20kotlinc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### Обновление Detekt CLI для работы с собственным компилятором Kotlin 📝 - 🛠️ Заменён способ подключения Detekt CLI: вместо кастомной обёртки используется официальный модуль detekt-cli версии 1.23.8 из contrib. - 🧱 Изменён класс запуска Detekt с внутреннего (`ru.yandex.pcode.detekt.DetektValidateKt`) на стандартный CLI-класс из библиотеки (`io.gitlab.arturbosch.detekt.cli.Main`). - ⚙️ Внесены изменения в систему сборки, чтобы корректно поддерживать запуск Detekt CLI с зависимостями из contrib. - 📦 Добавлен новый модуль сборки `_JAR_CONTRIB_RUNNABLE`, обеспечивающий правильную работу Java-программ из contrib с класспасом и генерацией скриптов. - 🧹 Удалена ссылка на старую обёртку Detekt в основной конфигурации проекта. Autodescription by Yandex Code Assistant #| || **![](https://nda.ya.ru/t/mAiQIjHx7Mm3JC =30x) Echo tests** || |# commit_hash:10459bffa21e7fd62e11654e7b0819cf3dec908a --- build/conf/java.conf | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/build/conf/java.conf b/build/conf/java.conf index 95bd0f91cc15..6a78f1cc0771 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -375,7 +375,7 @@ multimodule JTEST_FOR { } multimodule JAVA_CONTRIB_PROGRAM { - module JAR_RUNNABLE: _JAR_RUNNABLE { + module JAR_RUNNABLE: _JAR_CONTRIB_RUNNABLE { .IGNORED=JAVA_SRCS RUN_JAR_PROGRAM RUN_JAVA_PROGRAM JAR_RESOURCE SRC_RESOURCE LOCAL_JAR .PEERDIRSELF=JAR_COMPILATION .SEM=$_SEM_IGNORED @@ -1431,6 +1431,46 @@ module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE { CHECK_PROVIDES() } +# tag:java-specific +module _JAR_CONTRIB_RUNNABLE: _JAR_BASE { + .FINAL_TARGET=yes + .CMD=$LINK_JAR_PROGRAM + .SEM=$_SEM_IGNORED + .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES + .ALLOWED=WITH_JDK GENERATE_SCRIPT + .PEERDIR_POLICY=as_build_from + + MODULE_SUFFIX=.run.cp.jar + CONSUME_NON_MANAGEABLE_PEERS=yes + + when ($RUN_WITH_SOURCES == "yes") { + _SOURCE_JARS=${suf=-sources.jar;noext;ext=.jar:MANAGED_PEERS_CLOSURE} ${hide;late_out;pre=$BINDIR/$REALPRJNAME/;suf=-sources.jar;nopath;noext;ext=.jar:MANAGED_PEERS_CLOSURE} + _SOURCE_JARS_CPLIST=${rootrel;pre=$BINDIR/$REALPRJNAME/;suf=-sources.jar;nopath;noext;ext=.jar:MANAGED_PEERS_CLOSURE} + } + + when ($TARED_CLASSPATH == "yes") { + DO_TAR_CLASSPATH=$TAR_CLASSPATH + } + + when ($DISABLE_SCRIPTGEN) { + DO_GEN_JAVA_RUN_SH= + } + otherwise { + DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH + PEERDIR+=build/platform/java/scriptgen + } + + when ($MAKE_UBERJAR_VALUE == "yes") { + LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM + DYNAMIC_LINK=no + _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes + } + otherwise { + _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no + } + CHECK_PROVIDES() +} + # tag:java-specific LINK_JAR_TEST=${hide:JAVA_FAKEID} ${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON3} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET} ${hide;kv:"p JT"} module _JAR_TEST: _COMPILABLE_JAR_BASE { From 63fbc7f55c72fc058688abb8296c837437fc8c8a Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Tue, 11 Nov 2025 09:54:35 +0300 Subject: [PATCH 03/17] yt/core/bus: handle SSL transport errors - **yt/core/bus: report SSL syscall error as transport error** - **yt/core/bus: test ssl connection transport errors** - **yt/core/bus: handle SslError as retriable channel failure error** - **yt/core/rpc: test RPC over BUS with TLS** --- * Changelog entry Type: fix Component: misc-server Network errors behind SSL connection should be reported as transport error to avoid confusing with actual SSL error and do proper retrying. --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1488 Co-authored-by: yuryalekseev commit_hash:5dc45314f0b7a0283e1988f2e03a003182d2ca82 --- yt/yt/core/bus/tcp/connection.cpp | 11 +- yt/yt/core/bus/unittests/ssl_ut.cpp | 66 +++++ yt/yt/core/bus/unittests/testdata/generate.sh | 37 --- yt/yt/core/rpc/helpers.cpp | 1 + yt/yt/core/rpc/unittests/lib/common.h | 229 +++++------------- yt/yt/core/rpc/unittests/lib/test_keys.cpp | 17 ++ yt/yt/core/rpc/unittests/lib/ya.make | 1 + yt/yt/core/test_framework/testdata/rpc_ca.pem | 32 +++ .../testdata/rpc_client_cert.pem | 32 +++ .../testdata/rpc_client_key.pem | 52 ++++ .../testdata/rpc_server_cert.pem | 32 +++ .../testdata/rpc_server_key.pem | 52 ++++ yt/yt/core/test_framework/ya.make | 5 + 13 files changed, 356 insertions(+), 211 deletions(-) delete mode 100644 yt/yt/core/bus/unittests/testdata/generate.sh create mode 100644 yt/yt/core/rpc/unittests/lib/test_keys.cpp create mode 100644 yt/yt/core/test_framework/testdata/rpc_ca.pem create mode 100644 yt/yt/core/test_framework/testdata/rpc_client_cert.pem create mode 100644 yt/yt/core/test_framework/testdata/rpc_client_key.pem create mode 100644 yt/yt/core/test_framework/testdata/rpc_server_cert.pem create mode 100644 yt/yt/core/test_framework/testdata/rpc_server_key.pem diff --git a/yt/yt/core/bus/tcp/connection.cpp b/yt/yt/core/bus/tcp/connection.cpp index 9ca15702c8ee..893d9b004c2f 100644 --- a/yt/yt/core/bus/tcp/connection.cpp +++ b/yt/yt/core/bus/tcp/connection.cpp @@ -1968,7 +1968,8 @@ void TTcpConnection::AbortSslSession() bool TTcpConnection::CheckSslReadError(ssize_t result) { - switch (SSL_get_error(Ssl_.get(), result)) { + auto sslError = SSL_get_error(Ssl_.get(), result); + switch (sslError) { case SSL_ERROR_NONE: return true; case SSL_ERROR_WANT_READ: @@ -1976,6 +1977,8 @@ bool TTcpConnection::CheckSslReadError(ssize_t result) // Try again. break; case SSL_ERROR_SYSCALL: + case SSL_ERROR_ZERO_RETURN: + return CheckTcpReadError(result); case SSL_ERROR_SSL: // This check is probably unnecessary in new versions of openssl. if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN) { @@ -1986,6 +1989,7 @@ bool TTcpConnection::CheckSslReadError(ssize_t result) default: UpdateBusCounter(&TBusNetworkBandCounters::ReadErrors, 1); Abort(GetLastSslError("TLS/SSL read error") + << TErrorAttribute("ssl_error_code", sslError) << TErrorAttribute("sys_error", TError::FromSystem(LastSystemError()))); break; } @@ -1995,7 +1999,8 @@ bool TTcpConnection::CheckSslReadError(ssize_t result) bool TTcpConnection::CheckSslWriteError(ssize_t result) { - switch (SSL_get_error(Ssl_.get(), result)) { + auto sslError = SSL_get_error(Ssl_.get(), result); + switch (sslError) { case SSL_ERROR_NONE: return true; case SSL_ERROR_WANT_READ: @@ -2003,6 +2008,7 @@ bool TTcpConnection::CheckSslWriteError(ssize_t result) // Try again. break; case SSL_ERROR_SYSCALL: + return CheckTcpWriteError(result); case SSL_ERROR_SSL: // This check is probably unnecessary in new versions of openssl. if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN) { @@ -2013,6 +2019,7 @@ bool TTcpConnection::CheckSslWriteError(ssize_t result) default: UpdateBusCounter(&TBusNetworkBandCounters::WriteErrors, 1); Abort(GetLastSslError("TLS/SSL write error") + << TErrorAttribute("ssl_error_code", sslError) << TErrorAttribute("sys_error", TError::FromSystem(LastSystemError()))); break; } diff --git a/yt/yt/core/bus/unittests/ssl_ut.cpp b/yt/yt/core/bus/unittests/ssl_ut.cpp index cd3bde3bbaf4..3d8581b23c1a 100644 --- a/yt/yt/core/bus/unittests/ssl_ut.cpp +++ b/yt/yt/core/bus/unittests/ssl_ut.cpp @@ -711,6 +711,72 @@ TEST_F(TSslTest, FullVerificationWithEllipticCurve) } } +TEST_F(TSslTest, ServerStop) +{ + auto serverConfig = TBusServerConfig::CreateTcp(Port); + serverConfig->EncryptionMode = EEncryptionMode::Required; + serverConfig->CertificateChain = CertificateChain; + serverConfig->PrivateKey = PrivateKey; + auto server = CreateBusServer(serverConfig); + server->Start(New()); + + auto clientConfig = TBusClientConfig::CreateTcp(AddressWithHostName); + clientConfig->EncryptionMode = EEncryptionMode::Required; + auto client = CreateBusClient(clientConfig); + + auto bus = client->CreateBus(New()); + EXPECT_TRUE(bus->GetReadyFuture().Get().IsOK()); + EXPECT_TRUE(bus->IsEncrypted()); + + server->Stop() + .Get() + .ThrowOnError(); + + auto message = CreateMessage(1); + auto sendFuture = bus->Send(message, {.TrackingLevel = EDeliveryTrackingLevel::Full}); + auto error = sendFuture.Get(); + EXPECT_EQ(error.GetCode(), EErrorCode::TransportError); + EXPECT_THROW_MESSAGE_HAS_SUBSTR( + error.ThrowOnError(), + NYT::TErrorException, + "Socket was closed"); +} + +TEST_F(TSslTest, BlackHole) +{ + auto serverConfig = TBusServerConfig::CreateTcp(Port); + serverConfig->EncryptionMode = EEncryptionMode::Required; + serverConfig->CertificateChain = CertificateChain; + serverConfig->PrivateKey = PrivateKey; + auto server = CreateBusServer(serverConfig); + server->Start(New()); + + auto clientConfig = TBusClientConfig::CreateTcp(AddressWithHostName); + clientConfig->EncryptionMode = EEncryptionMode::Required; + clientConfig->ReadStallTimeout = TDuration::Seconds(1); + auto client = CreateBusClient(clientConfig); + + auto bus = client->CreateBus(New()); + EXPECT_TRUE(bus->GetReadyFuture().Get().IsOK()); + EXPECT_TRUE(bus->IsEncrypted()); + + // Block all traffic from server. + bus->SetTosLevel(BlackHoleTosLevel); + + auto message = CreateMessage(1); + auto sendFuture = bus->Send(message, {.TrackingLevel = EDeliveryTrackingLevel::Full}); + auto error = sendFuture.Get(); + EXPECT_EQ(error.GetCode(), EErrorCode::TransportError); + EXPECT_THROW_MESSAGE_HAS_SUBSTR( + error.ThrowOnError(), + NYT::TErrorException, + "Socket read stalled"); + + server->Stop() + .Get() + .ThrowOnError(); +} + //////////////////////////////////////////////////////////////////////////////// } // namespace diff --git a/yt/yt/core/bus/unittests/testdata/generate.sh b/yt/yt/core/bus/unittests/testdata/generate.sh deleted file mode 100644 index 816edc383cff..000000000000 --- a/yt/yt/core/bus/unittests/testdata/generate.sh +++ /dev/null @@ -1,37 +0,0 @@ -openssl req -x509 -noenc -newkey rsa:4096 -keyout ca_key.pem -out ca.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ - -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ - -addext "keyUsage=keyCertSign" - -openssl req -new -x509 -noenc -newkey rsa:4096 -keyout key.pem -out cert.pem \ - -CA ca.pem -CAkey ca_key.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ - -addext "basicConstraints=critical,CA:FALSE" \ - -addext "keyUsage=digitalSignature,keyEncipherment" \ - -addext "extendedKeyUsage=serverAuth,clientAuth" - -openssl req -x509 -noenc -newkey rsa:4096 -keyout ca_key_with_ip_in_san.pem -out ca_with_ip_in_san.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ - -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ - -addext "keyUsage=keyCertSign" - -openssl req -new -x509 -noenc -newkey rsa:4096 -keyout key_with_ip_in_san.pem -out cert_with_ip_in_san.pem \ - -CA ca_with_ip_in_san.pem -CAkey ca_key_with_ip_in_san.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ - -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1" \ - -addext "basicConstraints=critical,CA:FALSE" \ - -addext "keyUsage=digitalSignature,keyEncipherment" \ - -addext "extendedKeyUsage=serverAuth,clientAuth" - -openssl req -x509 -noenc -newkey ec:<(openssl ecparam -name prime256v1) -keyout ca_key_ec.pem -out ca_ec.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ - -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ - -addext "keyUsage=keyCertSign" - -openssl req -new -x509 -noenc -newkey ec:<(openssl ecparam -name prime256v1) -keyout key_ec.pem -out cert_ec.pem \ - -CA ca_ec.pem -CAkey ca_key_ec.pem \ - -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ - -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1" \ - -addext "basicConstraints=critical,CA:FALSE" \ - -addext "keyUsage=digitalSignature,keyEncipherment" \ - -addext "extendedKeyUsage=serverAuth,clientAuth" diff --git a/yt/yt/core/rpc/helpers.cpp b/yt/yt/core/rpc/helpers.cpp index 772468eb2b79..90ec7faddff1 100644 --- a/yt/yt/core/rpc/helpers.cpp +++ b/yt/yt/core/rpc/helpers.cpp @@ -66,6 +66,7 @@ bool IsChannelFailureError(const TError& error) } return code == NRpc::EErrorCode::TransportError || + code == NRpc::EErrorCode::SslError || code == NRpc::EErrorCode::Unavailable || code == NRpc::EErrorCode::NoSuchService || code == NRpc::EErrorCode::NoSuchMethod || diff --git a/yt/yt/core/rpc/unittests/lib/common.h b/yt/yt/core/rpc/unittests/lib/common.h index 0c6456261da2..455992c3ceae 100644 --- a/yt/yt/core/rpc/unittests/lib/common.h +++ b/yt/yt/core/rpc/unittests/lib/common.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -67,6 +68,16 @@ namespace NYT::NRpc { +using namespace NCrypto; + +//////////////////////////////////////////////////////////////////////////////// + +extern TPemBlobConfigPtr RpcCACert; +extern TPemBlobConfigPtr RpcServerCert; +extern TPemBlobConfigPtr RpcServerKey; +extern TPemBlobConfigPtr RpcClientCert; +extern TPemBlobConfigPtr RpcClientKey; + //////////////////////////////////////////////////////////////////////////////// template @@ -183,7 +194,7 @@ class TRpcOverBus { public: static constexpr bool AllowTransportErrors = false; - static constexpr bool Secure = false; + static constexpr bool Secure = TImpl::Secure; static constexpr int MaxSimultaneousRequestCount = 1000; static constexpr bool MemoryUsageTrackingEnabled = TImpl::MemoryUsageTrackingEnabled; @@ -220,10 +231,12 @@ class TRpcOverBus //////////////////////////////////////////////////////////////////////////////// -template +template class TRpcOverBusImpl { public: + // Bus RPC does not provide extension TSslCredentialsExt yet. + static constexpr bool Secure = false; static constexpr bool MemoryUsageTrackingEnabled = !EnableLocalBypass; static IChannelPtr CreateChannel( @@ -232,6 +245,13 @@ class TRpcOverBusImpl THashMap /*grpcArguments*/) { auto config = NYT::NBus::TBusClientConfig::CreateTcp(address); + if (EnableSsl) { + config->EncryptionMode = NYT::NBus::EEncryptionMode::Required; + config->VerificationMode = NYT::NBus::EVerificationMode::Full; + config->CertificateAuthority = RpcCACert; + config->CertificateChain = RpcClientCert; + config->PrivateKey = RpcClientKey; + } config->EnableLocalBypass = EnableLocalBypass; auto client = CreateBusClient(std::move(config)); return NRpc::NBus::CreateBusChannel(std::move(client)); @@ -240,6 +260,13 @@ class TRpcOverBusImpl static NYT::NBus::IBusServerPtr CreateBusServer(ui16 port, IMemoryUsageTrackerPtr memoryUsageTracker) { auto config = NYT::NBus::TBusServerConfig::CreateTcp(port); + if (EnableSsl) { + config->EncryptionMode = NYT::NBus::EEncryptionMode::Required; + config->VerificationMode = NYT::NBus::EVerificationMode::Full; + config->CertificateAuthority = RpcCACert; + config->CertificateChain = RpcServerCert; + config->PrivateKey = RpcServerKey; + } config->EnableLocalBypass = EnableLocalBypass; return NYT::NBus::CreateBusServer( std::move(config), @@ -250,146 +277,6 @@ class TRpcOverBusImpl //////////////////////////////////////////////////////////////////////////////// -/* - * openssl genrsa -out root_key.pem 2048 - * openssl req -x509 -new -nodes -key root_key.pem -sha256 -days 10000 -out root_cert.pem - * openssl genrsa -out server_key.pem 2048 - * openssl genrsa -out client_key.pem 2048 - * openssl req -new -key server_key.pem -out server.csr - * openssl req -new -key client_key.pem -out client.csr - * openssl x509 -in server.csr -req -days 10000 -out server_cert.pem -CA root_cert.pem -CAkey root_key.pem -CAcreateserial - * openssl x509 -in client.csr -req -days 10000 -out client_cert.pem -CA root_cert.pem -CAkey root_key.pem -CAserial root_cert.srl - */ -inline std::string RootCert( - "-----BEGIN CERTIFICATE-----\n" - "MIID9DCCAtygAwIBAgIJAJLU9fgmNTujMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNV\n" - "BAYTAlJVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\n" - "aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xODAzMDQxMzUx\n" - "MjdaFw00NTA3MjAxMzUxMjdaMFkxCzAJBgNVBAYTAlJVMRMwEQYDVQQIEwpTb21l\n" - "LVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNV\n" - "BAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMEq\n" - "JYLsNKAnO6uENyLjRww3pITvtEEg8uDi1W+87hZE8XNQ1crhJZDXcMaoWaVLOcQT\n" - "6x2z5DAnn5/0CUXLrJgrwbfrZ82VwihQIpovPX91bA7Bd5PdlBI5ojtUrY9Fb6xB\n" - "eAmfsp7z7rKDBheLe7KoNMth4OSHWp5GeHLzp336AB7TA6EQSTd3T7oDrRjdqZTr\n" - "X35vF0n6+iOMSe5CJYuNX9fd5GkO6mwGV5BzEoUWwqTocfkLa2BfE+pvfsuWleNc\n" - "sU8vMoAdlkKUrnHbbQ7xuwR+3XhKpRCU+wmzM6Tvm6dnYJhhTck8yxGNCuAfgKu+\n" - "7k9Ur4rdPXYkSTUMbbcCAwEAAaOBvjCBuzAdBgNVHQ4EFgQUkZyJrYSMi34fw8wk\n" - "sLSQyzg8a/swgYsGA1UdIwSBgzCBgIAUkZyJrYSMi34fw8wksLSQyzg8a/uhXaRb\n" - "MFkxCzAJBgNVBAYTAlJVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJ\n" - "bnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdIIJAJLU\n" - "9fgmNTujMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBADpYkiJ4XsdV\n" - "w3JzDZCJX644cCzx3/l1N/ItVllVTbFU9MSrleifhBj21t4xUfHT2uhbQ21N6enA\n" - "Qx24wcLo9IRL61XEkLrTRPo1ZRrF8rwAYLxFgHgWimcocG+c/8++he7tXrjyYzS1\n" - "JyMKBgQcsrWn+3pCxSLHGuoH4buX3cMqrEepqdThIOTI12YW7xmD7vSguusroRFj\n" - "OH5RO4hhHIn/tR2G/lHS1u+YG5NyX94v8kN+SfAchZmeb54miANYBGzOFqYRgKs4\n" - "LfyFanmeXFJaj1M+37Lsm0TlxP6I7fa0Kag6FvlxpYvhblRJzsRHZE5Xe+KZzanV\n" - "I2TYYgHjI3I=\n" - "-----END CERTIFICATE-----\n"); - -inline std::string ClientKey( - "-----BEGIN RSA PRIVATE KEY-----\n" - "MIIEpAIBAAKCAQEArZpqucOdMlwZyyTWq+Sz3EGXpAX/4nMpH7s/05d9O4tm0MsK\n" - "QUhUXRzt3VzOfMOb4cXAVwovHxiQ7NZIFBdmeyCHlT0HVkaqC76Tgi53scUMVKtE\n" - "lXJB5soc8PbFDjT21MOGzL3+Tqy47ecdZhCiaXYeD3exHFd+VDJXvC3O/GDc3/Fo\n" - "Gwh6iUxkAAa11duUoFfCs3p+XFN216V9jqfkEmf/KU2utMjzSmAvwaGh0WCSTnb2\n" - "lcByiPJWK6w8yx/CeY9Ks+sjI2hWw43jxUCcSa2pPimGLWgu9TYRiG4jWZln9FLW\n" - "hskfF/Ra0Xp0ptxrnuih0DTQ+ZxTscNlg27nuwIDAQABAoIBAFRhD6rG52sI1Qim\n" - "GSlnefx+bSQuPldkvgJMUxOXOClu8kRdy9g7PbYcT4keiMaflO7B3WDw9EJbAGX9\n" - "KP+K+Ca0gvIIvb4zjocy1COcTlU7f2jP7f/tjxaL+lEswE7Nc4OqnaR6XFcFIMWR\n" - "Zfqr7yTvYmEGPjGWXTKzXW17nnWQGYiK5IhLyzR+MQowCIVDK8ByJl18FRZOROtn\n" - "O+Bbm/MCsLsevAJPlKefY8kG/aG6VbrJO0sTvYe/j2QpeSfPOYtSlcDnTdx2Y5za\n" - "HFo+2mHvurhetl7Ba2gyTGu3XoMHtBXQ8jifyv8s3h+iz94twpsWp6D5CkPUw9oB\n" - "OOx/ttECgYEA4z3L7mSJQANvodlWfJUKAIWgdO54Vq6yZ9gELaCCoUXZLwHwjw+v\n" - "3k/WNbCv7lIL/DVzVh/RfFaG4Qe/c/Bu2tgwBv4fcAepvegUznwcY4Q1FB3sPMpm\n" - "fYcYPOy7jwEO7fvG8rjlZCXo6JuyJJsfyC+z+qWuPSpNgY+lj5MPe3UCgYEAw5LX\n" - "VZYnoghqMQGAi2CldxQ5Iz4RtZpIMgJH7yfu7jt1b3VGiBChwwbyfYrvPJTBpfP9\n" - "U05iffC8P8NVVL8KtjNRJLmQftLdssoqCncqdALnBGJ/jRNpxEFOcodReodkmUT/\n" - "vwQOfQXx0JayeRbUmPKgkEfaqcJL2Y2O41iq4G8CgYEA14kYsb/4EphvvLLZfoca\n" - "mo4kOGSsDYPbwfU5WVGiNXd73UNYuUjmxdUx13EEHecCaTEFeY3qc6XafvyLUlud\n" - "ucNOIoPMq8UI8hB8E7HSd23BrpgHJ03O0oddrQPZjnUxhPbHqBdJtKjkdiSfXmso\n" - "RQdCDZ4yWt+R7i6imUCicbUCgYEApg6iY/tQv5XhhKa/3Jg9JnS3ZyMmqknLjxq8\n" - "tWX0y7cUqYSsVI+6qfvWHZ7AL3InUp9uszNVEZY8YO+cHo7vq3C7LzGYbPbiYxKg\n" - "y64PD93/BYwUvVaEcaz5zOj019LqKfGaLThmjOVlQzURaRtnfE5W4ur/0TA2cwxt\n" - "DMCWpmUCgYBKZhCPxpJmJVFdiM6c5CpsEBdoJ7NpPdDR8xlY7m2Nb38szAFRAFhk\n" - "gMk6gXG+ObmPd4H6Up2lrpJgH3GDPIoiBZPOJefa0IXAmYCpqPH+HLG2lspuNyFL\n" - "OY4A1p2EvY8/L6PmPXAURfsE8RTL0y4ww/7mPJTQXsteTawAPDdVKQ==\n" - "-----END RSA PRIVATE KEY-----\n"); - -inline std::string ClientCert( - "-----BEGIN CERTIFICATE-----\n" - "MIIDLjCCAhYCCQCZd28+0jJVLTANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJS\n" - "VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n" - "cyBQdHkgTHRkMRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMTgwMzA0MTM1MjU2WhcN\n" - "NDUwNzIwMTM1MjU2WjBZMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0\n" - "ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIwEAYDVQQDEwls\n" - "b2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtmmq5w50y\n" - "XBnLJNar5LPcQZekBf/icykfuz/Tl307i2bQywpBSFRdHO3dXM58w5vhxcBXCi8f\n" - "GJDs1kgUF2Z7IIeVPQdWRqoLvpOCLnexxQxUq0SVckHmyhzw9sUONPbUw4bMvf5O\n" - "rLjt5x1mEKJpdh4Pd7EcV35UMle8Lc78YNzf8WgbCHqJTGQABrXV25SgV8Kzen5c\n" - "U3bXpX2Op+QSZ/8pTa60yPNKYC/BoaHRYJJOdvaVwHKI8lYrrDzLH8J5j0qz6yMj\n" - "aFbDjePFQJxJrak+KYYtaC71NhGIbiNZmWf0UtaGyR8X9FrRenSm3Gue6KHQNND5\n" - "nFOxw2WDbue7AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAImeUspGIeL24U5sK2PR\n" - "1BcWUBHtfUtXozaPK/q6WbEMObPxuNenNjnEYdp7b8JT2g91RqYd645wIPGaDAnc\n" - "EFz3b2piUZIG8YfCCLdntqwrYLxdGuHt/47RoSCZ2WrTZA6j7wP5ldQZTfefq3VC\n" - "ncz985cJ5AgEOZJmEdcleraoE1ZHb7O/kVxdxA6g93v9n3mm+kVYh3hth2646I8P\n" - "Bn8Gucf3jySWsN5H74lnp4VaA0xyJh2hC/4e/RnYod7TkXaqKeeLc93suIXgHHKt\n" - "jGvMhVuIWj3zzRi5e8Z1Ww5uHbiVyo4+GZMuV6w5ePgZpQ+5hUeD8PYf1AqDZet4\n" - "3SA=\n" - "-----END CERTIFICATE-----\n"); - -inline std::string ServerKey( - "-----BEGIN RSA PRIVATE KEY-----\n" - "MIIEowIBAAKCAQEAzbAyEJFSmPNJ3pLNNSWQVF53Ltof1Wc4JIfvNazl41LjNyuO\n" - "SQV7+6GVFMIybBBoeWQ58hVJ/d8KxFBf6XIV6uGH9WtN38hWrxR6UEGkHxpUSfvg\n" - "TZ2FSsusus5sYDXjW+liQg5P9X/O69z/vmrIuyS8GckNq4/sA+Pw5GgCWDS05e72\n" - "N8r6DG7UlzKm5ynCGI8pRh/EdmxHTP4G8bEKF25x4FRy3Mg7bAaif9owliC2+BLI\n" - "IRNMtZs9BWp0U8GzEv2wY8xzkJEFD37xBiwHOWDj9KAmJpXQMM48PoXgvQsUo0ed\n" - "/a+GHvumeb3tBtsqLALhLFQBEFykA9X4SF93jwIDAQABAoIBAQC488Bw6VuuMMWx\n" - "n6tqKLbZRoBA3t5VFBWFs73DNA8bE8NALqgovQe5Qpg9LEoOpcprrVX1enMoFtEl\n" - "qWg1D+Lpa5bHdY92tDxN/knltMCRPymfxR7ya7wZf394EnmdIZepY/h4kUoQ5LX5\n" - "nKVSYc7RiLyjKwhhxm5hKSvJFkVVbaKvb9jFPEpYJHNWktl9Hh6XLs/DQLZwEVy0\n" - "rR7KSV00XyNPtMlt6EBXLW7/ysYBiDdcGZ+lIp36fDkoC+kmfbNxsmsEO7x/63NW\n" - "yCmhj4qz9hELbuOMNyoX0jzWMXdfEba/t/Gk7klB1/bQZ8VBn4Nd9PTEPHFLhNG2\n" - "s/bQoH3RAoGBAOguUWbVar200VcPwnRjDg2Gw+N+xTR5ONvanIsJaf6xBW8Ymtsl\n" - "J6GDJrJ391L0Zs2+fxLXDUebS8CF8CghL1KtqZxoTSwjBz8G4kn3DKlyZgNJZgyi\n" - "GppY4ttaP1ys1LwO/xzPUJb9pqm84KDjE9JL1czv3Psk5PVzxV/PQlyzAoGBAOLK\n" - "HElPA4rWw79AW9Kzr9mykZzyqalvAmobz8Q/nINnVGUcQu6UY5vDQ6KCOg2vbTl1\n" - "shDrzEyD/mityBZWUgFiKp+KEYjD5CKE8XuryM3MHr9Dvb+zt2JMC6TVBrYJNG91\n" - "OnMjGACRJ0i5SoB2kxiruTwyc2bzWyB6Dw9TfN+1AoGACHwg12w3MWWZPOBDj/NK\n" - "wS3KnNa2KDvB2y77B425hOg9NZkll5qc/ycG1ADUVgC+fQhYJn0bbCF9vDRo2V6V\n" - "FyVnjGK3Z0SEcEY1INTZbpvSpI4bH50Q8dELwU5kAGQEhjbaFdhxroLog012vApw\n" - "YAALeSjO35Kyl1G6xcySNUcCgYBX+rAegFiPc+FcQEte4fZGLc/vYvQOltII9+ER\n" - "8Nt23o8O6nfMtiQuOQHz+TEsPfHRaKc7iT4oMMxxL3l/sNz/TGXcnmNO+y91dL15\n" - "jJrJu3XyHQVvaPirWXTq7Pk9hTSiSIf0Qpj9H1JuE/OjAlzuJTAm+itqtN2VK8TL\n" - "3UeEQQKBgA61gNqGc8uCm58vg76qjMw6dlxBrpjWxYC5QsNh/OUITtWXqKiwTThE\n" - "wkLMtumpDoioIp/cv8xyV7yvdNM0pxB5UtXBK/3P91lKbiyIfpertqMNxs5XzoeG\n" - "CyxY8hFTw3FSk+UYdAAm5qYabGY1DiuvyD1yVAX9aWjAHdbP3H5O\n" - "-----END RSA PRIVATE KEY-----\n"); - -inline std::string ServerCert( - "-----BEGIN CERTIFICATE-----\n" - "MIIDLjCCAhYCCQCZd28+0jJVLDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJS\n" - "VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n" - "cyBQdHkgTHRkMRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMTgwMzA0MTM1MjUwWhcN\n" - "NDUwNzIwMTM1MjUwWjBZMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0\n" - "ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIwEAYDVQQDEwls\n" - "b2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNsDIQkVKY\n" - "80neks01JZBUXncu2h/VZzgkh+81rOXjUuM3K45JBXv7oZUUwjJsEGh5ZDnyFUn9\n" - "3wrEUF/pchXq4Yf1a03fyFavFHpQQaQfGlRJ++BNnYVKy6y6zmxgNeNb6WJCDk/1\n" - "f87r3P++asi7JLwZyQ2rj+wD4/DkaAJYNLTl7vY3yvoMbtSXMqbnKcIYjylGH8R2\n" - "bEdM/gbxsQoXbnHgVHLcyDtsBqJ/2jCWILb4EsghE0y1mz0FanRTwbMS/bBjzHOQ\n" - "kQUPfvEGLAc5YOP0oCYmldAwzjw+heC9CxSjR539r4Ye+6Z5ve0G2yosAuEsVAEQ\n" - "XKQD1fhIX3ePAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAJ1bjP+J+8MgSeHvpCES\n" - "qo49l8JgpFV9h/1dUgz2fYhrVy7QCp8/3THoZcjErKYyzTdOlTzCy1OB4sRNLBiy\n" - "ftGGTm1KHWal9CNMwAN00+ebhwdqKjNCWViI45o5OSfPWUvGAkwxUENrOqLoGBvR\n" - "cVvvMIV5KeaZLTtvrPzfVCMq/B41Mu5ZslDZOTRmSpVlbxmFjUq3WM+wf1sLu2cw\n" - "DDk8O2UQpxJeiowu9XBkQCEkvxU3/5bPBvY/+3sikj8IqaknakEXBKH1e/ZTN3/l\n" - "F6/pV9FE34DC9mIlzIFQyMGKJd4cju6970Pv3blQabuNHJTd570JdMBYbUGJp/mI\n" - "6sI=\n" - "-----END CERTIFICATE-----\n"); - -//////////////////////////////////////////////////////////////////////////////// - template class TRpcOverGrpcImpl { @@ -406,13 +293,10 @@ class TRpcOverGrpcImpl auto channelConfig = New(); if (EnableSsl) { channelConfig->Credentials = New(); - channelConfig->Credentials->PemRootCerts = New(); - channelConfig->Credentials->PemRootCerts->Value = RootCert; + channelConfig->Credentials->PemRootCerts = RpcCACert; channelConfig->Credentials->PemKeyCertPair = New(); - channelConfig->Credentials->PemKeyCertPair->PrivateKey = New(); - channelConfig->Credentials->PemKeyCertPair->PrivateKey->Value = ClientKey; - channelConfig->Credentials->PemKeyCertPair->CertChain = New(); - channelConfig->Credentials->PemKeyCertPair->CertChain->Value = ClientCert; + channelConfig->Credentials->PemKeyCertPair->PrivateKey = RpcClientKey; + channelConfig->Credentials->PemKeyCertPair->CertChain = RpcClientCert; } if (EnableUds) { @@ -434,13 +318,10 @@ class TRpcOverGrpcImpl auto serverAddressConfig = New(); if (EnableSsl) { serverAddressConfig->Credentials = New(); - serverAddressConfig->Credentials->PemRootCerts = New(); - serverAddressConfig->Credentials->PemRootCerts->Value = RootCert; + serverAddressConfig->Credentials->PemRootCerts = RpcCACert; serverAddressConfig->Credentials->PemKeyCertPairs.push_back(New()); - serverAddressConfig->Credentials->PemKeyCertPairs[0]->PrivateKey = New(); - serverAddressConfig->Credentials->PemKeyCertPairs[0]->PrivateKey->Value = ServerKey; - serverAddressConfig->Credentials->PemKeyCertPairs[0]->CertChain = New(); - serverAddressConfig->Credentials->PemKeyCertPairs[0]->CertChain->Value = ServerCert; + serverAddressConfig->Credentials->PemKeyCertPairs[0]->PrivateKey = RpcServerKey; + serverAddressConfig->Credentials->PemKeyCertPairs[0]->CertChain = RpcServerCert; } if (EnableUds) { @@ -468,6 +349,7 @@ class TRpcOverGrpcImpl class TRpcOverUdsImpl { public: + static constexpr bool Secure = false; static constexpr bool MemoryUsageTrackingEnabled = true; static NYT::NBus::IBusServerPtr CreateBusServer(ui16 port, IMemoryUsageTrackerPtr memoryUsageTracker) @@ -518,12 +400,9 @@ class TRpcOverHttpImpl { static auto poller = NConcurrency::CreateThreadPoolPoller(4, "HttpChannelTest"); auto credentials = New(); - credentials->CertificateAuthority = New(); - credentials->CertificateAuthority->Value = RootCert; - credentials->PrivateKey = New(); - credentials->PrivateKey->Value = ClientKey; - credentials->CertificateChain = New(); - credentials->CertificateChain->Value = ClientCert; + credentials->CertificateAuthority = RpcCACert; + credentials->PrivateKey = RpcClientKey; + credentials->CertificateChain = RpcClientCert; return NHttp::CreateHttpChannel(address, poller, EnableSsl, credentials); } @@ -541,10 +420,8 @@ class TRpcOverHttpImpl NYT::NHttp::IServerPtr httpServer; if (EnableSsl) { config->Credentials = New(); - config->Credentials->PrivateKey = New(); - config->Credentials->PrivateKey->Value = ServerKey; - config->Credentials->CertificateChain = New(); - config->Credentials->CertificateChain->Value = ServerCert; + config->Credentials->PrivateKey = RpcServerKey; + config->Credentials->CertificateChain = RpcServerCert; httpServer = NYT::NHttps::CreateServer(config, 4); } else { httpServer = NYT::NHttp::CreateServer(config, 4); @@ -566,8 +443,10 @@ using TAllTransports = ::testing::Types< #ifdef _linux_ TRpcOverBus, #endif - TRpcOverBus>, - TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, TRpcOverGrpcImpl, TRpcOverGrpcImpl, TRpcOverGrpcImpl, @@ -580,8 +459,10 @@ using TWithAttachments = ::testing::Types< #ifdef _linux_ TRpcOverBus, #endif - TRpcOverBus>, - TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, TRpcOverGrpcImpl, TRpcOverGrpcImpl, TRpcOverGrpcImpl, @@ -589,8 +470,10 @@ using TWithAttachments = ::testing::Types< >; using TWithoutUds = ::testing::Types< - TRpcOverBus>, - TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, TRpcOverGrpcImpl, TRpcOverGrpcImpl, TRpcOverHttpImpl, @@ -601,8 +484,10 @@ using TWithoutGrpc = ::testing::Types< #ifdef _linux_ TRpcOverBus, #endif - TRpcOverBus>, - TRpcOverBus> + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus>, + TRpcOverBus> >; using TGrpcOnly = ::testing::Types< diff --git a/yt/yt/core/rpc/unittests/lib/test_keys.cpp b/yt/yt/core/rpc/unittests/lib/test_keys.cpp new file mode 100644 index 000000000000..96cba49eb204 --- /dev/null +++ b/yt/yt/core/rpc/unittests/lib/test_keys.cpp @@ -0,0 +1,17 @@ +#include "common.h" + +namespace NYT::NRpc { + +using namespace NCrypto; + +//////////////////////////////////////////////////////////////////////////////// + +TPemBlobConfigPtr RpcCACert = CreateTestKeyBlob("rpc_ca.pem"); +TPemBlobConfigPtr RpcServerCert = CreateTestKeyBlob("rpc_server_cert.pem"); +TPemBlobConfigPtr RpcServerKey = CreateTestKeyBlob("rpc_server_key.pem"); +TPemBlobConfigPtr RpcClientCert = CreateTestKeyBlob("rpc_client_cert.pem"); +TPemBlobConfigPtr RpcClientKey = CreateTestKeyBlob("rpc_client_key.pem"); + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NRpc diff --git a/yt/yt/core/rpc/unittests/lib/ya.make b/yt/yt/core/rpc/unittests/lib/ya.make index 772e9a673117..4f49825f508d 100644 --- a/yt/yt/core/rpc/unittests/lib/ya.make +++ b/yt/yt/core/rpc/unittests/lib/ya.make @@ -3,6 +3,7 @@ LIBRARY() INCLUDE(${ARCADIA_ROOT}/yt/ya_cpp.make.inc) SRCS( + test_keys.cpp test_service.cpp test_service.proto no_baggage_service.cpp diff --git a/yt/yt/core/test_framework/testdata/rpc_ca.pem b/yt/yt/core/test_framework/testdata/rpc_ca.pem new file mode 100644 index 000000000000..5dde8adc5a46 --- /dev/null +++ b/yt/yt/core/test_framework/testdata/rpc_ca.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFhTCCA22gAwIBAgIUUUuBN4XplKc7D5wkNYmvbdTMpd4wDQYJKoZIhvcNAQEL +BQAwSjELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEPMA0GA1UECgwGWWFu +ZGV4MRkwFwYDVQQDDBBMb2NhbGhvc3QgUlBDIENBMB4XDTI1MTAyNDE0MzExM1oX +DTM1MTAyMjE0MzExM1owSjELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEP +MA0GA1UECgwGWWFuZGV4MRkwFwYDVQQDDBBMb2NhbGhvc3QgUlBDIENBMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwMMN5wXa9+SDVvhJkU1TiBWrnSg4 +8BYJWXOPi0WR9yK6Ks/HDZe+YHyr3jcRl0mo1Nhb/KeLMDaTo5MllS/CoPt38jIJ +7lrxQ5R9Hm6U6A+0uhIpNsefXQ6g7/vIauGQPQG1ejvFXAsnpJ8N4QagOWDb4Kea +tA5bzcUAZnpp1al210Oq3YhCzZW06332zuVdkPWOr2JhR+4LEq6lL6gLAbq0xavP +/4atLx5sfoWOXiAg4qCnxjlXz5jRlradrZkK879C/mwJ2l1VJvAX4UE8inoIQ5Rc +17LwVfdo71yWARHdEkFrwGQSn8dh4QP73hfH8YH+Y7OkU2q5qFD6PD//aJVU+OeV +WsJkFXiNxhp7sEEibPSkGK4BZBp5j0wnR3GfjMPK6pCDnOrLpu+JrgYiwY4qnDYE +yz1Cmeh8/A0nLclz5XzVqC/TkU3oA6+h7VQ7ycw7LtYNTFZAVGjKC5bGev2D3aUW +EXrxmwwmjiN+yuQhiwDwopxjEzmNo621btlkbGrzZGWaPs84aeUxfXAm0roe6ChW +iKDFilU+wUaofnhevtqPDFFSg0M5hhgh1Z/O+SOYWK9fskDExbXpKC/YXp2MLbR9 +q4SfH/l/wCG+IHS4fcK/boY4368PMGzxo4HTq+sgL5nhi+6APJVAdopoGwvxGOdw +jF0mHf5RGrcdhZsCAwEAAaNjMGEwHQYDVR0OBBYEFB95oKfMRwga+fjpq/s9qPSx +jwbhMB8GA1UdIwQYMBaAFB95oKfMRwga+fjpq/s9qPSxjwbhMBIGA1UdEwEB/wQI +MAYBAf8CAQAwCwYDVR0PBAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQCbqFz3/Re8 +jblPekgXusaGmItnod1krAbOIRHTgS/9ETtDEmOxn4IzeKMKz1jAdwmwGL5U6cXN +SA0TeGMyuaHKICmtKrteAfsjtK+JxrtoYPn5g+4FtjW68qhZI28t372bvYtV+6BU +GrPV8UrsdDpGdTu79XszV3sidSPDak6L7lLqAcR+xNnKEUc4uotiJuVUP/V83MmK +DIAF7hULG3E5intDzaSrlojMUhmHs2gPTCzlottlIGhkEgUn2f6VCQ44Jue6S3Mj +eD5USDNRbtsOTQQt5PcqYweFXXDy5ziSBoJMX2RDcPsTzeUnysjDkvmyEAJz32q7 +GyrUAuAXFvC1p/sCcTYRAO+c5H5FBUU5S4Q4e+v1JydYWV3b/Svy04G2YeBerinH +TfaMcUCxxym+6yKjRc+OUwAcR6c9Hi+XuTswNdWVAaFEwqJVIHKtDedFlgu3UDE8 +IZIVYFjqc9Okdrm8H/VOeaG5hFqPcnhSQT7cSybcAhlFddWfpBr7PCd7rQ1flHR4 +2KrOQH96Sd/QKCIlLBYbJqjsA5/8lUKkEabB0zKLBqYVRer+Ate9NrSZaVYTKz89 +OGb2Lk8ePL8yDecgS3JrLfrfsGmIKyVAvZ9q04Ot81B8tzXQdsDP+EhMNKe65VfN +4AK+1k9vbvfMJES4wA4DD8lJvfo78LLS5A== +-----END CERTIFICATE----- diff --git a/yt/yt/core/test_framework/testdata/rpc_client_cert.pem b/yt/yt/core/test_framework/testdata/rpc_client_cert.pem new file mode 100644 index 000000000000..ce7fc16376cd --- /dev/null +++ b/yt/yt/core/test_framework/testdata/rpc_client_cert.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIUCJQI6VLIuMqJJNTohV8FYragybIwDQYJKoZIhvcNAQEL +BQAwSjELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEPMA0GA1UECgwGWWFu +ZGV4MRkwFwYDVQQDDBBMb2NhbGhvc3QgUlBDIENBMB4XDTI1MTAyNDE0MzExNFoX +DTM1MTAyMjE0MzExNFowQzELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEP +MA0GA1UECgwGWWFuZGV4MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3 +DQEBAQUAA4ICDwAwggIKAoICAQC40BVbcedx2N2yBpuvwP62ZUE7DlfXwBIw5K2G +Jp8RpGMLcWRQmmAJVnk0tUO61aOkELCvXLTL1guFnU8Drn7VBq/NCxsnyPerFPtx +tO8U5GWzj4gc5ikU6sfnBEGfqS/s5yPZXQsW20ZhmhzwaZTI56PwXQHON7gaUXc6 +328bJkLWd5MPWCjFDlvs1dLD43CS3Mubat8CEY/gq8GekftHMAnVQ/63yQ6dFV4s +LE76GZfIBkzgx7IIYCeZrtjA9S8gKzaH6xomQWfA1Corg+Lhiq6Qk8h4JdaVCKS9 +EzpMIp5uzTJ99A/asVcHfXXXd9PZNek1vIOzvfQZZakdBCUISj2oAUJPCnSdu6Hi +mJS5ws/OcWpmeZV8D6G7+kKsnWGfL3Mx6dRv2Ud6LKylZ3XBsF25axsJ5fk+Umtl +QPQIFNmq+yye/VZsNbjoCzmk+mxMIrJvEUWeRPtt8JSp8wsqsoCP3eVKoRdKcdxQ +o8E1eVw6GfTEepskaoHziw8JROS1Z8oItsvrj45jjY8bwZ1Uncfg0igOJmfuwrum +Kpt+XHK18bFtyz/thzrN74rUqv+Or8jbPcNq9szKOKeYXYUhEvNu5dcZbO0CUf+Z +9M0IhuZ4sVYZv9HG5YAS8+NUrpKcA2fXftR4e4xdTUXMHAkiVMHb7gBI82kjnddz +hlB/CQIDAQABo3IwcDAdBgNVHQ4EFgQUvnsfpCOu2knYM0U8qH/VZoLBrRcwHwYD +VR0jBBgwFoAUH3mgp8xHCBr5+Omr+z2o9LGPBuEwDAYDVR0TAQH/BAIwADALBgNV +HQ8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggIB +AHkIEEfN3IXXPfpsTOLYX3C4QCigZKsmS/1jtybct314mVn1yXQYdBMCHKuougNs +bkpAImIQ8INOVqFZvHyKBYaxwT4b29T09FTvPZ5OP+2jpSbvTC7JofleAsVcn/CW +hE7KayHaTX/fexdY4Td/JEwCvNDQKe+LAco6Y7OsOkZ5B/qiuVKt/UQz9d5WwNR7 +sQgVpF4HN37jnO69Wz3o2mkiDzZno77rJXsyuaSei+Mfh5izfSLnmYlcRhB5FVVG +Jlj2dmfmrqcsx6f4efcvgaSwaRbe3iQvvGwnYT20KDGRdy35thLtpSUun5/fYfFs +7QJqDM+Nf+c08UhTkETdUij28O/okfmkFLKp5yzDSpIt/hQddcMzrOhTQLsEs9BF +i4euPzffNjqQATL0CxXLHPMuWo7oe8FjDKGEET+cItpS1nwEbHhe22P+Qp+otyqV +B3kn0nQRgr7bx4SXvFeQz+JugMtPmCLsOsqD0dkfr9Jc2bOWz/WaQNhtL1qgPfev +ilZ2NdGexUUr8OzTeMWCiKPzShVDzx/SvBeVL6b989fqpXKpePQf+SPLpfS/j3vs +qB2jdWjPlO3l10jPTkTGHdAduh9QO40+qoGeZNxLEPNIvGEJjGEmKaV571wJdnFw +AMKtSnkRseR3JEgxpovJdYHkpiVjzDHLsWBoMtwsmqjO +-----END CERTIFICATE----- diff --git a/yt/yt/core/test_framework/testdata/rpc_client_key.pem b/yt/yt/core/test_framework/testdata/rpc_client_key.pem new file mode 100644 index 000000000000..fa36b4cc60d1 --- /dev/null +++ b/yt/yt/core/test_framework/testdata/rpc_client_key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC40BVbcedx2N2y +BpuvwP62ZUE7DlfXwBIw5K2GJp8RpGMLcWRQmmAJVnk0tUO61aOkELCvXLTL1guF +nU8Drn7VBq/NCxsnyPerFPtxtO8U5GWzj4gc5ikU6sfnBEGfqS/s5yPZXQsW20Zh +mhzwaZTI56PwXQHON7gaUXc6328bJkLWd5MPWCjFDlvs1dLD43CS3Mubat8CEY/g +q8GekftHMAnVQ/63yQ6dFV4sLE76GZfIBkzgx7IIYCeZrtjA9S8gKzaH6xomQWfA +1Corg+Lhiq6Qk8h4JdaVCKS9EzpMIp5uzTJ99A/asVcHfXXXd9PZNek1vIOzvfQZ +ZakdBCUISj2oAUJPCnSdu6HimJS5ws/OcWpmeZV8D6G7+kKsnWGfL3Mx6dRv2Ud6 +LKylZ3XBsF25axsJ5fk+UmtlQPQIFNmq+yye/VZsNbjoCzmk+mxMIrJvEUWeRPtt +8JSp8wsqsoCP3eVKoRdKcdxQo8E1eVw6GfTEepskaoHziw8JROS1Z8oItsvrj45j +jY8bwZ1Uncfg0igOJmfuwrumKpt+XHK18bFtyz/thzrN74rUqv+Or8jbPcNq9szK +OKeYXYUhEvNu5dcZbO0CUf+Z9M0IhuZ4sVYZv9HG5YAS8+NUrpKcA2fXftR4e4xd +TUXMHAkiVMHb7gBI82kjnddzhlB/CQIDAQABAoICABZZh7Oq1y/z53+PgAVlpAf/ +v786EVJ0ll6WUQvPoN370MSB/n0m5iVK8VZ380xlaKg/Inbakbyy0mriprsNv6XY +bKsxxCNwEM9+Npg+JsmSg2APJAlGpkIy0GD2KU97IOIX48R2FZC6jMzh280RH56a +ML+xJ7Y+E8QPBQm4GpIgcuXHyR+KbEfEYEaIZzgsSaFhFThi2LxBznH/o2cfRVGL +FC1XzzZ/mIZTnrNd2mExdiMI7AQk8jlEE5XoyKqxG/VadHpEasGkmD0AC2d+yBG5 +eTnfvVcWUFhulqmM6Thq2VkR9KC5wq8SUjGEMRuREKwMcnr+pLi4aIwnuKdbKHUe +2GSxkW1HAldKvzZRl8rVj8kHQTmRVoj/CcwcqdH6cdJOJga3wjf4Uln05sLq1G0q +mA6oiX/1dFmAEtLosBV3dyRP3Hn2MvtsW3C6GdEO1D5kPApYLTIgsRIkZBC8lL4S +iVpbWy6eQkcskylEP//gb8jJgYsjMaQtfGG7NuxrudFh8ZulkJ+MBRXhf26Y230s +TYHBei3YyXrkmZKOTh3SxwJTUDLKIGkpc0kq0bXxntZQ0WBmNH9F+b4sD/6ZVPQQ +k7pdh+hNKJoJ5AcjMPfM6sViOYPZcwb7ZhzCYuwtLo852Em1i9iEdRUMQbE1PHzA +r/qvtozLci330EGpT9MvAoIBAQDvNX/wXEtCccm1YT3aPXKo1oTc40+h+D4ClGYo +YrnGEcsqS4XbTL5sU7jkSfbOnVEakNcmWZX2Ry/n4KKYnu+yygm4MaJFn5a6O0i2 +3BYoje7kZ6nPiGrnrbcNrBDL5uAAKcAWfasF9WFgoPWSAmD3NP5u8SALyOkIcOGL +kPpaNfqLdslom5rWs2sN+4OOYn0Bqj19NMTfTDSUjhH6slGJoJYxd60jXpeH7qVu +HcC3qWSz48xe6l9oXQFKLbah95N4OPAMidvbBYrYkKKJMt2wucdhlOWtbyOtNFAt +9Wpcub4srUWfEB3Jy/96L/MAMOh26On16sL11y+Bv7xbtGQ/AoIBAQDFyRqlcixF +vPOtJo76pJeRRd6lp7Pe3MiN8F9qGDIkXzIAErJxb+mMA+FZasd7XCFZwxasb6a2 +8v+f+SYgoxB74c1ianqnHQeaLk4Xeh9xIlWKUG/QbTKoUNY4KOvScyIRwhHkVDIC +4tAepFrIDwdmf6IVoOTlys6S3wul1ieCS3dPq/E+tTrAv6W9snBQwABU60NVmTR6 +Ji/ZgKrqKve5dDTErq2anUCu5wlpo/bzKn7RJ5MXWGRJnokYZawikxy6cDzh2kVu +3GW1iwjz3BfxwdT0oy1rQ9MoHDV9T7AT96LUDCCqRm1ziXBWjtkYTSfBoA0o/vop +FIQjpM5jdaq3AoIBAH7lNJ9/dnUjA8vyb+tsGX0zf3vmIgJcPBkGPENETCSkn9Aq +DDJPvdyddUG1cvYcQkADgf7YG1NwZBtv8RFhjuqbfxh1TA3/IOheNq66hg6xbH9B +9rUfOwb4AlmAY9CnA0FS5JGJzMX2a9fkyyDPnjzFogucYlGeHPDbYOq21/gvFmAR +fbq+gR9QQoRCXoGUAZh2hPP8oEuMk4AS9bq2Cccmp0ZKpFBVB7GWia+mnOtRMxiy +yWG4lzA31k1RfsbhHRvzqHQeVcEUaZmE8JQzpaLwirJbWJPul1B0pewbencCGb59 +lKdS11qLm1VoRlJdn5Qk7qgEB7R+mLcNzZAgW+UCggEARnA0mS9sLPn6HnRY/1KW +2Bn2DTEIkho3IrW0hWhQkzuD5xrBijy9BCxtmRa6LGjHR9x+urKYwRcRiruEpKLu +P/BO4Pni7JkeF/7duOa5Q+ViaXv0FlqNa/w+DookUjLGs2RWUubZWMXGMON/oTgY +/pv98Y33dw8fOpdM4qa+M10FBM7Lf/WzEuot8L0X2upGM/gFZvrFAauP5vo35GWh +C98i29kJ4sKWQrPtWj4WuMstlvdtHydPsBhR4upyv219EbjfNeAyUiUT4++8JH0B +2guZ9/YVOtpQ3TwOoK48mx/aUYJwL7QdTsRnyaveDRWNTxvdE/iaxv6TgM404p8J +SQKCAQAsuKcjftz3AJXSbZYMNrRgjRKEnf08mocuryF+BvMerS5sTfsG0uMmYyRJ +6TeXfoKkz4kHbeathQDklWUBfPZwrShRoz8GRvoM3k8wNwvxZsD0zXd2eQOF2QR9 +C3m8ZBb4Az8fp4MImG6ec0gO3x7porn/EYrB+HwZHeuPXs6wjLsMLEVZYPc1dbVW +gBhhHwmWxIxeMHpkh6jfhtiCT7vxnIe1tEp6oMHM/kbmbwVvyd1oshUesVGkjA5G +OoPSkPvnKB/p5u/5y7dc/0f0IFRq4+C7sgyqw0rmzm/59jagkrhRD07lYzwvCWTz +A8QGcG/ZdfasQUm0EKigXfZMjWjO +-----END PRIVATE KEY----- diff --git a/yt/yt/core/test_framework/testdata/rpc_server_cert.pem b/yt/yt/core/test_framework/testdata/rpc_server_cert.pem new file mode 100644 index 000000000000..89db106b025f --- /dev/null +++ b/yt/yt/core/test_framework/testdata/rpc_server_cert.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIUOfrndmBSlBSqnYI4OCYfeQ0HChQwDQYJKoZIhvcNAQEL +BQAwSjELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEPMA0GA1UECgwGWWFu +ZGV4MRkwFwYDVQQDDBBMb2NhbGhvc3QgUlBDIENBMB4XDTI1MTAyNDE0MzExM1oX +DTM1MTAyMjE0MzExM1owQzELMAkGA1UEBhMCUlUxDzANBgNVBAcMBk1vc2NvdzEP +MA0GA1UECgwGWWFuZGV4MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3 +DQEBAQUAA4ICDwAwggIKAoICAQDanjuPr+zHp/N4rss1llXWGNe4g/7Hrc3yfHHc +vWeur2GrNlhJu2FgShdgzaLmdeeT0KDtj2oc71WP+b7KOv4wvBXWI9TKNqmcuxl/ +cRbcpfnyi5Zy79lcZgzUb4vlFSpv+RTVLu5wLVjWoh6cLccqUMd5tO2EXY2t0DjQ +NR+nariFfGRQL3jH55I5MdYE3kTdu+m0aUYjRCspEYoSh4zt9AtM8bfrwG8I1UMJ +oXenxnYxy5XnbQuXID4kRVSsfeLBsNwKZb2rRe9lgiSdDCYn0B32U2b6l72Peatr +YfGPVtoyqllvrAMB3Zp5CugG04xP7qhGHooVAhIt+JL9jlMqM/qO1MU956l3O4m6 +dCEoR6UlFKvRiPAjdcgf15tR6Z/+CowME2Z6boaSzU+U2+ysMlgRocXkN7reVjqb +uUkw5G0krUHyxchwULHkYgqZQebTkoM4mUJjhZyGSbc3KOUGBZVJYZojDGI1tJPc +RW0L1YnGyMeobbdPKqTy87O0fADaBfv/rILsF1SU2ZTw7tRAKrYha5Kt4qbXnz+c +jmJtymoWzASH1HNKFwcM960UqHq+XTzkddsRtO4Wdu+glqmNGj05J/8aoPg62wS8 +UE2hjmgeqDE3W1X8Tv840nVkxgQp3FeXZXPEhSvXa+PEY2+61AI/dUDg/f9e6FXc +HZT9JQIDAQABo3IwcDAdBgNVHQ4EFgQUJfV5UnBti0YUHIEoACVsAZ+/xwQwHwYD +VR0jBBgwFoAUH3mgp8xHCBr5+Omr+z2o9LGPBuEwDAYDVR0TAQH/BAIwADALBgNV +HQ8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggIB +AHz5c+ydiS0VFXWWQxGjb1AXhjJMxYBTj6CKbK03NHXbjut/KstWnqIWewt5MjXy +yPbZz2LHPVyE58WYLPPI7LXG8SR/v0dD1Fw8Vn6aU+RxBD9UBa4I2+K6hOXR8fy3 +T3dKoiWLAQ+0dI57ujqE1TPwoMvzRKkckJt73VHPxxQMDJGfwucP0G6N5VIhLIq1 +63A2jF6GGtYNQtEPPc9EhKS4rNipHcILSAcqPCl9WuSyvTlOOXd6J0BAcCwysON3 +swS5WvQDOqcSwkkznaw0sCK1059sdRyqe63xTXgFVARUpm2dUpRfFZhLINGiOuEG +3N1wqdy7+CJCJEHRakBMzAJZkiAxhtOuSnRkThHaxq8wcCtc2dGbKRcNW6EtTW7U +LMlCHn8totqNPYh75D7+FjEhA4f0reaaVT8LY+gi/Wr7jFiYdP2lu7YwmjBlU+AU +FUP5I15atOkoG9feCPZljunHozKj9pz2FJlEjKiHrWr9JTDJMcTIyy38gzTnnFDF +YEuJV6yNqi/hqdkbe5Y9l/71VpIxKAnPXKaS9kSW72oAK0Q/RuU7aJEq2E9tKGa7 +H79Cadd+uKUKITy/XuS7Q6HF70kNAsYbeohb6P6+8YOV+l5yGLaNanr9L9f1pHGj +1bT3LqsmNb0/FVaqZO8IveJAMYrcD7EXiV1uY5B7Gv6w +-----END CERTIFICATE----- diff --git a/yt/yt/core/test_framework/testdata/rpc_server_key.pem b/yt/yt/core/test_framework/testdata/rpc_server_key.pem new file mode 100644 index 000000000000..5d2ec50762f7 --- /dev/null +++ b/yt/yt/core/test_framework/testdata/rpc_server_key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQDanjuPr+zHp/N4 +rss1llXWGNe4g/7Hrc3yfHHcvWeur2GrNlhJu2FgShdgzaLmdeeT0KDtj2oc71WP ++b7KOv4wvBXWI9TKNqmcuxl/cRbcpfnyi5Zy79lcZgzUb4vlFSpv+RTVLu5wLVjW +oh6cLccqUMd5tO2EXY2t0DjQNR+nariFfGRQL3jH55I5MdYE3kTdu+m0aUYjRCsp +EYoSh4zt9AtM8bfrwG8I1UMJoXenxnYxy5XnbQuXID4kRVSsfeLBsNwKZb2rRe9l +giSdDCYn0B32U2b6l72PeatrYfGPVtoyqllvrAMB3Zp5CugG04xP7qhGHooVAhIt ++JL9jlMqM/qO1MU956l3O4m6dCEoR6UlFKvRiPAjdcgf15tR6Z/+CowME2Z6boaS +zU+U2+ysMlgRocXkN7reVjqbuUkw5G0krUHyxchwULHkYgqZQebTkoM4mUJjhZyG +Sbc3KOUGBZVJYZojDGI1tJPcRW0L1YnGyMeobbdPKqTy87O0fADaBfv/rILsF1SU +2ZTw7tRAKrYha5Kt4qbXnz+cjmJtymoWzASH1HNKFwcM960UqHq+XTzkddsRtO4W +du+glqmNGj05J/8aoPg62wS8UE2hjmgeqDE3W1X8Tv840nVkxgQp3FeXZXPEhSvX +a+PEY2+61AI/dUDg/f9e6FXcHZT9JQIDAQABAoICAA4rNjIEVWTFQlbegUYaVbrY +Blcrmt4nKhNetGR5lBgyvrJBhexVbCS4+JXqDfZAyv7+BQgQhPCWJGX96jsiIqpW +7lVgIiDu9QQ27hqf4jrvuOja2ifd2qkN5iP4jMkOm58BNjPw5Dw5/CmA/Vni76cS +8DK3orMy+wU6WwxHfSM1G/tuyfOWeA4AuK3jSHstSqpSTP3H2udbOi7ht6Cmz1/2 +sqrMeb6aTLf2Vm9v2xjxGGT2zGLg4uDrEov4QFojmIg0Jba4zFem4zKhgiz5hhmL +d/2ofyKbpgn/+Teu8+B14RNqjfxaWiGLUsEoj0wt9siRb6+HuCxPY40+MIylZkdV +x6rgoH20C3xLvDovXAw+7aKttOO16OGgktS63+ojjkIAcGE0JkiUpbRvm/s0Jbke +3Yv/WRIomo7KUMGI9zSWaYXrNh3vUzh1xItl681nzDObh36Y7XBUOy+XQXvjTk05 +bobdunQGx25ePxGllUMaMkpQam9UzP3rbJtuyyhuLJSd4eZRxsJebQDmaM/by9hs +mLHjqy9clBAcibHM3lpUGj3oR7NC/7R2dBZYTUqYadjkstzkYiu7L6xuISd17GXy +G7OEeSulBoO11JhsjJShybxNVUQPfX5u6UfSxpTUo1XIEtKXc1OrQPxfaO26KmLj +wchamGFizSSDf071breRAoIBAQDrTCLm0dyukv7mQLkMO0IGoG4m0fmrubdv85LL +x7aV7utqIXJ30FgbxqrDgJKzGgZYMKIXQCUzMVlKM94SaFhxsOnNHmEUnYm0wzJc ++hHhxgT0ahDVXLUZXd/3u7MvrachmnugO5lh+O4Ot9zPL+OaQHYdZ4zLX+zJe3hL +1pMkC59JLsm/ICDDA4aHYkYT1nr9/k/+gGDue5nDfR1tdFB8ZZWXu0v3ZIdXLuFZ +iutGTVJNLxYw9zLfkimlJKaVE/COCtvN8HI5Yp0TI9neoOI4YQpSGvOXKNKD+yG+ ++oKhhqRDYh8zWXXFcLGIzinX/Ta9kHqoWRiuQuGTLZ5V/sdJAoIBAQDt2mjl8U+I +B/RTr8WcrmI7ewy76ZvoJWxjGg4Szy0QOY1qmg39Iqvs72UNEXfcSI0qfB/W4aDm +5qyuwSrRp/JbhjzR+SEzQKvn9rOPCtf7Sere4hcinElHPNJ42kR9rhJ0AvuLtYXx +7M/ZXVCymwSGDwhcvLqsqIaMCwVYPZw3MzsCzhpAnXWF1jRbb8vBub3LhjdSbWXj +1w/lWsARCiDkwCB/njaMNNqq1ki0fFU31zdp14bF7Q4ItysAKofJ160XcYVUtkN/ +5ONnIB+UexqA410UNPqkeIGc/IMT8BLMRisEHS2QZrlFy0NGe5qJ/nYYokevihe8 +w6xGboUJB7r9AoIBACIHYszK8QV2UNLv7VMthsD6lrOajmcddsAEE+jQu0E3ymgQ +6kMVqIhr1OptP8oTK3O5pNeD+V1L98PZeHZlDNV0Znu5twSKPA4eZLw5ljh2sOTA +KisRO0et4eQsCyAMFy2u784ekHIw1Azg3lhAbsQyKmLaROxstQv2hVFCeQkvfRvS +Xm77sIFDk0MlHUllLWhqTRtbaalTyssQ3x6jQbib4GSPO89NhJ1BNGoEwz3plMuA +0c7HEV5v/wHZKRZKSfHg9CT2by6JanoIJ0whLFZHAn0ZVL05tChOO3UpOZcup7bv +C+AbQgMJ50MHvdl0z2Pe7z5FlGIvXfwxDsMVE7ECggEAB10ktEHFUZPVd6XQe2pW +tjq4CTVRU12dPnA3EVQCtCbj/vHoDvc81WgP+9iXmmVQoYkYP0HbBmsL25k1ZypI +8ZZ1WZbZ9UlCSTs1Ee+nAiumruHXD4ZBKohyh7VSO4XhImBZQ1kKXZQUV0lxTyZH +fJMIkj5xlRjemYVZ1AKMTJU0dYDGBUwasFsSYeZTK5tBigSMv+uNJQGqh1JI8f4b +SJm+J9VRIQQd5P4fYB8dUE5Ec+1tScFuFsz88tNeQtx/imNEWnwOGO6QL8gp0iIB +jw36+r4tKFxmvuJ+eGaNXm+ps0Xn/DmB8Ow7F/qJrU4If/i+OWwQEhMIyWFwkvf/ +TQKCAQAF4obbQtbTrEKFF6z+45wD06dPxw6kBWRqmORpYlQXXCALwvsPleFeAEx5 +nuvP+JxfHhq7mpFziCvDQTo7C2adogzzVW+JGKmmyKmVgOYzfAHm5+0TAKEZG511 +FnyBV7QQSxFnhKkx6L7UZt1pTbMC5ntc4suDoAZ0ZyuF+2JyWh4QJ5vkzo723DxC +bDsrhCKaDxAwq4Gv2GMLxJFpMhn7mWM3VqTq2pgT0/uQnE6J9lWDd6HrZDmqsiIy +IXh3IdHN8Zrie16SgEXxZDfom8c9vfvoZ/nLLtpv2jrrVPekKm5VCiT3O8K8Dczq +hSvlyteuvI6MhjnJikG74uMgsYk+ +-----END PRIVATE KEY----- diff --git a/yt/yt/core/test_framework/ya.make b/yt/yt/core/test_framework/ya.make index 34bbe4799939..945224e4f969 100644 --- a/yt/yt/core/test_framework/ya.make +++ b/yt/yt/core/test_framework/ya.make @@ -34,6 +34,11 @@ RESOURCE( ${TEST_DATA_DIR}/key.pem /testdata/key.pem ${TEST_DATA_DIR}/key_ec.pem /testdata/key_ec.pem ${TEST_DATA_DIR}/key_with_ip_in_san.pem /testdata/key_with_ip_in_san.pem + ${TEST_DATA_DIR}/rpc_ca.pem /testdata/rpc_ca.pem + ${TEST_DATA_DIR}/rpc_server_cert.pem /testdata/rpc_server_cert.pem + ${TEST_DATA_DIR}/rpc_server_key.pem /testdata/rpc_server_key.pem + ${TEST_DATA_DIR}/rpc_client_cert.pem /testdata/rpc_client_cert.pem + ${TEST_DATA_DIR}/rpc_client_key.pem /testdata/rpc_client_key.pem ) END() From 00c4c5d5cbf8f52cbacc2aa7cebe1ca172efdf29 Mon Sep 17 00:00:00 2001 From: robot-ya-builder Date: Tue, 11 Nov 2025 10:04:40 +0300 Subject: [PATCH 04/17] Automatic release build for os_test_tool, test_tool, os_ya, ya_bin commit_hash:07bebb99ce3dc687f9c0be81c56e82d8391573f6 --- build/mapping.conf.json | 2 ++ build/platform/test_tool/host.ya.make.inc | 10 +++++----- build/platform/test_tool/host_os.ya.make.inc | 10 +++++----- ya | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/build/mapping.conf.json b/build/mapping.conf.json index 08bba0f90304..5ee0c751433a 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -467,6 +467,7 @@ "10153859564": "{registry_endpoint}/10153859564", "10164110401": "{registry_endpoint}/10164110401", "10190826595": "{registry_endpoint}/10190826595", + "10239299149": "{registry_endpoint}/10239299149", "5486713852": "{registry_endpoint}/5486713852", "5514352253": "{registry_endpoint}/5514352253", "5523579199": "{registry_endpoint}/5523579199", @@ -2288,6 +2289,7 @@ "10153859564": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "10164110401": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "10190826595": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", + "10239299149": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5486713852": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5514352253": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5523579199": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", diff --git a/build/platform/test_tool/host.ya.make.inc b/build/platform/test_tool/host.ya.make.inc index 9b95f8173ce4..b1d4f933c8e0 100644 --- a/build/platform/test_tool/host.ya.make.inc +++ b/build/platform/test_tool/host.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190891954) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239425239) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190886565) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239422513) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190901147) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239430509) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190882391) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239420178) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190896591) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239427879) ENDIF() diff --git a/build/platform/test_tool/host_os.ya.make.inc b/build/platform/test_tool/host_os.ya.make.inc index 3d9090751626..f3177a122d8c 100644 --- a/build/platform/test_tool/host_os.ya.make.inc +++ b/build/platform/test_tool/host_os.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190817653) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239294900) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190812518) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239293034) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190826595) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239299149) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190807948) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239291286) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10190822339) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:10239296643) ENDIF() diff --git a/ya b/ya index 9298933c9b12..8719ad186426 100755 --- a/ya +++ b/ya @@ -39,33 +39,33 @@ REGISTRY_ENDPOINT = os.environ.get("YA_REGISTRY_ENDPOINT", "https://devtools-reg PLATFORM_MAP = { "data": { "win32": { - "md5": "ae42a4da23008c4c7be326a5d1fc528b", + "md5": "991ae07dc47a404bce6a191d11177bf4", "urls": [ - f"{REGISTRY_ENDPOINT}/10190927723" + f"{REGISTRY_ENDPOINT}/10239376919" ] }, "darwin": { - "md5": "f4705c6c2ea9bd1c7e53ca1a7eccf8e9", + "md5": "1d724ef1282edd5708158ea52d5e4e0a", "urls": [ - f"{REGISTRY_ENDPOINT}/10190923693" + f"{REGISTRY_ENDPOINT}/10239374659" ] }, "darwin-arm64": { - "md5": "7ce32573dac9b6198ada52e64cfc1992", + "md5": "9d5318b5e43aba173c9edc5cbc2211d9", "urls": [ - f"{REGISTRY_ENDPOINT}/10190918741" + f"{REGISTRY_ENDPOINT}/10239372450" ] }, "linux-aarch64": { - "md5": "db0c0fd53813d3651407973cdc35a600", + "md5": "e9f2d8124ee2b29cb4163268c16b24ee", "urls": [ - f"{REGISTRY_ENDPOINT}/10190914910" + f"{REGISTRY_ENDPOINT}/10239369954" ] }, "linux": { - "md5": "a21597b8b049915fdf07523908b72947", + "md5": "502988d8c3a652e2cd4092ddb2748cc6", "urls": [ - f"{REGISTRY_ENDPOINT}/10190932194" + f"{REGISTRY_ENDPOINT}/10239379628" ] } } From 823d6852283c5cf1f875b505f73968db253e7a6a Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 11 Nov 2025 10:35:15 +0300 Subject: [PATCH 05/17] Intermediate changes commit_hash:8f8806e9d16d1acad2d6bc10c1d4c125cd0a2a32 --- yt/yt/RpcProxyProtocolVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/yt/RpcProxyProtocolVersion.txt b/yt/yt/RpcProxyProtocolVersion.txt index 296295756670..47f3a333a31d 100644 --- a/yt/yt/RpcProxyProtocolVersion.txt +++ b/yt/yt/RpcProxyProtocolVersion.txt @@ -16,7 +16,7 @@ SET(YT_RPC_PROXY_SERVER_PROTOCOL_VERSION_MINOR 2) SET(YT_RPC_MODIFY_ROWS_STRONG_LOCKS_VERSION 2) # RPC python client has protocol version plus some patch version -SET(YT_RPC_PYTHON_BINDINGS_PATCH_VERSION 20) +SET(YT_RPC_PYTHON_BINDINGS_PATCH_VERSION 21) # YT proto package has protocol version plus some patch version SET(YT_PROTO_PACKAGE_PATCH_VERSION 15) From b9bb3b673da2a334c04287c1708eeea436fdb366 Mon Sep 17 00:00:00 2001 From: pechatnov Date: Tue, 11 Nov 2025 11:03:48 +0300 Subject: [PATCH 06/17] Stop old tracer asynchronously when replacing old tracer with new one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Чтобы трейсер можно было повторно конфигурить вызовом ConfigureSingletons А он происходит под спинлоком https://nda.ya.ru/t/QrU79ucQ7MmHMb commit_hash:c573a04d19e41c80f128ac9f0ee50d2c46968f34 --- yt/yt/core/tracing/trace_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/yt/core/tracing/trace_context.cpp b/yt/yt/core/tracing/trace_context.cpp index 863ca550ed58..8fb3e249d7f5 100644 --- a/yt/yt/core/tracing/trace_context.cpp +++ b/yt/yt/core/tracing/trace_context.cpp @@ -82,7 +82,7 @@ void SetGlobalTracer(const ITracerPtr& tracer) } if (oldTracer) { - oldTracer->Stop(); + GetFinalizerInvoker()->Invoke(BIND(&ITracer::Stop, oldTracer)); } } From 679fed2244780e5d17597bbe39ef7ae7dcca9073 Mon Sep 17 00:00:00 2001 From: imunkin Date: Tue, 11 Nov 2025 11:21:28 +0300 Subject: [PATCH 07/17] YQL-20626: Optimize the upvalues build pass Follows up e58d49c7f50d1a4db0deb7b3f0f71f0b20e76b5b commit_hash:c2febfe8d4839f108e00bb01f60e6e870b3b1311 --- .../mkql_computation_node_impl.cpp | 14 ++++++- .../computation/mkql_computation_node_impl.h | 37 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp b/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp index 4c0e3b5e9784..726f221cb11c 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_impl.cpp @@ -116,7 +116,8 @@ EValueRepresentation TUnboxedImmutableComputationNode::GetRepresentation() const } Y_NO_INLINE TStatefulComputationNodeBase::TStatefulComputationNodeBase(ui32 valueIndex, EValueRepresentation kind) - : ValueIndex_(valueIndex) + : UpvaluesCollected_(false) + , ValueIndex_(valueIndex) , RepresentationKind_(kind) { } @@ -155,8 +156,17 @@ Y_NO_INLINE void TStatefulComputationNodeBase::CollectDependentIndexesImpl( } Y_NO_INLINE void TStatefulComputationNodeBase::CollectUpvaluesImpl(TComputationExternalNodePtrSet& upvalues) const { + // XXX: If upvalues for the node are already collected, just + // enrich the set, given by the caller;.. + if (this->UpvaluesCollected_) { + upvalues.insert(this->Upvalues_.cbegin(), this->Upvalues_.cend()); + return; + } + // ... otherwise, recursively collect the upvalue candidates... std::for_each(Dependencies_.cbegin(), Dependencies_.cend(), std::bind(&IComputationNode::CollectUpvalues, std::placeholders::_1, std::ref(upvalues))); + // ... and filter out the owned nodes. std::erase_if(upvalues, [this](IComputationExternalNode* uv) { return Owned_.find(uv) != Owned_.cend(); }); + this->UpvaluesCollected_ = true; } Y_NO_INLINE TStatefulSourceComputationNodeBase::TStatefulSourceComputationNodeBase() @@ -377,6 +387,7 @@ Y_NO_INLINE void TPairStateWideFlowComputationNodeBase::CollectDependentIndexesI Y_NO_INLINE TDecoratorComputationNodeBase::TDecoratorComputationNodeBase(IComputationNode* node, EValueRepresentation kind) : Node_(node) , Kind_(kind) + , UpvaluesCollected_(false) { } @@ -393,6 +404,7 @@ Y_NO_INLINE TBinaryComputationNodeBase::TBinaryComputationNodeBase( : Left_(left) , Right_(right) , Kind_(kind) + , UpvaluesCollected_(false) { } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_impl.h b/yql/essentials/minikql/computation/mkql_computation_node_impl.h index a2e6387c1993..58a23a621f33 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_impl.h +++ b/yql/essentials/minikql/computation/mkql_computation_node_impl.h @@ -96,6 +96,7 @@ class TStatefulComputationNodeBase { mutable TConstComputationNodePtrVector Dependencies_; mutable TComputationExternalNodePtrSet Owned_; TComputationExternalNodePtrSet Upvalues_; + mutable bool UpvaluesCollected_; const ui32 ValueIndex_; const EValueRepresentation RepresentationKind_; @@ -193,6 +194,7 @@ class TStatefulSourceComputationNode: public TStatefulComputationNodeUpvaluesCollected_, "Upvalues have not been collected yet"); return this->Upvalues_; } @@ -210,7 +212,6 @@ class TStatefulSourceComputationNode: public TStatefulComputationNodeCollectUpvaluesImpl(upvalues); - std::erase_if(upvalues, [this](IComputationExternalNode* uv) { return this->Owned_.find(uv) != this->Owned_.cend(); }); } const IComputationNode* GetSource() const final { @@ -307,10 +308,10 @@ class TFlowSourceBaseComputationNode: public TStatefulComputationNodeCollectUpvaluesImpl(upvalues); - std::erase_if(upvalues, [this](IComputationExternalNode* uv) { return this->Owned_.find(uv) != this->Owned_.cend(); }); } TComputationExternalNodePtrSet GetUpvalues() const final { + MKQL_ENSURE(this->UpvaluesCollected_, "Upvalues have not been collected yet"); return this->Upvalues_; } @@ -380,6 +381,7 @@ class TFlowBaseComputationNode: public TRefCountedComputationNodeUpvaluesCollected_, "Upvalues have not been collected yet"); return this->Upvalues_; } @@ -493,8 +496,17 @@ class TFlowBaseComputationNode: public TRefCountedComputationNodeUpvaluesCollected_) { + upvalues.insert(this->Upvalues_.cbegin(), this->Upvalues_.cend()); + return; + } + // ... otherwise, recursively collect the upvalue candidates... std::for_each(Dependencies_.cbegin(), Dependencies_.cend(), std::bind(&IComputationNode::CollectUpvalues, std::placeholders::_1, std::ref(upvalues))); + // ... and filter out the owned nodes. std::erase_if(upvalues, [this](IComputationExternalNode* uv) { return this->Owned_.find(uv) != this->Owned_.cend(); }); + this->UpvaluesCollected_ = true; } void PrepareStageOne() final { @@ -518,6 +530,7 @@ class TFlowBaseComputationNode: public TRefCountedComputationNode @@ -868,6 +881,7 @@ class TDecoratorComputationNodeBase { IComputationNode* const Node_; const EValueRepresentation Kind_; TComputationExternalNodePtrSet Upvalues_; + mutable bool UpvaluesCollected_; }; template @@ -912,7 +926,15 @@ class TDecoratorComputationNode: public TRefCountedComputationNodeUpvaluesCollected_) { + upvalues.insert(this->Upvalues_.cbegin(), this->Upvalues_.cend()); + return; + } + // ... otherwise, recursively collect the upvalues. Node_->CollectUpvalues(upvalues); + this->UpvaluesCollected_ = true; } ui32 GetDependentWeight() const final { @@ -924,6 +946,7 @@ class TDecoratorComputationNode: public TRefCountedComputationNodeUpvaluesCollected_, "Upvalues have not been collected yet"); return this->Upvalues_; } @@ -961,6 +984,7 @@ class TBinaryComputationNodeBase { IComputationNode* const Right_; const EValueRepresentation Kind_; TComputationExternalNodePtrSet Upvalues_; + mutable bool UpvaluesCollected_; }; template @@ -1026,8 +1050,16 @@ class TBinaryComputationNode: public TRefCountedComputationNodeUpvaluesCollected_) { + upvalues.insert(this->Upvalues_.cbegin(), this->Upvalues_.cend()); + return; + } + // ... otherwise, recursively collect the upvalues. Left_->CollectUpvalues(upvalues); Right_->CollectUpvalues(upvalues); + this->UpvaluesCollected_ = true; } ui32 GetDependentWeight() const final { @@ -1039,6 +1071,7 @@ class TBinaryComputationNode: public TRefCountedComputationNodeUpvaluesCollected_, "Upvalues have not been collected yet"); return this->Upvalues_; } From 452ab533ea3ab6d559d4df083f5d43466e764dd9 Mon Sep 17 00:00:00 2001 From: robot-contrib Date: Tue, 11 Nov 2025 13:17:49 +0300 Subject: [PATCH 08/17] Update contrib/python/Jinja2/py3 to 3.1.6 commit_hash:244282cfaf643bf8c4718c0d6cb16149761365a3 --- contrib/python/Jinja2/py3/.dist-info/METADATA | 36 +- contrib/python/Jinja2/py3/README.md | 31 +- contrib/python/Jinja2/py3/jinja2/__init__.py | 2 +- .../python/Jinja2/py3/jinja2/async_utils.py | 27 +- contrib/python/Jinja2/py3/jinja2/compiler.py | 98 +- contrib/python/Jinja2/py3/jinja2/debug.py | 2 +- .../python/Jinja2/py3/jinja2/environment.py | 41 +- contrib/python/Jinja2/py3/jinja2/ext.py | 2 +- contrib/python/Jinja2/py3/jinja2/filters.py | 63 +- .../python/Jinja2/py3/jinja2/idtracking.py | 26 +- contrib/python/Jinja2/py3/jinja2/lexer.py | 8 +- contrib/python/Jinja2/py3/jinja2/loaders.py | 76 +- contrib/python/Jinja2/py3/jinja2/parser.py | 42 +- contrib/python/Jinja2/py3/jinja2/runtime.py | 42 +- contrib/python/Jinja2/py3/jinja2/sandbox.py | 87 +- contrib/python/Jinja2/py3/jinja2/utils.py | 19 +- .../py3/patches/03-fix-PackageLoader.patch | 16 +- .../py3/patches/04-fix-PackageLoader-2.patch | 27 + contrib/python/Jinja2/py3/tests/test_api.py | 16 +- contrib/python/Jinja2/py3/tests/test_async.py | 122 +- .../Jinja2/py3/tests/test_async_filters.py | 74 +- .../python/Jinja2/py3/tests/test_compile.py | 80 + .../python/Jinja2/py3/tests/test_core_tags.py | 8 + .../python/Jinja2/py3/tests/test_filters.py | 1 + .../python/Jinja2/py3/tests/test_loader.py | 28 +- .../Jinja2/py3/tests/test_nativetypes.py | 10 + .../Jinja2/py3/tests/test_regression.py | 22 + .../python/Jinja2/py3/tests/test_runtime.py | 50 + .../python/Jinja2/py3/tests/test_security.py | 29 + contrib/python/Jinja2/py3/tests/test_utils.py | 20 + contrib/python/Jinja2/py3/tests/ya.make | 35 +- contrib/python/Jinja2/py3/ya.make | 2 +- contrib/python/outcome/.dist-info/METADATA | 63 + .../python/outcome/.dist-info/top_level.txt | 1 + contrib/python/outcome/LICENSE | 3 + contrib/python/outcome/LICENSE.APACHE2 | 202 ++ contrib/python/outcome/LICENSE.MIT | 20 + contrib/python/outcome/README.rst | 29 + contrib/python/outcome/outcome/__init__.py | 20 + contrib/python/outcome/outcome/_impl.py | 239 ++ contrib/python/outcome/outcome/_util.py | 33 + contrib/python/outcome/outcome/_version.py | 7 + contrib/python/outcome/outcome/py.typed | 0 contrib/python/outcome/ya.make | 30 + contrib/python/sniffio/.dist-info/METADATA | 104 + .../python/sniffio/.dist-info/top_level.txt | 1 + .../python/sniffio/.yandex_meta/yamaker.yaml | 2 + contrib/python/sniffio/LICENSE | 3 + contrib/python/sniffio/LICENSE.APACHE2 | 202 ++ contrib/python/sniffio/LICENSE.MIT | 20 + contrib/python/sniffio/README.rst | 76 + contrib/python/sniffio/sniffio/__init__.py | 17 + contrib/python/sniffio/sniffio/_impl.py | 95 + contrib/python/sniffio/sniffio/_version.py | 3 + contrib/python/sniffio/sniffio/py.typed | 0 contrib/python/sniffio/ya.make | 25 + contrib/python/trio/.dist-info/METADATA | 186 + .../python/trio/.dist-info/entry_points.txt | 2 + contrib/python/trio/.dist-info/top_level.txt | 1 + contrib/python/trio/.yandex_meta/yamaker.yaml | 3 + contrib/python/trio/LICENSE | 3 + contrib/python/trio/LICENSE.APACHE2 | 202 ++ contrib/python/trio/LICENSE.MIT | 22 + contrib/python/trio/README.rst | 145 + contrib/python/trio/trio/__init__.py | 133 + contrib/python/trio/trio/__main__.py | 3 + contrib/python/trio/trio/_abc.py | 714 ++++ contrib/python/trio/trio/_channel.py | 615 ++++ contrib/python/trio/trio/_core/__init__.py | 94 + contrib/python/trio/trio/_core/_asyncgens.py | 243 ++ contrib/python/trio/trio/_core/_concat_tb.py | 26 + .../python/trio/trio/_core/_entry_queue.py | 223 ++ contrib/python/trio/trio/_core/_exceptions.py | 169 + .../trio/_core/_generated_instrumentation.py | 50 + .../trio/trio/_core/_generated_io_epoll.py | 98 + .../trio/trio/_core/_generated_io_kqueue.py | 153 + .../trio/trio/_core/_generated_io_windows.py | 204 ++ .../python/trio/trio/_core/_generated_run.py | 269 ++ .../trio/trio/_core/_generated_windows_ffi.py | 10 + .../trio/trio/_core/_instrumentation.py | 117 + contrib/python/trio/trio/_core/_io_common.py | 31 + contrib/python/trio/trio/_core/_io_epoll.py | 387 ++ contrib/python/trio/trio/_core/_io_kqueue.py | 294 ++ contrib/python/trio/trio/_core/_io_windows.py | 1042 ++++++ contrib/python/trio/trio/_core/_ki.py | 272 ++ contrib/python/trio/trio/_core/_local.py | 104 + contrib/python/trio/trio/_core/_mock_clock.py | 165 + .../python/trio/trio/_core/_parking_lot.py | 317 ++ contrib/python/trio/trio/_core/_run.py | 3139 +++++++++++++++++ .../python/trio/trio/_core/_run_context.py | 15 + .../python/trio/trio/_core/_thread_cache.py | 315 ++ contrib/python/trio/trio/_core/_traps.py | 310 ++ .../trio/trio/_core/_unbounded_queue.py | 163 + .../trio/trio/_core/_wakeup_socketpair.py | 75 + .../python/trio/trio/_core/_windows_cffi.py | 314 ++ contrib/python/trio/trio/_deprecate.py | 168 + contrib/python/trio/trio/_dtls.py | 1387 ++++++++ contrib/python/trio/trio/_file_io.py | 513 +++ .../python/trio/trio/_highlevel_generic.py | 129 + .../trio/_highlevel_open_tcp_listeners.py | 251 ++ .../trio/trio/_highlevel_open_tcp_stream.py | 397 +++ .../trio/trio/_highlevel_open_unix_stream.py | 65 + .../trio/trio/_highlevel_serve_listeners.py | 148 + contrib/python/trio/trio/_highlevel_socket.py | 423 +++ .../trio/trio/_highlevel_ssl_helpers.py | 180 + contrib/python/trio/trio/_path.py | 280 ++ contrib/python/trio/trio/_repl.py | 156 + contrib/python/trio/trio/_signals.py | 185 + contrib/python/trio/trio/_socket.py | 1325 +++++++ contrib/python/trio/trio/_ssl.py | 964 +++++ contrib/python/trio/trio/_subprocess.py | 1186 +++++++ .../trio/_subprocess_platform/__init__.py | 123 + .../trio/trio/_subprocess_platform/kqueue.py | 48 + .../trio/trio/_subprocess_platform/waitid.py | 113 + .../trio/trio/_subprocess_platform/windows.py | 11 + contrib/python/trio/trio/_sync.py | 908 +++++ contrib/python/trio/trio/_threads.py | 610 ++++ contrib/python/trio/trio/_timeouts.py | 197 ++ contrib/python/trio/trio/_tools/__init__.py | 0 .../python/trio/trio/_tools/gen_exports.py | 403 +++ .../python/trio/trio/_tools/mypy_annotate.py | 126 + .../trio/trio/_tools/sync_requirements.py | 98 + .../trio/trio/_tools/windows_ffi_build.py | 220 ++ contrib/python/trio/trio/_unix_pipes.py | 205 ++ contrib/python/trio/trio/_util.py | 421 +++ contrib/python/trio/trio/_version.py | 3 + contrib/python/trio/trio/_wait_for_object.py | 67 + contrib/python/trio/trio/_windows_pipes.py | 144 + contrib/python/trio/trio/abc.py | 23 + contrib/python/trio/trio/from_thread.py | 13 + contrib/python/trio/trio/lowlevel.py | 95 + contrib/python/trio/trio/py.typed | 0 contrib/python/trio/trio/socket.py | 602 ++++ contrib/python/trio/trio/testing/__init__.py | 39 + .../trio/trio/testing/_check_streams.py | 569 +++ .../python/trio/trio/testing/_checkpoints.py | 69 + contrib/python/trio/trio/testing/_fake_net.py | 590 ++++ .../trio/trio/testing/_memory_streams.py | 637 ++++ contrib/python/trio/trio/testing/_network.py | 36 + .../python/trio/trio/testing/_raises_group.py | 1021 ++++++ .../python/trio/trio/testing/_sequencer.py | 87 + .../python/trio/trio/testing/_trio_test.py | 50 + contrib/python/trio/trio/to_thread.py | 4 + contrib/python/trio/ya.make | 122 + 144 files changed, 28065 insertions(+), 311 deletions(-) create mode 100644 contrib/python/Jinja2/py3/patches/04-fix-PackageLoader-2.patch create mode 100644 contrib/python/outcome/.dist-info/METADATA create mode 100644 contrib/python/outcome/.dist-info/top_level.txt create mode 100644 contrib/python/outcome/LICENSE create mode 100644 contrib/python/outcome/LICENSE.APACHE2 create mode 100644 contrib/python/outcome/LICENSE.MIT create mode 100644 contrib/python/outcome/README.rst create mode 100644 contrib/python/outcome/outcome/__init__.py create mode 100644 contrib/python/outcome/outcome/_impl.py create mode 100644 contrib/python/outcome/outcome/_util.py create mode 100644 contrib/python/outcome/outcome/_version.py create mode 100644 contrib/python/outcome/outcome/py.typed create mode 100644 contrib/python/outcome/ya.make create mode 100644 contrib/python/sniffio/.dist-info/METADATA create mode 100644 contrib/python/sniffio/.dist-info/top_level.txt create mode 100644 contrib/python/sniffio/.yandex_meta/yamaker.yaml create mode 100644 contrib/python/sniffio/LICENSE create mode 100644 contrib/python/sniffio/LICENSE.APACHE2 create mode 100644 contrib/python/sniffio/LICENSE.MIT create mode 100644 contrib/python/sniffio/README.rst create mode 100644 contrib/python/sniffio/sniffio/__init__.py create mode 100644 contrib/python/sniffio/sniffio/_impl.py create mode 100644 contrib/python/sniffio/sniffio/_version.py create mode 100644 contrib/python/sniffio/sniffio/py.typed create mode 100644 contrib/python/sniffio/ya.make create mode 100644 contrib/python/trio/.dist-info/METADATA create mode 100644 contrib/python/trio/.dist-info/entry_points.txt create mode 100644 contrib/python/trio/.dist-info/top_level.txt create mode 100644 contrib/python/trio/.yandex_meta/yamaker.yaml create mode 100644 contrib/python/trio/LICENSE create mode 100644 contrib/python/trio/LICENSE.APACHE2 create mode 100644 contrib/python/trio/LICENSE.MIT create mode 100644 contrib/python/trio/README.rst create mode 100644 contrib/python/trio/trio/__init__.py create mode 100644 contrib/python/trio/trio/__main__.py create mode 100644 contrib/python/trio/trio/_abc.py create mode 100644 contrib/python/trio/trio/_channel.py create mode 100644 contrib/python/trio/trio/_core/__init__.py create mode 100644 contrib/python/trio/trio/_core/_asyncgens.py create mode 100644 contrib/python/trio/trio/_core/_concat_tb.py create mode 100644 contrib/python/trio/trio/_core/_entry_queue.py create mode 100644 contrib/python/trio/trio/_core/_exceptions.py create mode 100644 contrib/python/trio/trio/_core/_generated_instrumentation.py create mode 100644 contrib/python/trio/trio/_core/_generated_io_epoll.py create mode 100644 contrib/python/trio/trio/_core/_generated_io_kqueue.py create mode 100644 contrib/python/trio/trio/_core/_generated_io_windows.py create mode 100644 contrib/python/trio/trio/_core/_generated_run.py create mode 100644 contrib/python/trio/trio/_core/_generated_windows_ffi.py create mode 100644 contrib/python/trio/trio/_core/_instrumentation.py create mode 100644 contrib/python/trio/trio/_core/_io_common.py create mode 100644 contrib/python/trio/trio/_core/_io_epoll.py create mode 100644 contrib/python/trio/trio/_core/_io_kqueue.py create mode 100644 contrib/python/trio/trio/_core/_io_windows.py create mode 100644 contrib/python/trio/trio/_core/_ki.py create mode 100644 contrib/python/trio/trio/_core/_local.py create mode 100644 contrib/python/trio/trio/_core/_mock_clock.py create mode 100644 contrib/python/trio/trio/_core/_parking_lot.py create mode 100644 contrib/python/trio/trio/_core/_run.py create mode 100644 contrib/python/trio/trio/_core/_run_context.py create mode 100644 contrib/python/trio/trio/_core/_thread_cache.py create mode 100644 contrib/python/trio/trio/_core/_traps.py create mode 100644 contrib/python/trio/trio/_core/_unbounded_queue.py create mode 100644 contrib/python/trio/trio/_core/_wakeup_socketpair.py create mode 100644 contrib/python/trio/trio/_core/_windows_cffi.py create mode 100644 contrib/python/trio/trio/_deprecate.py create mode 100644 contrib/python/trio/trio/_dtls.py create mode 100644 contrib/python/trio/trio/_file_io.py create mode 100644 contrib/python/trio/trio/_highlevel_generic.py create mode 100644 contrib/python/trio/trio/_highlevel_open_tcp_listeners.py create mode 100644 contrib/python/trio/trio/_highlevel_open_tcp_stream.py create mode 100644 contrib/python/trio/trio/_highlevel_open_unix_stream.py create mode 100644 contrib/python/trio/trio/_highlevel_serve_listeners.py create mode 100644 contrib/python/trio/trio/_highlevel_socket.py create mode 100644 contrib/python/trio/trio/_highlevel_ssl_helpers.py create mode 100644 contrib/python/trio/trio/_path.py create mode 100644 contrib/python/trio/trio/_repl.py create mode 100644 contrib/python/trio/trio/_signals.py create mode 100644 contrib/python/trio/trio/_socket.py create mode 100644 contrib/python/trio/trio/_ssl.py create mode 100644 contrib/python/trio/trio/_subprocess.py create mode 100644 contrib/python/trio/trio/_subprocess_platform/__init__.py create mode 100644 contrib/python/trio/trio/_subprocess_platform/kqueue.py create mode 100644 contrib/python/trio/trio/_subprocess_platform/waitid.py create mode 100644 contrib/python/trio/trio/_subprocess_platform/windows.py create mode 100644 contrib/python/trio/trio/_sync.py create mode 100644 contrib/python/trio/trio/_threads.py create mode 100644 contrib/python/trio/trio/_timeouts.py create mode 100644 contrib/python/trio/trio/_tools/__init__.py create mode 100644 contrib/python/trio/trio/_tools/gen_exports.py create mode 100644 contrib/python/trio/trio/_tools/mypy_annotate.py create mode 100644 contrib/python/trio/trio/_tools/sync_requirements.py create mode 100644 contrib/python/trio/trio/_tools/windows_ffi_build.py create mode 100644 contrib/python/trio/trio/_unix_pipes.py create mode 100644 contrib/python/trio/trio/_util.py create mode 100644 contrib/python/trio/trio/_version.py create mode 100644 contrib/python/trio/trio/_wait_for_object.py create mode 100644 contrib/python/trio/trio/_windows_pipes.py create mode 100644 contrib/python/trio/trio/abc.py create mode 100644 contrib/python/trio/trio/from_thread.py create mode 100644 contrib/python/trio/trio/lowlevel.py create mode 100644 contrib/python/trio/trio/py.typed create mode 100644 contrib/python/trio/trio/socket.py create mode 100644 contrib/python/trio/trio/testing/__init__.py create mode 100644 contrib/python/trio/trio/testing/_check_streams.py create mode 100644 contrib/python/trio/trio/testing/_checkpoints.py create mode 100644 contrib/python/trio/trio/testing/_fake_net.py create mode 100644 contrib/python/trio/trio/testing/_memory_streams.py create mode 100644 contrib/python/trio/trio/testing/_network.py create mode 100644 contrib/python/trio/trio/testing/_raises_group.py create mode 100644 contrib/python/trio/trio/testing/_sequencer.py create mode 100644 contrib/python/trio/trio/testing/_trio_test.py create mode 100644 contrib/python/trio/trio/to_thread.py create mode 100644 contrib/python/trio/ya.make diff --git a/contrib/python/Jinja2/py3/.dist-info/METADATA b/contrib/python/Jinja2/py3/.dist-info/METADATA index 265cc32e1355..ffef2ff3bfa0 100644 --- a/contrib/python/Jinja2/py3/.dist-info/METADATA +++ b/contrib/python/Jinja2/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: Jinja2 -Version: 3.1.4 +Version: 3.1.6 Summary: A very fast and expressive template engine. Maintainer-email: Pallets Requires-Python: >=3.7 @@ -14,6 +14,7 @@ Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Text Processing :: Markup :: HTML Classifier: Typing :: Typed +License-File: LICENSE.txt Requires-Dist: MarkupSafe>=2.0 Requires-Dist: Babel>=2.7 ; extra == "i18n" Project-URL: Changes, https://jinja.palletsprojects.com/changes/ @@ -52,18 +53,17 @@ restricting functionality too much. ## In A Nutshell -.. code-block:: jinja - - {% extends "base.html" %} - {% block title %}Members{% endblock %} - {% block content %} - - {% endblock %} - +```jinja +{% extends "base.html" %} +{% block title %}Members{% endblock %} +{% block content %} + +{% endblock %} +``` ## Donate @@ -74,3 +74,11 @@ donate today][]. [please donate today]: https://palletsprojects.com/donate +## Contributing + +See our [detailed contributing documentation][contrib] for many ways to +contribute, including reporting issues, requesting features, asking or answering +questions, and making PRs. + +[contrib]: https://palletsprojects.com/contributing/ + diff --git a/contrib/python/Jinja2/py3/README.md b/contrib/python/Jinja2/py3/README.md index 330970b5948d..d1a6870d08a3 100644 --- a/contrib/python/Jinja2/py3/README.md +++ b/contrib/python/Jinja2/py3/README.md @@ -27,18 +27,17 @@ restricting functionality too much. ## In A Nutshell -.. code-block:: jinja - - {% extends "base.html" %} - {% block title %}Members{% endblock %} - {% block content %} - - {% endblock %} - +```jinja +{% extends "base.html" %} +{% block title %}Members{% endblock %} +{% block content %} + +{% endblock %} +``` ## Donate @@ -48,3 +47,11 @@ allow the maintainers to devote more time to the projects, [please donate today][]. [please donate today]: https://palletsprojects.com/donate + +## Contributing + +See our [detailed contributing documentation][contrib] for many ways to +contribute, including reporting issues, requesting features, asking or answering +questions, and making PRs. + +[contrib]: https://palletsprojects.com/contributing/ diff --git a/contrib/python/Jinja2/py3/jinja2/__init__.py b/contrib/python/Jinja2/py3/jinja2/__init__.py index 720343c0c6cb..7972659ffabe 100644 --- a/contrib/python/Jinja2/py3/jinja2/__init__.py +++ b/contrib/python/Jinja2/py3/jinja2/__init__.py @@ -36,4 +36,4 @@ from .utils import pass_eval_context as pass_eval_context from .utils import select_autoescape as select_autoescape -__version__ = "3.1.4" +__version__ = "3.1.6" diff --git a/contrib/python/Jinja2/py3/jinja2/async_utils.py b/contrib/python/Jinja2/py3/jinja2/async_utils.py index e65219e497b0..f0c140205c50 100644 --- a/contrib/python/Jinja2/py3/jinja2/async_utils.py +++ b/contrib/python/Jinja2/py3/jinja2/async_utils.py @@ -6,6 +6,9 @@ from .utils import _PassArg from .utils import pass_eval_context +if t.TYPE_CHECKING: + import typing_extensions as te + V = t.TypeVar("V") @@ -64,18 +67,30 @@ async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": if inspect.isawaitable(value): return await t.cast("t.Awaitable[V]", value) - return t.cast("V", value) + return value + + +class _IteratorToAsyncIterator(t.Generic[V]): + def __init__(self, iterator: "t.Iterator[V]"): + self._iterator = iterator + + def __aiter__(self) -> "te.Self": + return self + + async def __anext__(self) -> V: + try: + return next(self._iterator) + except StopIteration as e: + raise StopAsyncIteration(e.value) from e -async def auto_aiter( +def auto_aiter( iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", ) -> "t.AsyncIterator[V]": if hasattr(iterable, "__aiter__"): - async for item in t.cast("t.AsyncIterable[V]", iterable): - yield item + return iterable.__aiter__() else: - for item in iterable: - yield item + return _IteratorToAsyncIterator(iter(iterable)) async def auto_to_list( diff --git a/contrib/python/Jinja2/py3/jinja2/compiler.py b/contrib/python/Jinja2/py3/jinja2/compiler.py index 274071750f09..a4ff6a1b11af 100644 --- a/contrib/python/Jinja2/py3/jinja2/compiler.py +++ b/contrib/python/Jinja2/py3/jinja2/compiler.py @@ -55,7 +55,7 @@ def new_func( return f(self, node, frame, **kwargs) - return update_wrapper(t.cast(F, new_func), f) + return update_wrapper(new_func, f) # type: ignore[return-value] def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: @@ -216,7 +216,7 @@ def __init__( # or compile time. self.soft_frame = False - def copy(self) -> "Frame": + def copy(self) -> "te.Self": """Create a copy of the current one.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) @@ -229,7 +229,7 @@ def inner(self, isolated: bool = False) -> "Frame": return Frame(self.eval_ctx, level=self.symbols.level + 1) return Frame(self.eval_ctx, self) - def soft(self) -> "Frame": + def soft(self) -> "te.Self": """Return a soft frame. A soft frame may not be modified as standalone thing as it shares the resources with the frame it was created of, but it's not a rootlevel frame any longer. @@ -811,7 +811,7 @@ def pop_assign_tracking(self, frame: Frame) -> None: self.writeline("_block_vars.update({") else: self.writeline("context.vars.update({") - for idx, name in enumerate(vars): + for idx, name in enumerate(sorted(vars)): if idx: self.write(", ") ref = frame.symbols.ref(name) @@ -821,7 +821,7 @@ def pop_assign_tracking(self, frame: Frame) -> None: if len(public_names) == 1: self.writeline(f"context.exported_vars.add({public_names[0]!r})") else: - names_str = ", ".join(map(repr, public_names)) + names_str = ", ".join(map(repr, sorted(public_names))) self.writeline(f"context.exported_vars.update(({names_str}))") # -- Statement Visitors @@ -902,12 +902,15 @@ def visit_Template( if not self.environment.is_async: self.writeline("yield from parent_template.root_render_func(context)") else: - self.writeline( - "async for event in parent_template.root_render_func(context):" - ) + self.writeline("agen = parent_template.root_render_func(context)") + self.writeline("try:") + self.indent() + self.writeline("async for event in agen:") self.indent() self.writeline("yield event") self.outdent() + self.outdent() + self.writeline("finally: await agen.aclose()") self.outdent(1 + (not self.has_known_extends)) # at this point we now have the blocks collected and can visit them too. @@ -977,14 +980,20 @@ def visit_Block(self, node: nodes.Block, frame: Frame) -> None: f"yield from context.blocks[{node.name!r}][0]({context})", node ) else: + self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})") + self.writeline("try:") + self.indent() self.writeline( - f"{self.choose_async()}for event in" - f" context.blocks[{node.name!r}][0]({context}):", + f"{self.choose_async()}for event in gen:", node, ) self.indent() self.simple_write("event", frame) self.outdent() + self.outdent() + self.writeline( + f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" + ) self.outdent(level) @@ -1057,26 +1066,33 @@ def visit_Include(self, node: nodes.Include, frame: Frame) -> None: self.writeline("else:") self.indent() - skip_event_yield = False + def loop_body() -> None: + self.indent() + self.simple_write("event", frame) + self.outdent() + if node.with_context: self.writeline( - f"{self.choose_async()}for event in template.root_render_func(" + f"gen = template.root_render_func(" "template.new_context(context.get_all(), True," - f" {self.dump_local_context(frame)})):" + f" {self.dump_local_context(frame)}))" + ) + self.writeline("try:") + self.indent() + self.writeline(f"{self.choose_async()}for event in gen:") + loop_body() + self.outdent() + self.writeline( + f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" ) elif self.environment.is_async: self.writeline( "for event in (await template._get_default_module_async())" "._body_stream:" ) + loop_body() else: self.writeline("yield from template._get_default_module()._body_stream") - skip_event_yield = True - - if not skip_event_yield: - self.indent() - self.simple_write("event", frame) - self.outdent() if node.ignore_missing: self.outdent() @@ -1125,9 +1141,14 @@ def visit_FromImport(self, node: nodes.FromImport, frame: Frame) -> None: ) self.writeline(f"if {frame.symbols.ref(alias)} is missing:") self.indent() + # The position will contain the template name, and will be formatted + # into a string that will be compiled into an f-string. Curly braces + # in the name must be replaced with escapes so that they will not be + # executed as part of the f-string. + position = self.position(node).replace("{", "{{").replace("}", "}}") message = ( "the template {included_template.__name__!r}" - f" (imported on {self.position(node)})" + f" (imported on {position})" f" does not export the requested name {name!r}" ) self.writeline( @@ -1560,6 +1581,29 @@ def visit_Output(self, node: nodes.Output, frame: Frame) -> None: def visit_Assign(self, node: nodes.Assign, frame: Frame) -> None: self.push_assign_tracking() + + # ``a.b`` is allowed for assignment, and is parsed as an NSRef. However, + # it is only valid if it references a Namespace object. Emit a check for + # that for each ref here, before assignment code is emitted. This can't + # be done in visit_NSRef as the ref could be in the middle of a tuple. + seen_refs: t.Set[str] = set() + + for nsref in node.find_all(nodes.NSRef): + if nsref.name in seen_refs: + # Only emit the check for each reference once, in case the same + # ref is used multiple times in a tuple, `ns.a, ns.b = c, d`. + continue + + seen_refs.add(nsref.name) + ref = frame.symbols.ref(nsref.name) + self.writeline(f"if not isinstance({ref}, Namespace):") + self.indent() + self.writeline( + "raise TemplateRuntimeError" + '("cannot assign attribute on non-namespace object")' + ) + self.outdent() + self.newline(node) self.visit(node.target, frame) self.write(" = ") @@ -1616,17 +1660,11 @@ def visit_Name(self, node: nodes.Name, frame: Frame) -> None: self.write(ref) def visit_NSRef(self, node: nodes.NSRef, frame: Frame) -> None: - # NSRefs can only be used to store values; since they use the normal - # `foo.bar` notation they will be parsed as a normal attribute access - # when used anywhere but in a `set` context + # NSRef is a dotted assignment target a.b=c, but uses a[b]=c internally. + # visit_Assign emits code to validate that each ref is to a Namespace + # object only. That can't be emitted here as the ref could be in the + # middle of a tuple assignment. ref = frame.symbols.ref(node.name) - self.writeline(f"if not isinstance({ref}, Namespace):") - self.indent() - self.writeline( - "raise TemplateRuntimeError" - '("cannot assign attribute on non-namespace object")' - ) - self.outdent() self.writeline(f"{ref}[{node.attr!r}]") def visit_Const(self, node: nodes.Const, frame: Frame) -> None: diff --git a/contrib/python/Jinja2/py3/jinja2/debug.py b/contrib/python/Jinja2/py3/jinja2/debug.py index 7ed7e9297e01..eeeeee78b620 100644 --- a/contrib/python/Jinja2/py3/jinja2/debug.py +++ b/contrib/python/Jinja2/py3/jinja2/debug.py @@ -152,7 +152,7 @@ def get_template_locals(real_locals: t.Mapping[str, t.Any]) -> t.Dict[str, t.Any available at that point in the template. """ # Start with the current template context. - ctx: "t.Optional[Context]" = real_locals.get("context") + ctx: t.Optional[Context] = real_locals.get("context") if ctx is not None: data: t.Dict[str, t.Any] = ctx.get_all().copy() diff --git a/contrib/python/Jinja2/py3/jinja2/environment.py b/contrib/python/Jinja2/py3/jinja2/environment.py index 1d3be0bed08d..0fc6e5be87ab 100644 --- a/contrib/python/Jinja2/py3/jinja2/environment.py +++ b/contrib/python/Jinja2/py3/jinja2/environment.py @@ -123,7 +123,7 @@ def load_extensions( return result -def _environment_config_check(environment: "Environment") -> "Environment": +def _environment_config_check(environment: _env_bound) -> _env_bound: """Perform a sanity check on the environment.""" assert issubclass( environment.undefined, Undefined @@ -406,8 +406,8 @@ def overlay( cache_size: int = missing, auto_reload: bool = missing, bytecode_cache: t.Optional["BytecodeCache"] = missing, - enable_async: bool = False, - ) -> "Environment": + enable_async: bool = missing, + ) -> "te.Self": """Create a new overlay environment that shares all the data with the current environment except for cache and the overridden attributes. Extensions cannot be removed for an overlayed environment. An overlayed @@ -419,8 +419,11 @@ def overlay( copied over so modifications on the original environment may not shine through. + .. versionchanged:: 3.1.5 + ``enable_async`` is applied correctly. + .. versionchanged:: 3.1.2 - Added the ``newline_sequence``,, ``keep_trailing_newline``, + Added the ``newline_sequence``, ``keep_trailing_newline``, and ``enable_async`` parameters to match ``__init__``. """ args = dict(locals()) @@ -706,7 +709,7 @@ def _compile(self, source: str, filename: str) -> CodeType: return compile(source, filename, "exec") @typing.overload - def compile( # type: ignore + def compile( self, source: t.Union[str, nodes.Template], name: t.Optional[str] = None, @@ -1248,7 +1251,7 @@ def _from_namespace( namespace: t.MutableMapping[str, t.Any], globals: t.MutableMapping[str, t.Any], ) -> "Template": - t: "Template" = object.__new__(cls) + t: Template = object.__new__(cls) t.environment = environment t.globals = globals t.name = namespace["name"] @@ -1282,19 +1285,7 @@ def render(self, *args: t.Any, **kwargs: t.Any) -> str: if self.environment.is_async: import asyncio - close = False - - try: - loop = asyncio.get_running_loop() - except RuntimeError: - loop = asyncio.new_event_loop() - close = True - - try: - return loop.run_until_complete(self.render_async(*args, **kwargs)) - finally: - if close: - loop.close() + return asyncio.run(self.render_async(*args, **kwargs)) ctx = self.new_context(dict(*args, **kwargs)) @@ -1358,7 +1349,7 @@ async def to_list() -> t.List[str]: async def generate_async( self, *args: t.Any, **kwargs: t.Any - ) -> t.AsyncIterator[str]: + ) -> t.AsyncGenerator[str, object]: """An async version of :meth:`generate`. Works very similarly but returns an async iterator instead. """ @@ -1370,8 +1361,14 @@ async def generate_async( ctx = self.new_context(dict(*args, **kwargs)) try: - async for event in self.root_render_func(ctx): # type: ignore - yield event + agen = self.root_render_func(ctx) + try: + async for event in agen: # type: ignore + yield event + finally: + # we can't use async with aclosing(...) because that's only + # in 3.10+ + await agen.aclose() # type: ignore except Exception: yield self.environment.handle_exception() diff --git a/contrib/python/Jinja2/py3/jinja2/ext.py b/contrib/python/Jinja2/py3/jinja2/ext.py index 8d0810cd4802..c7af8d45f06a 100644 --- a/contrib/python/Jinja2/py3/jinja2/ext.py +++ b/contrib/python/Jinja2/py3/jinja2/ext.py @@ -89,7 +89,7 @@ def __init_subclass__(cls) -> None: def __init__(self, environment: Environment) -> None: self.environment = environment - def bind(self, environment: Environment) -> "Extension": + def bind(self, environment: Environment) -> "te.Self": """Create a copy of this extension bound to another environment.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) diff --git a/contrib/python/Jinja2/py3/jinja2/filters.py b/contrib/python/Jinja2/py3/jinja2/filters.py index acd11976e4fc..2bcba4fbd3c6 100644 --- a/contrib/python/Jinja2/py3/jinja2/filters.py +++ b/contrib/python/Jinja2/py3/jinja2/filters.py @@ -6,6 +6,7 @@ import typing import typing as t from collections import abc +from inspect import getattr_static from itertools import chain from itertools import groupby @@ -438,7 +439,7 @@ def do_sort( @pass_environment -def do_unique( +def sync_do_unique( environment: "Environment", value: "t.Iterable[V]", case_sensitive: bool = False, @@ -470,6 +471,18 @@ def do_unique( yield item +@async_variant(sync_do_unique) # type: ignore +async def do_unique( + environment: "Environment", + value: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", + case_sensitive: bool = False, + attribute: t.Optional[t.Union[str, int]] = None, +) -> "t.Iterator[V]": + return sync_do_unique( + environment, await auto_to_list(value), case_sensitive, attribute + ) + + def _min_or_max( environment: "Environment", value: "t.Iterable[V]", @@ -987,7 +1000,7 @@ def do_int(value: t.Any, default: int = 0, base: int = 10) -> int: # this quirk is necessary so that "42.23"|int gives 42. try: return int(float(value)) - except (TypeError, ValueError): + except (TypeError, ValueError, OverflowError): return default @@ -1116,7 +1129,7 @@ def do_batch( {%- endfor %} """ - tmp: "t.List[V]" = [] + tmp: t.List[V] = [] for item in value: if len(tmp) == linecount: @@ -1399,31 +1412,25 @@ def do_reverse(value: t.Union[str, t.Iterable[V]]) -> t.Union[str, t.Iterable[V] def do_attr( environment: "Environment", obj: t.Any, name: str ) -> t.Union[Undefined, t.Any]: - """Get an attribute of an object. ``foo|attr("bar")`` works like - ``foo.bar`` just that always an attribute is returned and items are not - looked up. + """Get an attribute of an object. ``foo|attr("bar")`` works like + ``foo.bar``, but returns undefined instead of falling back to ``foo["bar"]`` + if the attribute doesn't exist. See :ref:`Notes on subscriptions ` for more details. """ + # Environment.getattr will fall back to obj[name] if obj.name doesn't exist. + # But we want to call env.getattr to get behavior such as sandboxing. + # Determine if the attr exists first, so we know the fallback won't trigger. try: - name = str(name) - except UnicodeError: - pass - else: - try: - value = getattr(obj, name) - except AttributeError: - pass - else: - if environment.sandboxed: - environment = t.cast("SandboxedEnvironment", environment) - - if not environment.is_safe_attribute(obj, name, value): - return environment.unsafe_undefined(obj, name) - - return value + # This avoids executing properties/descriptors, but misses __getattr__ + # and __getattribute__ dynamic attrs. + getattr_static(obj, name) + except AttributeError: + # This finds dynamic attrs, and we know it's not a descriptor at this point. + if not hasattr(obj, name): + return environment.undefined(obj=obj, name=name) - return environment.undefined(obj=obj, name=name) + return environment.getattr(obj, name) @typing.overload @@ -1629,8 +1636,8 @@ def sync_do_selectattr( .. code-block:: python - (u for user in users if user.is_active) - (u for user in users if test_none(user.email)) + (user for user in users if user.is_active) + (user for user in users if test_none(user.email)) .. versionadded:: 2.7 """ @@ -1667,8 +1674,8 @@ def sync_do_rejectattr( .. code-block:: python - (u for user in users if not user.is_active) - (u for user in users if not test_none(user.email)) + (user for user in users if not user.is_active) + (user for user in users if not test_none(user.email)) .. versionadded:: 2.7 """ @@ -1768,7 +1775,7 @@ def transfunc(x: V) -> V: args = args[1 + off :] def func(item: t.Any) -> t.Any: - return context.environment.call_test(name, item, args, kwargs) + return context.environment.call_test(name, item, args, kwargs, context) except LookupError: func = bool # type: ignore diff --git a/contrib/python/Jinja2/py3/jinja2/idtracking.py b/contrib/python/Jinja2/py3/jinja2/idtracking.py index 995ebaa0c817..e6dd8cd1110e 100644 --- a/contrib/python/Jinja2/py3/jinja2/idtracking.py +++ b/contrib/python/Jinja2/py3/jinja2/idtracking.py @@ -3,6 +3,9 @@ from . import nodes from .visitor import NodeVisitor +if t.TYPE_CHECKING: + import typing_extensions as te + VAR_LOAD_PARAMETER = "param" VAR_LOAD_RESOLVE = "resolve" VAR_LOAD_ALIAS = "alias" @@ -83,7 +86,7 @@ def ref(self, name: str) -> str: ) return rv - def copy(self) -> "Symbols": + def copy(self) -> "te.Self": rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) rv.refs = self.refs.copy() @@ -118,23 +121,20 @@ def load(self, name: str) -> None: self._define_ref(name, load=(VAR_LOAD_RESOLVE, name)) def branch_update(self, branch_symbols: t.Sequence["Symbols"]) -> None: - stores: t.Dict[str, int] = {} + stores: t.Set[str] = set() + for branch in branch_symbols: - for target in branch.stores: - if target in self.stores: - continue - stores[target] = stores.get(target, 0) + 1 + stores.update(branch.stores) + + stores.difference_update(self.stores) for sym in branch_symbols: self.refs.update(sym.refs) self.loads.update(sym.loads) self.stores.update(sym.stores) - for name, branch_count in stores.items(): - if branch_count == len(branch_symbols): - continue - - target = self.find_ref(name) # type: ignore + for name in stores: + target = self.find_ref(name) assert target is not None, "should not happen" if self.parent is not None: @@ -146,7 +146,7 @@ def branch_update(self, branch_symbols: t.Sequence["Symbols"]) -> None: def dump_stores(self) -> t.Dict[str, str]: rv: t.Dict[str, str] = {} - node: t.Optional["Symbols"] = self + node: t.Optional[Symbols] = self while node is not None: for name in sorted(node.stores): @@ -159,7 +159,7 @@ def dump_stores(self) -> t.Dict[str, str]: def dump_param_targets(self) -> t.Set[str]: rv = set() - node: t.Optional["Symbols"] = self + node: t.Optional[Symbols] = self while node is not None: for target, (instr, _) in self.loads.items(): diff --git a/contrib/python/Jinja2/py3/jinja2/lexer.py b/contrib/python/Jinja2/py3/jinja2/lexer.py index 62b0471a3a6a..9b1c969791f2 100644 --- a/contrib/python/Jinja2/py3/jinja2/lexer.py +++ b/contrib/python/Jinja2/py3/jinja2/lexer.py @@ -262,7 +262,7 @@ def __init__( self.message = message self.error_class = cls - def __call__(self, lineno: int, filename: str) -> "te.NoReturn": + def __call__(self, lineno: int, filename: t.Optional[str]) -> "te.NoReturn": raise self.error_class(self.message, lineno, filename) @@ -329,7 +329,7 @@ def __init__( filename: t.Optional[str], ): self._iter = iter(generator) - self._pushed: "te.Deque[Token]" = deque() + self._pushed: te.Deque[Token] = deque() self.name = name self.filename = filename self.closed = False @@ -757,7 +757,7 @@ def tokeniter( for idx, token in enumerate(tokens): # failure group - if token.__class__ is Failure: + if isinstance(token, Failure): raise token(lineno, filename) # bygroup is a bit more complex, in that case we # yield for the current token the first named @@ -778,7 +778,7 @@ def tokeniter( data = groups[idx] if data or token not in ignore_if_empty: - yield lineno, token, data + yield lineno, token, data # type: ignore[misc] lineno += data.count("\n") + newlines_stripped newlines_stripped = 0 diff --git a/contrib/python/Jinja2/py3/jinja2/loaders.py b/contrib/python/Jinja2/py3/jinja2/loaders.py index 24951c35d2bb..809b1dd7df5e 100644 --- a/contrib/python/Jinja2/py3/jinja2/loaders.py +++ b/contrib/python/Jinja2/py3/jinja2/loaders.py @@ -7,6 +7,7 @@ import posixpath import sys import pkgutil +import importlib.resources import typing as t import weakref import zipimport @@ -207,7 +208,12 @@ def get_source( if os.path.isfile(filename): break else: - raise TemplateNotFound(template) + plural = "path" if len(self.searchpath) == 1 else "paths" + paths_str = ", ".join(repr(p) for p in self.searchpath) + raise TemplateNotFound( + template, + f"{template!r} not found in search {plural}: {paths_str}", + ) with open(filename, encoding=self.encoding) as f: contents = f.read() @@ -241,6 +247,30 @@ def list_templates(self) -> t.List[str]: return sorted(found) +if sys.version_info >= (3, 13): + + def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]: + try: + get_files = z._get_files + except AttributeError as e: + raise TypeError( + "This zip import does not have the required" + " metadata to list templates." + ) from e + return get_files() +else: + + def _get_zipimporter_files(z: t.Any) -> t.Dict[str, object]: + try: + files = z._files + except AttributeError as e: + raise TypeError( + "This zip import does not have the required" + " metadata to list templates." + ) from e + return files # type: ignore[no-any-return] + + class PackageLoader(BaseLoader): """Load templates from a directory in a Python package. @@ -280,6 +310,7 @@ def __init__( package_path: "str" = "templates", encoding: str = "utf-8", skip_unknown_package: bool = False, + check_templates: bool = False, ) -> None: package_path = os.path.normpath(package_path).rstrip(os.path.sep) @@ -310,7 +341,7 @@ def __init__( self._loader = loader self._archive = None self._package = package - template_root = None + self._check_templates = check_templates if isinstance(loader, zipimport.zipimporter): self._archive = loader.archive @@ -318,6 +349,15 @@ def __init__( template_root = os.path.join(pkgdir, package_path).rstrip(os.path.sep) elif hasattr(loader, "arcadia_source_finder"): template_root = os.path.dirname(package.__file__).rstrip(os.path.sep) + try: + if package_path: + importlib.resources.files(package_name).joinpath(package_path) + except FileNotFoundError: + if self._check_templates: + raise ValueError( + f"PackageLoader could not find a {package_path!r} directory" + f" in the {package_name!r} package." + ) else: roots: t.List[str] = [] @@ -329,18 +369,23 @@ def __init__( elif spec.origin is not None: roots.append(os.path.dirname(spec.origin)) + if not roots: + raise ValueError( + f"The {package_name!r} package was not installed in a" + " way that PackageLoader understands." + ) + for root in roots: root = os.path.join(root, package_path) if os.path.isdir(root): template_root = root break - - if template_root is None: - raise ValueError( - f"The {package_name!r} package was not installed in a" - " way that PackageLoader understands." - ) + else: + raise ValueError( + f"PackageLoader could not find a {package_path!r} directory" + f" in the {package_name!r} package." + ) self._template_root = template_root @@ -416,11 +461,7 @@ def list_templates(self) -> t.List[str]: for name in filenames ) else: - if not hasattr(self._loader, "_files"): - raise TypeError( - "This zip import does not have the required" - " metadata to list templates." - ) + files = _get_zipimporter_files(self._loader) # Package is a zip file. prefix = ( @@ -429,7 +470,7 @@ def list_templates(self) -> t.List[str]: ) offset = len(prefix) - for name in self._loader._files.keys(): + for name in files: # Find names under the templates directory that aren't directories. if name.startswith(prefix) and name[-1] != os.path.sep: results.append(name[offset:].replace(os.path.sep, "/")) @@ -444,7 +485,7 @@ class DictLoader(BaseLoader): >>> loader = DictLoader({'index.html': 'source here'}) - Because auto reloading is rarely useful this is disabled per default. + Because auto reloading is rarely useful this is disabled by default. """ def __init__(self, mapping: t.Mapping[str, str]) -> None: @@ -627,10 +668,7 @@ class ModuleLoader(BaseLoader): Example usage: - >>> loader = ChoiceLoader([ - ... ModuleLoader('/path/to/compiled/templates'), - ... FileSystemLoader('/path/to/templates') - ... ]) + >>> loader = ModuleLoader('/path/to/compiled/templates') Templates can be precompiled with :meth:`Environment.compile_templates`. """ diff --git a/contrib/python/Jinja2/py3/jinja2/parser.py b/contrib/python/Jinja2/py3/jinja2/parser.py index 0ec997fb4993..f4117754aaf9 100644 --- a/contrib/python/Jinja2/py3/jinja2/parser.py +++ b/contrib/python/Jinja2/py3/jinja2/parser.py @@ -64,7 +64,7 @@ def __init__( self.filename = filename self.closed = False self.extensions: t.Dict[ - str, t.Callable[["Parser"], t.Union[nodes.Node, t.List[nodes.Node]]] + str, t.Callable[[Parser], t.Union[nodes.Node, t.List[nodes.Node]]] ] = {} for extension in environment.iter_extensions(): for tag in extension.tags: @@ -487,21 +487,18 @@ def parse_assign_target( """ target: nodes.Expr - if with_namespace and self.stream.look().type == "dot": - token = self.stream.expect("name") - next(self.stream) # dot - attr = self.stream.expect("name") - target = nodes.NSRef(token.value, attr.value, lineno=token.lineno) - elif name_only: + if name_only: token = self.stream.expect("name") target = nodes.Name(token.value, "store", lineno=token.lineno) else: if with_tuple: target = self.parse_tuple( - simplified=True, extra_end_rules=extra_end_rules + simplified=True, + extra_end_rules=extra_end_rules, + with_namespace=with_namespace, ) else: - target = self.parse_primary() + target = self.parse_primary(with_namespace=with_namespace) target.set_ctx("store") @@ -643,17 +640,25 @@ def parse_unary(self, with_filter: bool = True) -> nodes.Expr: node = self.parse_filter_expr(node) return node - def parse_primary(self) -> nodes.Expr: + def parse_primary(self, with_namespace: bool = False) -> nodes.Expr: + """Parse a name or literal value. If ``with_namespace`` is enabled, also + parse namespace attr refs, for use in assignments.""" token = self.stream.current node: nodes.Expr if token.type == "name": + next(self.stream) if token.value in ("true", "false", "True", "False"): node = nodes.Const(token.value in ("true", "True"), lineno=token.lineno) elif token.value in ("none", "None"): node = nodes.Const(None, lineno=token.lineno) + elif with_namespace and self.stream.current.type == "dot": + # If namespace attributes are allowed at this point, and the next + # token is a dot, produce a namespace reference. + next(self.stream) + attr = self.stream.expect("name") + node = nodes.NSRef(token.value, attr.value, lineno=token.lineno) else: node = nodes.Name(token.value, "load", lineno=token.lineno) - next(self.stream) elif token.type == "string": next(self.stream) buf = [token.value] @@ -683,6 +688,7 @@ def parse_tuple( with_condexpr: bool = True, extra_end_rules: t.Optional[t.Tuple[str, ...]] = None, explicit_parentheses: bool = False, + with_namespace: bool = False, ) -> t.Union[nodes.Tuple, nodes.Expr]: """Works like `parse_expression` but if multiple expressions are delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created. @@ -690,8 +696,9 @@ def parse_tuple( if no commas where found. The default parsing mode is a full tuple. If `simplified` is `True` - only names and literals are parsed. The `no_condexpr` parameter is - forwarded to :meth:`parse_expression`. + only names and literals are parsed; ``with_namespace`` allows namespace + attr refs as well. The `no_condexpr` parameter is forwarded to + :meth:`parse_expression`. Because tuples do not require delimiters and may end in a bogus comma an extra hint is needed that marks the end of a tuple. For example @@ -704,13 +711,14 @@ def parse_tuple( """ lineno = self.stream.current.lineno if simplified: - parse = self.parse_primary - elif with_condexpr: - parse = self.parse_expression + + def parse() -> nodes.Expr: + return self.parse_primary(with_namespace=with_namespace) + else: def parse() -> nodes.Expr: - return self.parse_expression(with_condexpr=False) + return self.parse_expression(with_condexpr=with_condexpr) args: t.List[nodes.Expr] = [] is_tuple = False diff --git a/contrib/python/Jinja2/py3/jinja2/runtime.py b/contrib/python/Jinja2/py3/jinja2/runtime.py index 4325c8deb22a..09119e2ae550 100644 --- a/contrib/python/Jinja2/py3/jinja2/runtime.py +++ b/contrib/python/Jinja2/py3/jinja2/runtime.py @@ -172,7 +172,7 @@ def __init__( ): self.parent = parent self.vars: t.Dict[str, t.Any] = {} - self.environment: "Environment" = environment + self.environment: Environment = environment self.eval_ctx = EvalContext(self.environment, name) self.exported_vars: t.Set[str] = set() self.name = name @@ -367,7 +367,7 @@ def super(self) -> t.Union["BlockReference", "Undefined"]: @internalcode async def _async_call(self) -> str: - rv = concat( + rv = self._context.environment.concat( # type: ignore [x async for x in self._stack[self._depth](self._context)] # type: ignore ) @@ -381,7 +381,9 @@ def __call__(self) -> str: if self._context.environment.is_async: return self._async_call() # type: ignore - rv = concat(self._stack[self._depth](self._context)) + rv = self._context.environment.concat( # type: ignore + self._stack[self._depth](self._context) + ) if self._context.eval_ctx.autoescape: return Markup(rv) @@ -792,8 +794,8 @@ def __repr__(self) -> str: class Undefined: - """The default undefined type. This undefined type can be printed and - iterated over, but every other access will raise an :exc:`UndefinedError`: + """The default undefined type. This can be printed, iterated, and treated as + a boolean. Any other operation will raise an :exc:`UndefinedError`. >>> foo = Undefined(name='foo') >>> str(foo) @@ -858,7 +860,11 @@ def _fail_with_undefined_error( @internalcode def __getattr__(self, name: str) -> t.Any: - if name[:2] == "__": + # Raise AttributeError on requests for names that appear to be unimplemented + # dunder methods to keep Python's internal protocol probing behaviors working + # properly in cases where another exception type could cause unexpected or + # difficult-to-diagnose failures. + if name[:2] == "__" and name[-2:] == "__": raise AttributeError(name) return self._fail_with_undefined_error() @@ -982,10 +988,20 @@ class ChainableUndefined(Undefined): def __html__(self) -> str: return str(self) - def __getattr__(self, _: str) -> "ChainableUndefined": + def __getattr__(self, name: str) -> "ChainableUndefined": + # Raise AttributeError on requests for names that appear to be unimplemented + # dunder methods to avoid confusing Python with truthy non-method objects that + # do not implement the protocol being probed for. e.g., copy.copy(Undefined()) + # fails spectacularly if getattr(Undefined(), '__setstate__') returns an + # Undefined object instead of raising AttributeError to signal that it does not + # support that style of object initialization. + if name[:2] == "__" and name[-2:] == "__": + raise AttributeError(name) + return self - __getitem__ = __getattr__ # type: ignore + def __getitem__(self, _name: str) -> "ChainableUndefined": # type: ignore[override] + return self class DebugUndefined(Undefined): @@ -1044,13 +1060,3 @@ class StrictUndefined(Undefined): __iter__ = __str__ = __len__ = Undefined._fail_with_undefined_error __eq__ = __ne__ = __bool__ = __hash__ = Undefined._fail_with_undefined_error __contains__ = Undefined._fail_with_undefined_error - - -# Remove slots attributes, after the metaclass is applied they are -# unneeded and contain wrong data for subclasses. -del ( - Undefined.__slots__, - ChainableUndefined.__slots__, - DebugUndefined.__slots__, - StrictUndefined.__slots__, -) diff --git a/contrib/python/Jinja2/py3/jinja2/sandbox.py b/contrib/python/Jinja2/py3/jinja2/sandbox.py index 0b4fc12d3479..9c9dae22f1c2 100644 --- a/contrib/python/Jinja2/py3/jinja2/sandbox.py +++ b/contrib/python/Jinja2/py3/jinja2/sandbox.py @@ -5,11 +5,12 @@ import operator import types import typing as t +from _string import formatter_field_name_split # type: ignore from collections import abc from collections import deque +from functools import update_wrapper from string import Formatter -from _string import formatter_field_name_split # type: ignore from markupsafe import EscapeFormatter from markupsafe import Markup @@ -60,7 +61,9 @@ ), ( abc.MutableSequence, - frozenset(["append", "reverse", "insert", "sort", "extend", "remove"]), + frozenset( + ["append", "clear", "pop", "reverse", "insert", "sort", "extend", "remove"] + ), ), ( deque, @@ -81,20 +84,6 @@ ) -def inspect_format_method(callable: t.Callable[..., t.Any]) -> t.Optional[str]: - if not isinstance( - callable, (types.MethodType, types.BuiltinMethodType) - ) or callable.__name__ not in ("format", "format_map"): - return None - - obj = callable.__self__ - - if isinstance(obj, str): - return obj - - return None - - def safe_range(*args: int) -> range: """A range that can't generate ranges with a length of more than MAX_RANGE items. @@ -314,6 +303,9 @@ def getitem( except AttributeError: pass else: + fmt = self.wrap_str_format(value) + if fmt is not None: + return fmt if self.is_safe_attribute(obj, argument, value): return value return self.unsafe_undefined(obj, argument) @@ -331,6 +323,9 @@ def getattr(self, obj: t.Any, attribute: str) -> t.Union[t.Any, Undefined]: except (TypeError, LookupError): pass else: + fmt = self.wrap_str_format(value) + if fmt is not None: + return fmt if self.is_safe_attribute(obj, attribute, value): return value return self.unsafe_undefined(obj, attribute) @@ -346,34 +341,49 @@ def unsafe_undefined(self, obj: t.Any, attribute: str) -> Undefined: exc=SecurityError, ) - def format_string( - self, - s: str, - args: t.Tuple[t.Any, ...], - kwargs: t.Dict[str, t.Any], - format_func: t.Optional[t.Callable[..., t.Any]] = None, - ) -> str: - """If a format call is detected, then this is routed through this - method so that our safety sandbox can be used for it. + def wrap_str_format(self, value: t.Any) -> t.Optional[t.Callable[..., str]]: + """If the given value is a ``str.format`` or ``str.format_map`` method, + return a new function than handles sandboxing. This is done at access + rather than in :meth:`call`, so that calls made without ``call`` are + also sandboxed. """ + if not isinstance( + value, (types.MethodType, types.BuiltinMethodType) + ) or value.__name__ not in ("format", "format_map"): + return None + + f_self: t.Any = value.__self__ + + if not isinstance(f_self, str): + return None + + str_type: t.Type[str] = type(f_self) + is_format_map = value.__name__ == "format_map" formatter: SandboxedFormatter - if isinstance(s, Markup): - formatter = SandboxedEscapeFormatter(self, escape=s.escape) + + if isinstance(f_self, Markup): + formatter = SandboxedEscapeFormatter(self, escape=f_self.escape) else: formatter = SandboxedFormatter(self) - if format_func is not None and format_func.__name__ == "format_map": - if len(args) != 1 or kwargs: - raise TypeError( - "format_map() takes exactly one argument" - f" {len(args) + (kwargs is not None)} given" - ) + vformat = formatter.vformat + + def wrapper(*args: t.Any, **kwargs: t.Any) -> str: + if is_format_map: + if kwargs: + raise TypeError("format_map() takes no keyword arguments") + + if len(args) != 1: + raise TypeError( + f"format_map() takes exactly one argument ({len(args)} given)" + ) + + kwargs = args[0] + args = () - kwargs = args[0] - args = () + return str_type(vformat(f_self, args, kwargs)) - rv = formatter.vformat(s, args, kwargs) - return type(s)(rv) + return update_wrapper(wrapper, value) def call( __self, # noqa: B902 @@ -383,9 +393,6 @@ def call( **kwargs: t.Any, ) -> t.Any: """Call an object from sandboxed code.""" - fmt = inspect_format_method(__obj) - if fmt is not None: - return __self.format_string(fmt, args, kwargs, __obj) # the double prefixes are to avoid double keyword argument # errors when proxying the call. diff --git a/contrib/python/Jinja2/py3/jinja2/utils.py b/contrib/python/Jinja2/py3/jinja2/utils.py index 7fb76935aa3e..7c922629a926 100644 --- a/contrib/python/Jinja2/py3/jinja2/utils.py +++ b/contrib/python/Jinja2/py3/jinja2/utils.py @@ -18,8 +18,17 @@ F = t.TypeVar("F", bound=t.Callable[..., t.Any]) -# special singleton representing missing values for the runtime -missing: t.Any = type("MissingType", (), {"__repr__": lambda x: "missing"})() + +class _MissingType: + def __repr__(self) -> str: + return "missing" + + def __reduce__(self) -> str: + return "missing" + + +missing: t.Any = _MissingType() +"""Special singleton representing missing values for the runtime.""" internal_code: t.MutableSet[CodeType] = set() @@ -324,6 +333,8 @@ def trim_url(x: str) -> str: elif ( "@" in middle and not middle.startswith("www.") + # ignore values like `@a@b` + and not middle.startswith("@") and ":" not in middle and _email_re.match(middle) ): @@ -428,7 +439,7 @@ class LRUCache: def __init__(self, capacity: int) -> None: self.capacity = capacity self._mapping: t.Dict[t.Any, t.Any] = {} - self._queue: "te.Deque[t.Any]" = deque() + self._queue: te.Deque[t.Any] = deque() self._postinit() def _postinit(self) -> None: @@ -453,7 +464,7 @@ def __setstate__(self, d: t.Mapping[str, t.Any]) -> None: def __getnewargs__(self) -> t.Tuple[t.Any, ...]: return (self.capacity,) - def copy(self) -> "LRUCache": + def copy(self) -> "te.Self": """Return a shallow copy of the instance.""" rv = self.__class__(self.capacity) rv._mapping.update(self._mapping) diff --git a/contrib/python/Jinja2/py3/patches/03-fix-PackageLoader.patch b/contrib/python/Jinja2/py3/patches/03-fix-PackageLoader.patch index d4c98d43f53c..7713e4996115 100644 --- a/contrib/python/Jinja2/py3/patches/03-fix-PackageLoader.patch +++ b/contrib/python/Jinja2/py3/patches/03-fix-PackageLoader.patch @@ -1,10 +1,11 @@ --- contrib/python/Jinja2/py3/jinja2/loaders.py (index) +++ contrib/python/Jinja2/py3/jinja2/loaders.py (working tree) -@@ -5,6 +5,7 @@ sources. +@@ -5,6 +5,8 @@ sources. import os import posixpath import sys +import pkgutil ++import importlib.resources import typing as t import weakref import zipimport @@ -17,7 +18,7 @@ def split_template_path(template: str) -> t.List[str]: """Split a path into segments and perform a sanity check. If it detects -@@ -288,19 +291,22 @@ class PackageLoader(BaseLoader): +@@ -288,18 +291,31 @@ class PackageLoader(BaseLoader): # Make sure the package exists. This also makes namespace # packages work, otherwise get_loader returns None. @@ -30,7 +31,7 @@ self._loader = loader self._archive = None + self._package = package - template_root = None ++ self._check_templates = False if isinstance(loader, zipimport.zipimporter): self._archive = loader.archive @@ -38,6 +39,15 @@ template_root = os.path.join(pkgdir, package_path).rstrip(os.path.sep) + elif hasattr(loader, "arcadia_source_finder"): + template_root = os.path.dirname(package.__file__).rstrip(os.path.sep) ++ try: ++ if package_path: ++ importlib.resources.files(package_name).joinpath(package_path) ++ except FileNotFoundError: ++ if self._check_templates: ++ raise ValueError( ++ f"PackageLoader could not find a {package_path!r} directory" ++ f" in the {package_name!r} package." ++ ) else: roots: t.List[str] = [] diff --git a/contrib/python/Jinja2/py3/patches/04-fix-PackageLoader-2.patch b/contrib/python/Jinja2/py3/patches/04-fix-PackageLoader-2.patch new file mode 100644 index 000000000000..d130ba0fbdad --- /dev/null +++ b/contrib/python/Jinja2/py3/patches/04-fix-PackageLoader-2.patch @@ -0,0 +1,27 @@ +--- contrib/python/Jinja2/py3/jinja2/loaders.py (index) ++++ contrib/python/Jinja2/py3/jinja2/loaders.py (working tree) +@@ -310,6 +310,7 @@ class PackageLoader(BaseLoader): + package_path: "str" = "templates", + encoding: str = "utf-8", + skip_unknown_package: bool = False, ++ check_templates: bool = False, + ) -> None: + package_path = os.path.normpath(package_path).rstrip(os.path.sep) + +@@ -340,7 +341,7 @@ class PackageLoader(BaseLoader): + self._loader = loader + self._archive = None + self._package = package +- self._check_templates = False ++ self._check_templates = check_templates + + if isinstance(loader, zipimport.zipimporter): + self._archive = loader.archive +--- contrib/python/Jinja2/py3/tests/test_loader.py (index) ++++ contrib/python/Jinja2/py3/tests/test_loader.py (working tree) +@@ -436,4 +436,4 @@ def test_pep_451_import_hook(): + + def test_package_loader_no_dir() -> None: + with pytest.raises(ValueError, match="could not find a 'templates' directory"): +- PackageLoader("jinja2") ++ PackageLoader("jinja2", check_templates=True) diff --git a/contrib/python/Jinja2/py3/tests/test_api.py b/contrib/python/Jinja2/py3/tests/test_api.py index ff3fcb138bb8..4472b85ac00e 100644 --- a/contrib/python/Jinja2/py3/tests/test_api.py +++ b/contrib/python/Jinja2/py3/tests/test_api.py @@ -323,8 +323,6 @@ def test_default_undefined(self): assert und1 == und2 assert und1 != 42 assert hash(und1) == hash(und2) == hash(Undefined()) - with pytest.raises(AttributeError): - getattr(Undefined, "__slots__") # noqa: B009 def test_chainable_undefined(self): env = Environment(undefined=ChainableUndefined) @@ -335,8 +333,6 @@ def test_chainable_undefined(self): assert env.from_string("{{ foo.missing }}").render(foo=42) == "" assert env.from_string("{{ not missing }}").render() == "True" pytest.raises(UndefinedError, env.from_string("{{ missing - 1}}").render) - with pytest.raises(AttributeError): - getattr(ChainableUndefined, "__slots__") # noqa: B009 # The following tests ensure subclass functionality works as expected assert env.from_string('{{ missing.bar["baz"] }}').render() == "" @@ -368,8 +364,6 @@ def test_debug_undefined(self): str(DebugUndefined(hint=undefined_hint)) == f"{{{{ undefined value printed: {undefined_hint} }}}}" ) - with pytest.raises(AttributeError): - getattr(DebugUndefined, "__slots__") # noqa: B009 def test_strict_undefined(self): env = Environment(undefined=StrictUndefined) @@ -386,8 +380,6 @@ def test_strict_undefined(self): env.from_string('{{ missing|default("default", true) }}').render() == "default" ) - with pytest.raises(AttributeError): - getattr(StrictUndefined, "__slots__") # noqa: B009 assert env.from_string('{{ "foo" if false }}').render() == "" def test_indexing_gives_undefined(self): @@ -433,3 +425,11 @@ class CustomEnvironment(Environment): env = CustomEnvironment() tmpl = env.from_string("{{ foo }}") assert tmpl.render() == "resolve-foo" + + +def test_overlay_enable_async(env): + assert not env.is_async + assert not env.overlay().is_async + env_async = env.overlay(enable_async=True) + assert env_async.is_async + assert not env_async.overlay(enable_async=False).is_async diff --git a/contrib/python/Jinja2/py3/tests/test_async.py b/contrib/python/Jinja2/py3/tests/test_async.py index c9ba70c3e66f..4edced9dd9fe 100644 --- a/contrib/python/Jinja2/py3/tests/test_async.py +++ b/contrib/python/Jinja2/py3/tests/test_async.py @@ -1,6 +1,7 @@ import asyncio import pytest +import trio from jinja2 import ChainableUndefined from jinja2 import DictLoader @@ -13,7 +14,16 @@ from jinja2.nativetypes import NativeEnvironment -def test_basic_async(): +def _asyncio_run(async_fn, *args): + return asyncio.run(async_fn(*args)) + + +@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) +def run_async_fn(request): + return request.param + + +def test_basic_async(run_async_fn): t = Template( "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True ) @@ -21,11 +31,11 @@ def test_basic_async(): async def func(): return await t.render_async() - rv = asyncio.run(func()) + rv = run_async_fn(func) assert rv == "[1][2][3]" -def test_await_on_calls(): +def test_await_on_calls(run_async_fn): t = Template("{{ async_func() + normal_func() }}", enable_async=True) async def async_func(): @@ -37,7 +47,7 @@ def normal_func(): async def func(): return await t.render_async(async_func=async_func, normal_func=normal_func) - rv = asyncio.run(func()) + rv = run_async_fn(func) assert rv == "65" @@ -54,7 +64,7 @@ def normal_func(): assert rv == "65" -def test_await_and_macros(): +def test_await_and_macros(run_async_fn): t = Template( "{% macro foo(x) %}[{{ x }}][{{ async_func() }}]{% endmacro %}{{ foo(42) }}", enable_async=True, @@ -66,11 +76,11 @@ async def async_func(): async def func(): return await t.render_async(async_func=async_func) - rv = asyncio.run(func()) + rv = run_async_fn(func) assert rv == "[42][42]" -def test_async_blocks(): +def test_async_blocks(run_async_fn): t = Template( "{% block foo %}{% endblock %}{{ self.foo() }}", enable_async=True, @@ -80,7 +90,7 @@ def test_async_blocks(): async def func(): return await t.render_async() - rv = asyncio.run(func()) + rv = run_async_fn(func) assert rv == "" @@ -156,8 +166,8 @@ def test_trailing_comma(self, test_env_async): test_env_async.from_string('{% from "foo" import bar, with, context %}') test_env_async.from_string('{% from "foo" import bar, with with context %}') - def test_exports(self, test_env_async): - coro = test_env_async.from_string( + def test_exports(self, test_env_async, run_async_fn): + coro_fn = test_env_async.from_string( """ {% macro toplevel() %}...{% endmacro %} {% macro __private() %}...{% endmacro %} @@ -166,9 +176,9 @@ def test_exports(self, test_env_async): {% macro notthere() %}{% endmacro %} {% endfor %} """ - )._get_default_module_async() - m = asyncio.run(coro) - assert asyncio.run(m.toplevel()) == "..." + )._get_default_module_async + m = run_async_fn(coro_fn) + assert run_async_fn(m.toplevel) == "..." assert not hasattr(m, "__missing") assert m.variable == 42 assert not hasattr(m, "notthere") @@ -457,17 +467,19 @@ def test_reversed_bug(self, test_env_async): ) assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3" - def test_loop_errors(self, test_env_async): + def test_loop_errors(self, test_env_async, run_async_fn): tmpl = test_env_async.from_string( """{% for item in [1] if loop.index == 0 %}...{% endfor %}""" ) - pytest.raises(UndefinedError, tmpl.render) + with pytest.raises(UndefinedError): + run_async_fn(tmpl.render_async) + tmpl = test_env_async.from_string( """{% for item in [] %}...{% else %}{{ loop }}{% endfor %}""" ) - assert tmpl.render() == "" + assert run_async_fn(tmpl.render_async) == "" def test_loop_filter(self, test_env_async): tmpl = test_env_async.from_string( @@ -597,7 +609,7 @@ def test_awaitable_property_slicing(self, test_env_async): assert t.render(a=dict(b=[1, 2, 3])) == "1" -def test_namespace_awaitable(test_env_async): +def test_namespace_awaitable(test_env_async, run_async_fn): async def _test(): t = test_env_async.from_string( '{% set ns = namespace(foo="Bar") %}{{ ns.foo }}' @@ -605,10 +617,10 @@ async def _test(): actual = await t.render_async() assert actual == "Bar" - asyncio.run(_test()) + run_async_fn(_test) -def test_chainable_undefined_aiter(): +def test_chainable_undefined_aiter(run_async_fn): async def _test(): t = Template( "{% for x in a['b']['c'] %}{{ x }}{% endfor %}", @@ -618,7 +630,7 @@ async def _test(): rv = await t.render_async(a={}) assert rv == "" - asyncio.run(_test()) + run_async_fn(_test) @pytest.fixture @@ -626,22 +638,22 @@ def async_native_env(): return NativeEnvironment(enable_async=True) -def test_native_async(async_native_env): +def test_native_async(async_native_env, run_async_fn): async def _test(): t = async_native_env.from_string("{{ x }}") rv = await t.render_async(x=23) assert rv == 23 - asyncio.run(_test()) + run_async_fn(_test) -def test_native_list_async(async_native_env): +def test_native_list_async(async_native_env, run_async_fn): async def _test(): t = async_native_env.from_string("{{ x }}") rv = await t.render_async(x=list(range(3))) assert rv == [0, 1, 2] - asyncio.run(_test()) + run_async_fn(_test) def test_getitem_after_filter(): @@ -658,3 +670,65 @@ def test_getitem_after_call(): t = env.from_string("{{ add_each(a, 2)[1:] }}") out = t.render(a=range(3)) assert out == "[3, 4]" + + +def test_basic_generate_async(run_async_fn): + t = Template( + "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True + ) + + async def func(): + agen = t.generate_async() + try: + return await agen.__anext__() + finally: + await agen.aclose() + + rv = run_async_fn(func) + assert rv == "[" + + +def test_include_generate_async(run_async_fn, test_env_async): + t = test_env_async.from_string('{% include "header" %}') + + async def func(): + agen = t.generate_async() + try: + return await agen.__anext__() + finally: + await agen.aclose() + + rv = run_async_fn(func) + assert rv == "[" + + +def test_blocks_generate_async(run_async_fn): + t = Template( + "{% block foo %}{% endblock %}{{ self.foo() }}", + enable_async=True, + autoescape=True, + ) + + async def func(): + agen = t.generate_async() + try: + return await agen.__anext__() + finally: + await agen.aclose() + + rv = run_async_fn(func) + assert rv == "" + + +def test_async_extend(run_async_fn, test_env_async): + t = test_env_async.from_string('{% extends "header" %}') + + async def func(): + agen = t.generate_async() + try: + return await agen.__anext__() + finally: + await agen.aclose() + + rv = run_async_fn(func) + assert rv == "[" diff --git a/contrib/python/Jinja2/py3/tests/test_async_filters.py b/contrib/python/Jinja2/py3/tests/test_async_filters.py index f5b2627ad877..e9892f1edcdf 100644 --- a/contrib/python/Jinja2/py3/tests/test_async_filters.py +++ b/contrib/python/Jinja2/py3/tests/test_async_filters.py @@ -1,6 +1,9 @@ +import asyncio +import contextlib from collections import namedtuple import pytest +import trio from markupsafe import Markup from jinja2 import Environment @@ -26,10 +29,39 @@ def env_async(): return Environment(enable_async=True) +def _asyncio_run(async_fn, *args): + return asyncio.run(async_fn(*args)) + + +@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) +def run_async_fn(request): + return request.param + + +@contextlib.asynccontextmanager +async def closing_factory(): + async with contextlib.AsyncExitStack() as stack: + + def closing(maybe_agen): + try: + aclose = maybe_agen.aclose + except AttributeError: + pass + else: + stack.push_async_callback(aclose) + return maybe_agen + + yield closing + + @mark_dualiter("foo", lambda: range(10)) -def test_first(env_async, foo): - tmpl = env_async.from_string("{{ foo()|first }}") - out = tmpl.render(foo=foo) +def test_first(env_async, foo, run_async_fn): + async def test(): + async with closing_factory() as closing: + tmpl = env_async.from_string("{{ closing(foo())|first }}") + return await tmpl.render_async(foo=foo, closing=closing) + + out = run_async_fn(test) assert out == "0" @@ -245,18 +277,30 @@ def test_slice(env_async, items): ) -def test_custom_async_filter(env_async): +def test_unique_with_async_gen(env_async): + items = ["a", "b", "c", "c", "a", "d", "z"] + tmpl = env_async.from_string("{{ items|reject('==', 'z')|unique|list }}") + out = tmpl.render(items=items) + assert out == "['a', 'b', 'c', 'd']" + + +def test_custom_async_filter(env_async, run_async_fn): async def customfilter(val): return str(val) - env_async.filters["customfilter"] = customfilter - tmpl = env_async.from_string("{{ 'static'|customfilter }} {{ arg|customfilter }}") - out = tmpl.render(arg="dynamic") + async def test(): + env_async.filters["customfilter"] = customfilter + tmpl = env_async.from_string( + "{{ 'static'|customfilter }} {{ arg|customfilter }}" + ) + return await tmpl.render_async(arg="dynamic") + + out = run_async_fn(test) assert out == "static dynamic" @mark_dualiter("items", lambda: range(10)) -def test_custom_async_iteratable_filter(env_async, items): +def test_custom_async_iteratable_filter(env_async, items, run_async_fn): async def customfilter(iterable): items = [] async for item in auto_aiter(iterable): @@ -265,9 +309,13 @@ async def customfilter(iterable): break return ",".join(items) - env_async.filters["customfilter"] = customfilter - tmpl = env_async.from_string( - "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" - ) - out = tmpl.render(items=items) + async def test(): + async with closing_factory() as closing: + env_async.filters["customfilter"] = customfilter + tmpl = env_async.from_string( + "{{ closing(items())|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" + ) + return await tmpl.render_async(items=items, closing=closing) + + out = run_async_fn(test) assert out == "0,1,2 .. 3,4,5" diff --git a/contrib/python/Jinja2/py3/tests/test_compile.py b/contrib/python/Jinja2/py3/tests/test_compile.py index 42a773f21cce..e1a5391ea25d 100644 --- a/contrib/python/Jinja2/py3/tests/test_compile.py +++ b/contrib/python/Jinja2/py3/tests/test_compile.py @@ -1,6 +1,9 @@ import os import re +import pytest + +from jinja2 import UndefinedError from jinja2.environment import Environment from jinja2.loaders import DictLoader @@ -26,3 +29,80 @@ def test_import_as_with_context_deterministic(tmp_path): expect = [f"'bar{i}': " for i in range(10)] found = re.findall(r"'bar\d': ", content)[:10] assert found == expect + + +def test_top_level_set_vars_unpacking_deterministic(tmp_path): + src = "\n".join(f"{{% set a{i}, b{i}, c{i} = tuple_var{i} %}}" for i in range(10)) + env = Environment(loader=DictLoader({"foo": src})) + env.compile_templates(tmp_path, zip=None) + name = os.listdir(tmp_path)[0] + content = (tmp_path / name).read_text("utf8") + expect = [ + f"context.vars.update({{'a{i}': l_0_a{i}, 'b{i}': l_0_b{i}, 'c{i}': l_0_c{i}}})" + for i in range(10) + ] + found = re.findall( + r"context\.vars\.update\(\{'a\d': l_0_a\d, 'b\d': l_0_b\d, 'c\d': l_0_c\d\}\)", + content, + )[:10] + assert found == expect + expect = [ + f"context.exported_vars.update(('a{i}', 'b{i}', 'c{i}'))" for i in range(10) + ] + found = re.findall( + r"context\.exported_vars\.update\(\('a\d', 'b\d', 'c\d'\)\)", + content, + )[:10] + assert found == expect + + +def test_loop_set_vars_unpacking_deterministic(tmp_path): + src = "\n".join(f" {{% set a{i}, b{i}, c{i} = tuple_var{i} %}}" for i in range(10)) + src = f"{{% for i in seq %}}\n{src}\n{{% endfor %}}" + env = Environment(loader=DictLoader({"foo": src})) + env.compile_templates(tmp_path, zip=None) + name = os.listdir(tmp_path)[0] + content = (tmp_path / name).read_text("utf8") + expect = [ + f"_loop_vars.update({{'a{i}': l_1_a{i}, 'b{i}': l_1_b{i}, 'c{i}': l_1_c{i}}})" + for i in range(10) + ] + found = re.findall( + r"_loop_vars\.update\(\{'a\d': l_1_a\d, 'b\d': l_1_b\d, 'c\d': l_1_c\d\}\)", + content, + )[:10] + assert found == expect + + +def test_block_set_vars_unpacking_deterministic(tmp_path): + src = "\n".join(f" {{% set a{i}, b{i}, c{i} = tuple_var{i} %}}" for i in range(10)) + src = f"{{% block test %}}\n{src}\n{{% endblock test %}}" + env = Environment(loader=DictLoader({"foo": src})) + env.compile_templates(tmp_path, zip=None) + name = os.listdir(tmp_path)[0] + content = (tmp_path / name).read_text("utf8") + expect = [ + f"_block_vars.update({{'a{i}': l_0_a{i}, 'b{i}': l_0_b{i}, 'c{i}': l_0_c{i}}})" + for i in range(10) + ] + found = re.findall( + r"_block_vars\.update\(\{'a\d': l_0_a\d, 'b\d': l_0_b\d, 'c\d': l_0_c\d\}\)", + content, + )[:10] + assert found == expect + + +def test_undefined_import_curly_name(): + env = Environment( + loader=DictLoader( + { + "{bad}": "{% from 'macro' import m %}{{ m() }}", + "macro": "", + } + ) + ) + + # Must not raise `NameError: 'bad' is not defined`, as that would indicate + # that `{bad}` is being interpreted as an f-string. It must be escaped. + with pytest.raises(UndefinedError): + env.get_template("{bad}").render() diff --git a/contrib/python/Jinja2/py3/tests/test_core_tags.py b/contrib/python/Jinja2/py3/tests/test_core_tags.py index 4bb95e0240a0..2d847a2c9afa 100644 --- a/contrib/python/Jinja2/py3/tests/test_core_tags.py +++ b/contrib/python/Jinja2/py3/tests/test_core_tags.py @@ -538,6 +538,14 @@ def test_namespace_macro(self, env_trim): ) assert tmpl.render() == "13|37" + def test_namespace_set_tuple(self, env_trim): + tmpl = env_trim.from_string( + "{% set ns = namespace(a=12, b=36) %}" + "{% set ns.a, ns.b = ns.a + 1, ns.b + 1 %}" + "{{ ns.a }}|{{ ns.b }}" + ) + assert tmpl.render() == "13|37" + def test_block_escaping_filtered(self): env = Environment(autoescape=True) tmpl = env.from_string( diff --git a/contrib/python/Jinja2/py3/tests/test_filters.py b/contrib/python/Jinja2/py3/tests/test_filters.py index d8e9114d0f61..2cb53ac9d07f 100644 --- a/contrib/python/Jinja2/py3/tests/test_filters.py +++ b/contrib/python/Jinja2/py3/tests/test_filters.py @@ -196,6 +196,7 @@ def test_indent_width_string(self, env): ("abc", "0"), ("32.32", "32"), ("12345678901234567890", "12345678901234567890"), + ("1e10000", "0"), ), ) def test_int(self, env, value, expect): diff --git a/contrib/python/Jinja2/py3/tests/test_loader.py b/contrib/python/Jinja2/py3/tests/test_loader.py index d3b4ddf1ba70..0cdcf94bb07c 100644 --- a/contrib/python/Jinja2/py3/tests/test_loader.py +++ b/contrib/python/Jinja2/py3/tests/test_loader.py @@ -2,7 +2,6 @@ import importlib.machinery import importlib.util import os -import platform import shutil import sys import tempfile @@ -183,6 +182,24 @@ def test_filename_normpath(self): t = e.get_template("foo/test.html") assert t.filename == str(self.searchpath / "foo" / "test.html") + def test_error_includes_paths(self, env, filesystem_loader): + env.loader = filesystem_loader + + with pytest.raises(TemplateNotFound) as info: + env.get_template("missing") + + e_str = str(info.value) + assert e_str.startswith("'missing' not found in search path: ") + + filesystem_loader.searchpath.append("other") + + with pytest.raises(TemplateNotFound) as info: + env.get_template("missing") + + e_str = str(info.value) + assert e_str.startswith("'missing' not found in search paths: ") + assert ", 'other'" in e_str + class TestModuleLoader: archive = None @@ -367,8 +384,8 @@ def test_package_zip_source(package_zip_loader, template, expect): @pytest.mark.xfail( - platform.python_implementation() == "PyPy", - reason="PyPy's zipimporter doesn't have a '_files' attribute.", + sys.implementation.name == "pypy", + reason="zipimporter doesn't have a '_files' attribute", raises=TypeError, ) def test_package_zip_list(package_zip_loader): @@ -415,3 +432,8 @@ def exec_module(self, module): assert "test.html" in package_loader.list_templates() finally: sys.meta_path[:] = before + + +def test_package_loader_no_dir() -> None: + with pytest.raises(ValueError, match="could not find a 'templates' directory"): + PackageLoader("jinja2", check_templates=True) diff --git a/contrib/python/Jinja2/py3/tests/test_nativetypes.py b/contrib/python/Jinja2/py3/tests/test_nativetypes.py index 8c85252518d3..136908180795 100644 --- a/contrib/python/Jinja2/py3/tests/test_nativetypes.py +++ b/contrib/python/Jinja2/py3/tests/test_nativetypes.py @@ -160,3 +160,13 @@ def test_macro(env): result = t.render() assert result == 2 assert isinstance(result, int) + + +def test_block(env): + t = env.from_string( + "{% block b %}{% for i in range(1) %}{{ loop.index }}{% endfor %}" + "{% endblock %}{{ self.b() }}" + ) + result = t.render() + assert result == 11 + assert isinstance(result, int) diff --git a/contrib/python/Jinja2/py3/tests/test_regression.py b/contrib/python/Jinja2/py3/tests/test_regression.py index 7bd4d15649af..93d72c5e6f8b 100644 --- a/contrib/python/Jinja2/py3/tests/test_regression.py +++ b/contrib/python/Jinja2/py3/tests/test_regression.py @@ -737,6 +737,28 @@ def test_nested_loop_scoping(self, env): ) assert tmpl.render() == "hellohellohello" + def test_pass_context_with_select(self, env): + @pass_context + def is_foo(ctx, s): + assert ctx is not None + return s == "foo" + + env.tests["foo"] = is_foo + tmpl = env.from_string( + "{% for x in ['one', 'foo'] | select('foo') %}{{ x }}{% endfor %}" + ) + assert tmpl.render() == "foo" + + +def test_load_parameter_when_set_in_all_if_branches(env): + tmpl = env.from_string( + "{% if True %}{{ a.b }}{% set a = 1 %}" + "{% elif False %}{% set a = 2 %}" + "{% else %}{% set a = 3 %}{% endif %}" + "{{ a }}" + ) + assert tmpl.render(a={"b": 0}) == "01" + @pytest.mark.parametrize("unicode_char", ["\N{FORM FEED}", "\x85"]) def test_unicode_whitespace(env, unicode_char): diff --git a/contrib/python/Jinja2/py3/tests/test_runtime.py b/contrib/python/Jinja2/py3/tests/test_runtime.py index 1978c64104a8..3cd3be15fb6a 100644 --- a/contrib/python/Jinja2/py3/tests/test_runtime.py +++ b/contrib/python/Jinja2/py3/tests/test_runtime.py @@ -1,6 +1,15 @@ +import copy import itertools +import pickle +import pytest + +from jinja2 import ChainableUndefined +from jinja2 import DebugUndefined +from jinja2 import StrictUndefined from jinja2 import Template +from jinja2 import TemplateRuntimeError +from jinja2 import Undefined from jinja2.runtime import LoopContext TEST_IDX_TEMPLATE_STR_1 = ( @@ -73,3 +82,44 @@ def __call__(self, *args, **kwargs): out = t.render(calc=Calc()) # Would be "1" if context argument was passed. assert out == "0" + + +_undefined_types = (Undefined, ChainableUndefined, DebugUndefined, StrictUndefined) + + +@pytest.mark.parametrize("undefined_type", _undefined_types) +def test_undefined_copy(undefined_type): + undef = undefined_type("a hint", ["foo"], "a name", TemplateRuntimeError) + copied = copy.copy(undef) + + assert copied is not undef + assert copied._undefined_hint is undef._undefined_hint + assert copied._undefined_obj is undef._undefined_obj + assert copied._undefined_name is undef._undefined_name + assert copied._undefined_exception is undef._undefined_exception + + +@pytest.mark.parametrize("undefined_type", _undefined_types) +def test_undefined_deepcopy(undefined_type): + undef = undefined_type("a hint", ["foo"], "a name", TemplateRuntimeError) + copied = copy.deepcopy(undef) + + assert copied._undefined_hint is undef._undefined_hint + assert copied._undefined_obj is not undef._undefined_obj + assert copied._undefined_obj == undef._undefined_obj + assert copied._undefined_name is undef._undefined_name + assert copied._undefined_exception is undef._undefined_exception + + +@pytest.mark.parametrize("undefined_type", _undefined_types) +def test_undefined_pickle(undefined_type): + undef = undefined_type("a hint", ["foo"], "a name", TemplateRuntimeError) + copied = pickle.loads(pickle.dumps(undef)) + + assert copied._undefined_hint is not undef._undefined_hint + assert copied._undefined_hint == undef._undefined_hint + assert copied._undefined_obj is not undef._undefined_obj + assert copied._undefined_obj == undef._undefined_obj + assert copied._undefined_name is not undef._undefined_name + assert copied._undefined_name == undef._undefined_name + assert copied._undefined_exception is undef._undefined_exception diff --git a/contrib/python/Jinja2/py3/tests/test_security.py b/contrib/python/Jinja2/py3/tests/test_security.py index 0e8dc5c0385d..3a13781926e4 100644 --- a/contrib/python/Jinja2/py3/tests/test_security.py +++ b/contrib/python/Jinja2/py3/tests/test_security.py @@ -58,6 +58,8 @@ def test_unsafe(self, env): def test_immutable_environment(self, env): env = ImmutableSandboxedEnvironment() pytest.raises(SecurityError, env.from_string("{{ [].append(23) }}").render) + pytest.raises(SecurityError, env.from_string("{{ [].clear() }}").render) + pytest.raises(SecurityError, env.from_string("{{ [1].pop() }}").render) pytest.raises(SecurityError, env.from_string("{{ {1:2}.clear() }}").render) def test_restricted(self, env): @@ -171,3 +173,30 @@ def test_safe_format_all_okay(self): '{{ ("a{x.foo}b{y}"|safe).format_map({"x":{"foo": 42}, "y":""}) }}' ) assert t.render() == "a42b<foo>" + + def test_indirect_call(self): + def run(value, arg): + return value.run(arg) + + env = SandboxedEnvironment() + env.filters["run"] = run + t = env.from_string( + """{% set + ns = namespace(run="{0.__call__.__builtins__[__import__]}".format) + %} + {{ ns | run(not_here) }} + """ + ) + + with pytest.raises(SecurityError): + t.render() + + def test_attr_filter(self) -> None: + env = SandboxedEnvironment() + t = env.from_string( + """{{ "{0.__call__.__builtins__[__import__]}" + | attr("format")(not_here) }}""" + ) + + with pytest.raises(SecurityError): + t.render() diff --git a/contrib/python/Jinja2/py3/tests/test_utils.py b/contrib/python/Jinja2/py3/tests/test_utils.py index feaf8dc1d415..6f42eab5e247 100644 --- a/contrib/python/Jinja2/py3/tests/test_utils.py +++ b/contrib/python/Jinja2/py3/tests/test_utils.py @@ -1,3 +1,4 @@ +import copy import pickle import random from collections import deque @@ -141,6 +142,14 @@ def test_escape_urlize_target(self): "http://example.org" ) + def test_urlize_mail_mastodon(self): + fr = "nabijaczleweli@nabijaczleweli.xyz\n@eater@cijber.social\n" + to = ( + '' + "nabijaczleweli@nabijaczleweli.xyz\n@eater@cijber.social\n" + ) + assert urlize(fr) == to + class TestLoremIpsum: def test_lorem_ipsum_markup(self): @@ -183,3 +192,14 @@ def test_consume(): consume(x) with pytest.raises(StopIteration): next(x) + + +@pytest.mark.parametrize("protocol", range(pickle.HIGHEST_PROTOCOL + 1)) +def test_pickle_missing(protocol: int) -> None: + """Test that missing can be pickled while remaining a singleton.""" + assert pickle.loads(pickle.dumps(missing, protocol)) is missing + + +def test_copy_missing() -> None: + """Test that missing can be copied while remaining a singleton.""" + assert copy.copy(missing) is missing diff --git a/contrib/python/Jinja2/py3/tests/ya.make b/contrib/python/Jinja2/py3/tests/ya.make index c9f59c881f4d..7ae1b5e1b9c6 100644 --- a/contrib/python/Jinja2/py3/tests/ya.make +++ b/contrib/python/Jinja2/py3/tests/ya.make @@ -2,6 +2,11 @@ PY3TEST() PEERDIR( contrib/python/Jinja2 + contrib/python/trio +) + +DATA( + arcadia/contrib/python/Jinja2/py3/tests ) PY_SRCS( @@ -9,10 +14,6 @@ PY_SRCS( res/__init__.py ) -DATA( - arcadia/contrib/python/Jinja2/py3/tests/res -) - RESOURCE_FILES( PREFIX contrib/python/Jinja2/py3/tests/ res/templates/broken.html @@ -23,31 +24,7 @@ RESOURCE_FILES( res/templates2/foo ) -TEST_SRCS( - conftest.py - test_api.py - test_async.py - test_async_filters.py - test_bytecode_cache.py - test_compile.py - test_core_tags.py - test_debug.py - test_ext.py - test_filters.py - test_idtracking.py - test_imports.py - test_inheritance.py - test_lexnparse.py - test_loader.py - test_nativetypes.py - test_nodes.py - test_pickle.py - test_regression.py - test_runtime.py - test_security.py - test_tests.py - test_utils.py -) +ALL_PYTEST_SRCS() NO_LINT() diff --git a/contrib/python/Jinja2/py3/ya.make b/contrib/python/Jinja2/py3/ya.make index f51dfbfcce8b..67a1f90b4f2c 100644 --- a/contrib/python/Jinja2/py3/ya.make +++ b/contrib/python/Jinja2/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(3.1.4) +VERSION(3.1.6) LICENSE(BSD-3-Clause) diff --git a/contrib/python/outcome/.dist-info/METADATA b/contrib/python/outcome/.dist-info/METADATA new file mode 100644 index 000000000000..2a8636fddcfa --- /dev/null +++ b/contrib/python/outcome/.dist-info/METADATA @@ -0,0 +1,63 @@ +Metadata-Version: 2.1 +Name: outcome +Version: 1.3.0.post0 +Summary: Capture the outcome of Python function calls. +Home-page: https://github.com/python-trio/outcome +Author: Frazer McLean +Author-email: frazer@frazermclean.co.uk +License: MIT OR Apache-2.0 +Project-URL: Documentation, https://outcome.readthedocs.io/en/latest/ +Project-URL: Chat, https://gitter.im/python-trio/general +Project-URL: Changelog, https://outcome.readthedocs.io/en/latest/history.html +Keywords: result +Classifier: Development Status :: 5 - Production/Stable +Classifier: Framework :: Trio +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Typing :: Typed +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE +License-File: LICENSE.APACHE2 +License-File: LICENSE.MIT +Requires-Dist: attrs >=19.2.0 + +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://outcome.readthedocs.io/en/latest/?badge=latest + :alt: Documentation Status + +.. image:: https://travis-ci.org/python-trio/trio.svg?branch=master + :target: https://travis-ci.org/python-trio/outcome + :alt: Automated test status (Linux and MacOS) + +.. image:: https://ci.appveyor.com/api/projects/status/c54uu4rxlgs2usmj/branch/master?svg=true + :target: https://ci.appveyor.com/project/RazerM/outcome/history + :alt: Automated test status (Windows) + +.. image:: https://codecov.io/gh/python-trio/trio/branch/master/graph/badge.svg + :target: https://codecov.io/gh/python-trio/outcome + :alt: Test coverage + +outcome +======= + +Welcome to `outcome `__! + +Capture the outcome of Python function calls. Extracted from the +`Trio `__ project. + +License: Your choice of MIT or Apache License 2.0 diff --git a/contrib/python/outcome/.dist-info/top_level.txt b/contrib/python/outcome/.dist-info/top_level.txt new file mode 100644 index 000000000000..e6d2d58a1eb2 --- /dev/null +++ b/contrib/python/outcome/.dist-info/top_level.txt @@ -0,0 +1 @@ +outcome diff --git a/contrib/python/outcome/LICENSE b/contrib/python/outcome/LICENSE new file mode 100644 index 000000000000..51f344291783 --- /dev/null +++ b/contrib/python/outcome/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the +licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to are +made under the terms of *both* these licenses. diff --git a/contrib/python/outcome/LICENSE.APACHE2 b/contrib/python/outcome/LICENSE.APACHE2 new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/contrib/python/outcome/LICENSE.APACHE2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/contrib/python/outcome/LICENSE.MIT b/contrib/python/outcome/LICENSE.MIT new file mode 100644 index 000000000000..b8bb97185926 --- /dev/null +++ b/contrib/python/outcome/LICENSE.MIT @@ -0,0 +1,20 @@ +The MIT License (MIT) + +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/contrib/python/outcome/README.rst b/contrib/python/outcome/README.rst new file mode 100644 index 000000000000..d3a27dc41aaf --- /dev/null +++ b/contrib/python/outcome/README.rst @@ -0,0 +1,29 @@ +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://outcome.readthedocs.io/en/latest/?badge=latest + :alt: Documentation Status + +.. image:: https://travis-ci.org/python-trio/trio.svg?branch=master + :target: https://travis-ci.org/python-trio/outcome + :alt: Automated test status (Linux and MacOS) + +.. image:: https://ci.appveyor.com/api/projects/status/c54uu4rxlgs2usmj/branch/master?svg=true + :target: https://ci.appveyor.com/project/RazerM/outcome/history + :alt: Automated test status (Windows) + +.. image:: https://codecov.io/gh/python-trio/trio/branch/master/graph/badge.svg + :target: https://codecov.io/gh/python-trio/outcome + :alt: Test coverage + +outcome +======= + +Welcome to `outcome `__! + +Capture the outcome of Python function calls. Extracted from the +`Trio `__ project. + +License: Your choice of MIT or Apache License 2.0 diff --git a/contrib/python/outcome/outcome/__init__.py b/contrib/python/outcome/outcome/__init__.py new file mode 100644 index 000000000000..9e6b453710e3 --- /dev/null +++ b/contrib/python/outcome/outcome/__init__.py @@ -0,0 +1,20 @@ +"""Top-level package for outcome.""" + +from ._impl import ( + Error as Error, + Maybe as Maybe, + Outcome as Outcome, + Value as Value, + acapture as acapture, + capture as capture, +) +from ._util import AlreadyUsedError as AlreadyUsedError, fixup_module_metadata +from ._version import __version__ as __version__ + +__all__ = ( + 'Error', 'Outcome', 'Value', 'Maybe', 'acapture', 'capture', + 'AlreadyUsedError' +) + +fixup_module_metadata(__name__, globals()) +del fixup_module_metadata diff --git a/contrib/python/outcome/outcome/_impl.py b/contrib/python/outcome/outcome/_impl.py new file mode 100644 index 000000000000..004b72dad214 --- /dev/null +++ b/contrib/python/outcome/outcome/_impl.py @@ -0,0 +1,239 @@ +from __future__ import annotations + +import abc +from typing import ( + TYPE_CHECKING, + AsyncGenerator, + Awaitable, + Callable, + Generator, + Generic, + NoReturn, + TypeVar, + Union, + overload, +) + +import attr + +from ._util import AlreadyUsedError, remove_tb_frames + +if TYPE_CHECKING: + from typing_extensions import ParamSpec, final + ArgsT = ParamSpec("ArgsT") +else: + + def final(func): + return func + + +__all__ = ['Error', 'Outcome', 'Maybe', 'Value', 'acapture', 'capture'] + +ValueT = TypeVar("ValueT", covariant=True) +ResultT = TypeVar("ResultT") + + +@overload +def capture( + # NoReturn = raises exception, so we should get an error. + sync_fn: Callable[ArgsT, NoReturn], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Error: + ... + + +@overload +def capture( + sync_fn: Callable[ArgsT, ResultT], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Value[ResultT] | Error: + ... + + +def capture( + sync_fn: Callable[ArgsT, ResultT], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Value[ResultT] | Error: + """Run ``sync_fn(*args, **kwargs)`` and capture the result. + + Returns: + Either a :class:`Value` or :class:`Error` as appropriate. + + """ + try: + return Value(sync_fn(*args, **kwargs)) + except BaseException as exc: + exc = remove_tb_frames(exc, 1) + return Error(exc) + + +@overload +async def acapture( + async_fn: Callable[ArgsT, Awaitable[NoReturn]], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Error: + ... + + +@overload +async def acapture( + async_fn: Callable[ArgsT, Awaitable[ResultT]], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Value[ResultT] | Error: + ... + + +async def acapture( + async_fn: Callable[ArgsT, Awaitable[ResultT]], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, +) -> Value[ResultT] | Error: + """Run ``await async_fn(*args, **kwargs)`` and capture the result. + + Returns: + Either a :class:`Value` or :class:`Error` as appropriate. + + """ + try: + return Value(await async_fn(*args, **kwargs)) + except BaseException as exc: + exc = remove_tb_frames(exc, 1) + return Error(exc) + + +@attr.s(repr=False, init=False, slots=True) +class Outcome(abc.ABC, Generic[ValueT]): + """An abstract class representing the result of a Python computation. + + This class has two concrete subclasses: :class:`Value` representing a + value, and :class:`Error` representing an exception. + + In addition to the methods described below, comparison operators on + :class:`Value` and :class:`Error` objects (``==``, ``<``, etc.) check that + the other object is also a :class:`Value` or :class:`Error` object + respectively, and then compare the contained objects. + + :class:`Outcome` objects are hashable if the contained objects are + hashable. + + """ + _unwrapped: bool = attr.ib(default=False, eq=False, init=False) + + def _set_unwrapped(self) -> None: + if self._unwrapped: + raise AlreadyUsedError + object.__setattr__(self, '_unwrapped', True) + + @abc.abstractmethod + def unwrap(self) -> ValueT: + """Return or raise the contained value or exception. + + These two lines of code are equivalent:: + + x = fn(*args) + x = outcome.capture(fn, *args).unwrap() + + """ + + @abc.abstractmethod + def send(self, gen: Generator[ResultT, ValueT, object]) -> ResultT: + """Send or throw the contained value or exception into the given + generator object. + + Args: + gen: A generator object supporting ``.send()`` and ``.throw()`` + methods. + + """ + + @abc.abstractmethod + async def asend(self, agen: AsyncGenerator[ResultT, ValueT]) -> ResultT: + """Send or throw the contained value or exception into the given async + generator object. + + Args: + agen: An async generator object supporting ``.asend()`` and + ``.athrow()`` methods. + + """ + + +@final +@attr.s(frozen=True, repr=False, slots=True) +class Value(Outcome[ValueT], Generic[ValueT]): + """Concrete :class:`Outcome` subclass representing a regular value. + + """ + + value: ValueT = attr.ib() + """The contained value.""" + + def __repr__(self) -> str: + return f'Value({self.value!r})' + + def unwrap(self) -> ValueT: + self._set_unwrapped() + return self.value + + def send(self, gen: Generator[ResultT, ValueT, object]) -> ResultT: + self._set_unwrapped() + return gen.send(self.value) + + async def asend(self, agen: AsyncGenerator[ResultT, ValueT]) -> ResultT: + self._set_unwrapped() + return await agen.asend(self.value) + + +@final +@attr.s(frozen=True, repr=False, slots=True) +class Error(Outcome[NoReturn]): + """Concrete :class:`Outcome` subclass representing a raised exception. + + """ + + error: BaseException = attr.ib( + validator=attr.validators.instance_of(BaseException) + ) + """The contained exception object.""" + + def __repr__(self) -> str: + return f'Error({self.error!r})' + + def unwrap(self) -> NoReturn: + self._set_unwrapped() + # Tracebacks show the 'raise' line below out of context, so let's give + # this variable a name that makes sense out of context. + captured_error = self.error + try: + raise captured_error + finally: + # We want to avoid creating a reference cycle here. Python does + # collect cycles just fine, so it wouldn't be the end of the world + # if we did create a cycle, but the cyclic garbage collector adds + # latency to Python programs, and the more cycles you create, the + # more often it runs, so it's nicer to avoid creating them in the + # first place. For more details see: + # + # https://github.com/python-trio/trio/issues/1770 + # + # In particuar, by deleting this local variables from the 'unwrap' + # methods frame, we avoid the 'captured_error' object's + # __traceback__ from indirectly referencing 'captured_error'. + del captured_error, self + + def send(self, gen: Generator[ResultT, NoReturn, object]) -> ResultT: + self._set_unwrapped() + return gen.throw(self.error) + + async def asend(self, agen: AsyncGenerator[ResultT, NoReturn]) -> ResultT: + self._set_unwrapped() + return await agen.athrow(self.error) + + +# A convenience alias to a union of both results, allowing exhaustiveness checking. +Maybe = Union[Value[ValueT], Error] diff --git a/contrib/python/outcome/outcome/_util.py b/contrib/python/outcome/outcome/_util.py new file mode 100644 index 000000000000..98ad50f98cef --- /dev/null +++ b/contrib/python/outcome/outcome/_util.py @@ -0,0 +1,33 @@ +from typing import Any, Dict + + +class AlreadyUsedError(RuntimeError): + """An Outcome can only be unwrapped once.""" + pass + + +def fixup_module_metadata( + module_name: str, + namespace: Dict[str, object], +) -> None: + def fix_one(obj: object) -> None: + mod = getattr(obj, "__module__", None) + if mod is not None and mod.startswith("outcome."): + obj.__module__ = module_name + if isinstance(obj, type): + for attr_value in obj.__dict__.values(): + fix_one(attr_value) + + all_list = namespace["__all__"] + assert isinstance(all_list, (tuple, list)), repr(all_list) + for objname in all_list: + obj = namespace[objname] + fix_one(obj) + + +def remove_tb_frames(exc: BaseException, n: int) -> BaseException: + tb = exc.__traceback__ + for _ in range(n): + assert tb is not None + tb = tb.tb_next + return exc.with_traceback(tb) diff --git a/contrib/python/outcome/outcome/_version.py b/contrib/python/outcome/outcome/_version.py new file mode 100644 index 000000000000..5bd0d9c6bed6 --- /dev/null +++ b/contrib/python/outcome/outcome/_version.py @@ -0,0 +1,7 @@ +# This file is imported from __init__.py and exec'd from setup.py +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing_extensions import Final + +__version__: 'Final[str]' = "1.3.0.post0" diff --git a/contrib/python/outcome/outcome/py.typed b/contrib/python/outcome/outcome/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/outcome/ya.make b/contrib/python/outcome/ya.make new file mode 100644 index 000000000000..1677b7b74dd9 --- /dev/null +++ b/contrib/python/outcome/ya.make @@ -0,0 +1,30 @@ +# Generated by devtools/yamaker (pypi). + +PY3_LIBRARY() + +VERSION(1.3.0.post0) + +LICENSE(Apache-2.0 AND BSD-3-Clause AND MIT AND "MIT OR Apache-2.0") + +PEERDIR( + contrib/python/attrs +) + +NO_LINT() + +PY_SRCS( + TOP_LEVEL + outcome/__init__.py + outcome/_impl.py + outcome/_util.py + outcome/_version.py +) + +RESOURCE_FILES( + PREFIX contrib/python/outcome/ + .dist-info/METADATA + .dist-info/top_level.txt + outcome/py.typed +) + +END() diff --git a/contrib/python/sniffio/.dist-info/METADATA b/contrib/python/sniffio/.dist-info/METADATA new file mode 100644 index 000000000000..88968aed1691 --- /dev/null +++ b/contrib/python/sniffio/.dist-info/METADATA @@ -0,0 +1,104 @@ +Metadata-Version: 2.1 +Name: sniffio +Version: 1.3.1 +Summary: Sniff out which async library your code is running under +Author-email: "Nathaniel J. Smith" +License: MIT OR Apache-2.0 +Project-URL: Homepage, https://github.com/python-trio/sniffio +Project-URL: Documentation, https://sniffio.readthedocs.io/ +Project-URL: Changelog, https://sniffio.readthedocs.io/en/latest/history.html +Keywords: async,trio,asyncio +Classifier: License :: OSI Approved :: MIT License +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Framework :: Trio +Classifier: Framework :: AsyncIO +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Intended Audience :: Developers +Classifier: Development Status :: 5 - Production/Stable +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE +License-File: LICENSE.APACHE2 +License-File: LICENSE.MIT + +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://sniffio.readthedocs.io/en/latest/?badge=latest + :alt: Documentation Status + +.. image:: https://img.shields.io/pypi/v/sniffio.svg + :target: https://pypi.org/project/sniffio + :alt: Latest PyPi version + +.. image:: https://img.shields.io/conda/vn/conda-forge/sniffio.svg + :target: https://anaconda.org/conda-forge/sniffio + :alt: Latest conda-forge version + +.. image:: https://travis-ci.org/python-trio/sniffio.svg?branch=master + :target: https://travis-ci.org/python-trio/sniffio + :alt: Automated test status + +.. image:: https://codecov.io/gh/python-trio/sniffio/branch/master/graph/badge.svg + :target: https://codecov.io/gh/python-trio/sniffio + :alt: Test coverage + +================================================================= +sniffio: Sniff out which async library your code is running under +================================================================= + +You're writing a library. You've decided to be ambitious, and support +multiple async I/O packages, like `Trio +`__, and `asyncio +`__, and ... You've +written a bunch of clever code to handle all the differences. But... +how do you know *which* piece of clever code to run? + +This is a tiny package whose only purpose is to let you detect which +async library your code is running under. + +* Documentation: https://sniffio.readthedocs.io + +* Bug tracker and source code: https://github.com/python-trio/sniffio + +* License: MIT or Apache License 2.0, your choice + +* Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html + +* Code of conduct: Contributors are requested to follow our `code of + conduct + `_ + in all project spaces. + +This library is maintained by the Trio project, as a service to the +async Python community as a whole. + + +Quickstart +---------- + +.. code-block:: python3 + + from sniffio import current_async_library + import trio + import asyncio + + async def print_library(): + library = current_async_library() + print("This is:", library) + + # Prints "This is trio" + trio.run(print_library) + + # Prints "This is asyncio" + asyncio.run(print_library()) + +For more details, including how to add support to new async libraries, +`please peruse our fine manual `__. diff --git a/contrib/python/sniffio/.dist-info/top_level.txt b/contrib/python/sniffio/.dist-info/top_level.txt new file mode 100644 index 000000000000..01c650244d0c --- /dev/null +++ b/contrib/python/sniffio/.dist-info/top_level.txt @@ -0,0 +1 @@ +sniffio diff --git a/contrib/python/sniffio/.yandex_meta/yamaker.yaml b/contrib/python/sniffio/.yandex_meta/yamaker.yaml new file mode 100644 index 000000000000..1a9504527f40 --- /dev/null +++ b/contrib/python/sniffio/.yandex_meta/yamaker.yaml @@ -0,0 +1,2 @@ +mark_as_tests: + - sniffio/_tests/* diff --git a/contrib/python/sniffio/LICENSE b/contrib/python/sniffio/LICENSE new file mode 100644 index 000000000000..51f344291783 --- /dev/null +++ b/contrib/python/sniffio/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the +licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to are +made under the terms of *both* these licenses. diff --git a/contrib/python/sniffio/LICENSE.APACHE2 b/contrib/python/sniffio/LICENSE.APACHE2 new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/contrib/python/sniffio/LICENSE.APACHE2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/contrib/python/sniffio/LICENSE.MIT b/contrib/python/sniffio/LICENSE.MIT new file mode 100644 index 000000000000..b8bb97185926 --- /dev/null +++ b/contrib/python/sniffio/LICENSE.MIT @@ -0,0 +1,20 @@ +The MIT License (MIT) + +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/contrib/python/sniffio/README.rst b/contrib/python/sniffio/README.rst new file mode 100644 index 000000000000..2a62cea5a0a3 --- /dev/null +++ b/contrib/python/sniffio/README.rst @@ -0,0 +1,76 @@ +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://sniffio.readthedocs.io/en/latest/?badge=latest + :alt: Documentation Status + +.. image:: https://img.shields.io/pypi/v/sniffio.svg + :target: https://pypi.org/project/sniffio + :alt: Latest PyPi version + +.. image:: https://img.shields.io/conda/vn/conda-forge/sniffio.svg + :target: https://anaconda.org/conda-forge/sniffio + :alt: Latest conda-forge version + +.. image:: https://travis-ci.org/python-trio/sniffio.svg?branch=master + :target: https://travis-ci.org/python-trio/sniffio + :alt: Automated test status + +.. image:: https://codecov.io/gh/python-trio/sniffio/branch/master/graph/badge.svg + :target: https://codecov.io/gh/python-trio/sniffio + :alt: Test coverage + +================================================================= +sniffio: Sniff out which async library your code is running under +================================================================= + +You're writing a library. You've decided to be ambitious, and support +multiple async I/O packages, like `Trio +`__, and `asyncio +`__, and ... You've +written a bunch of clever code to handle all the differences. But... +how do you know *which* piece of clever code to run? + +This is a tiny package whose only purpose is to let you detect which +async library your code is running under. + +* Documentation: https://sniffio.readthedocs.io + +* Bug tracker and source code: https://github.com/python-trio/sniffio + +* License: MIT or Apache License 2.0, your choice + +* Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html + +* Code of conduct: Contributors are requested to follow our `code of + conduct + `_ + in all project spaces. + +This library is maintained by the Trio project, as a service to the +async Python community as a whole. + + +Quickstart +---------- + +.. code-block:: python3 + + from sniffio import current_async_library + import trio + import asyncio + + async def print_library(): + library = current_async_library() + print("This is:", library) + + # Prints "This is trio" + trio.run(print_library) + + # Prints "This is asyncio" + asyncio.run(print_library()) + +For more details, including how to add support to new async libraries, +`please peruse our fine manual `__. diff --git a/contrib/python/sniffio/sniffio/__init__.py b/contrib/python/sniffio/sniffio/__init__.py new file mode 100644 index 000000000000..63f2f19e409c --- /dev/null +++ b/contrib/python/sniffio/sniffio/__init__.py @@ -0,0 +1,17 @@ +"""Top-level package for sniffio.""" + +__all__ = [ + "current_async_library", + "AsyncLibraryNotFoundError", + "current_async_library_cvar", + "thread_local", +] + +from ._version import __version__ + +from ._impl import ( + current_async_library, + AsyncLibraryNotFoundError, + current_async_library_cvar, + thread_local, +) diff --git a/contrib/python/sniffio/sniffio/_impl.py b/contrib/python/sniffio/sniffio/_impl.py new file mode 100644 index 000000000000..c1a7bbf218ba --- /dev/null +++ b/contrib/python/sniffio/sniffio/_impl.py @@ -0,0 +1,95 @@ +from contextvars import ContextVar +from typing import Optional +import sys +import threading + +current_async_library_cvar = ContextVar( + "current_async_library_cvar", default=None +) # type: ContextVar[Optional[str]] + + +class _ThreadLocal(threading.local): + # Since threading.local provides no explicit mechanism is for setting + # a default for a value, a custom class with a class attribute is used + # instead. + name = None # type: Optional[str] + + +thread_local = _ThreadLocal() + + +class AsyncLibraryNotFoundError(RuntimeError): + pass + + +def current_async_library() -> str: + """Detect which async library is currently running. + + The following libraries are currently supported: + + ================ =========== ============================ + Library Requires Magic string + ================ =========== ============================ + **Trio** Trio v0.6+ ``"trio"`` + **Curio** - ``"curio"`` + **asyncio** ``"asyncio"`` + **Trio-asyncio** v0.8.2+ ``"trio"`` or ``"asyncio"``, + depending on current mode + ================ =========== ============================ + + Returns: + A string like ``"trio"``. + + Raises: + AsyncLibraryNotFoundError: if called from synchronous context, + or if the current async library was not recognized. + + Examples: + + .. code-block:: python3 + + from sniffio import current_async_library + + async def generic_sleep(seconds): + library = current_async_library() + if library == "trio": + import trio + await trio.sleep(seconds) + elif library == "asyncio": + import asyncio + await asyncio.sleep(seconds) + # ... and so on ... + else: + raise RuntimeError(f"Unsupported library {library!r}") + + """ + value = thread_local.name + if value is not None: + return value + + value = current_async_library_cvar.get() + if value is not None: + return value + + # Need to sniff for asyncio + if "asyncio" in sys.modules: + import asyncio + try: + current_task = asyncio.current_task # type: ignore[attr-defined] + except AttributeError: + current_task = asyncio.Task.current_task # type: ignore[attr-defined] + try: + if current_task() is not None: + return "asyncio" + except RuntimeError: + pass + + # Sniff for curio (for now) + if 'curio' in sys.modules: + from curio.meta import curio_running + if curio_running(): + return 'curio' + + raise AsyncLibraryNotFoundError( + "unknown async library, or not in async context" + ) diff --git a/contrib/python/sniffio/sniffio/_version.py b/contrib/python/sniffio/sniffio/_version.py new file mode 100644 index 000000000000..0495d10545c9 --- /dev/null +++ b/contrib/python/sniffio/sniffio/_version.py @@ -0,0 +1,3 @@ +# This file is imported from __init__.py and exec'd from setup.py + +__version__ = "1.3.1" diff --git a/contrib/python/sniffio/sniffio/py.typed b/contrib/python/sniffio/sniffio/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/sniffio/ya.make b/contrib/python/sniffio/ya.make new file mode 100644 index 000000000000..165b99c587e3 --- /dev/null +++ b/contrib/python/sniffio/ya.make @@ -0,0 +1,25 @@ +# Generated by devtools/yamaker (pypi). + +PY3_LIBRARY() + +VERSION(1.3.1) + +LICENSE(Apache-2.0 AND MIT) + +NO_LINT() + +PY_SRCS( + TOP_LEVEL + sniffio/__init__.py + sniffio/_impl.py + sniffio/_version.py +) + +RESOURCE_FILES( + PREFIX contrib/python/sniffio/ + .dist-info/METADATA + .dist-info/top_level.txt + sniffio/py.typed +) + +END() diff --git a/contrib/python/trio/.dist-info/METADATA b/contrib/python/trio/.dist-info/METADATA new file mode 100644 index 000000000000..b75c591ed29e --- /dev/null +++ b/contrib/python/trio/.dist-info/METADATA @@ -0,0 +1,186 @@ +Metadata-Version: 2.4 +Name: trio +Version: 0.31.0 +Summary: A friendly Python library for async concurrency and I/O +Author-email: "Nathaniel J. Smith" +License-Expression: MIT OR Apache-2.0 +Project-URL: Homepage, https://github.com/python-trio/trio +Project-URL: Documentation, https://trio.readthedocs.io/ +Project-URL: Changelog, https://trio.readthedocs.io/en/latest/history.html +Keywords: async,io,networking,trio +Classifier: Development Status :: 4 - Beta +Classifier: Framework :: Trio +Classifier: Intended Audience :: Developers +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: System :: Networking +Classifier: Typing :: Typed +Requires-Python: >=3.9 +Description-Content-Type: text/x-rst +License-File: LICENSE +License-File: LICENSE.APACHE2 +License-File: LICENSE.MIT +Requires-Dist: attrs>=23.2.0 +Requires-Dist: sortedcontainers +Requires-Dist: idna +Requires-Dist: outcome +Requires-Dist: sniffio>=1.3.0 +Requires-Dist: cffi>=1.14; os_name == "nt" and implementation_name != "pypy" +Requires-Dist: exceptiongroup; python_version < "3.11" +Dynamic: license-file + +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/forum-join%20now-blue.svg + :target: https://trio.discourse.group + :alt: Join forum + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://trio.readthedocs.io + :alt: Documentation + +.. image:: https://img.shields.io/pypi/v/trio.svg + :target: https://pypi.org/project/trio + :alt: Latest PyPi version + +.. image:: https://img.shields.io/conda/vn/conda-forge/trio.svg + :target: https://anaconda.org/conda-forge/trio + :alt: Latest conda-forge version + +.. image:: https://codecov.io/gh/python-trio/trio/branch/main/graph/badge.svg + :target: https://codecov.io/gh/python-trio/trio + :alt: Test coverage + +Trio – a friendly Python library for async concurrency and I/O +============================================================== + +.. image:: https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg + :width: 200px + :align: right + +The Trio project aims to produce a production-quality, +`permissively licensed +`__, +async/await-native I/O library for Python. Like all async libraries, +its main purpose is to help you write programs that do **multiple +things at the same time** with **parallelized I/O**. A web spider that +wants to fetch lots of pages in parallel, a web server that needs to +juggle lots of downloads and websocket connections simultaneously, a +process supervisor monitoring multiple subprocesses... that sort of +thing. Compared to other libraries, Trio attempts to distinguish +itself with an obsessive focus on **usability** and +**correctness**. Concurrency is complicated; we try to make it *easy* +to get things *right*. + +Trio was built from the ground up to take advantage of the `latest +Python features `__, and +draws inspiration from `many sources +`__, in +particular Dave Beazley's `Curio `__. +The resulting design is radically simpler than older competitors like +`asyncio `__ and +`Twisted `__, yet just as capable. Trio is +the Python I/O library I always wanted; I find it makes building +I/O-oriented programs easier, less error-prone, and just plain more +fun. `Perhaps you'll find the same +`__. + +Trio is a mature and well-tested project: the overall design is solid, +and the existing features are fully documented and widely used in +production. While we occasionally make minor interface adjustments, +breaking changes are rare. We encourage you to use Trio with confidence, +but if you rely on long-term API stability, consider `subscribing to +issue #1 `__ for advance +notice of any compatibility updates. + + +Where to next? +-------------- + +**I want to try it out!** Awesome! We have a `friendly tutorial +`__ to get you +started; no prior experience with async coding is required. + +**Ugh, I don't want to read all that – show me some code!** If you're +impatient, then here's a `simple concurrency example +`__, +an `echo client +`__, +and an `echo server +`__. + +**How does Trio make programs easier to read and reason about than +competing approaches?** Trio is based on a new way of thinking that we +call "structured concurrency". The best theoretical introduction is +the article `Notes on structured concurrency, or: Go statement +considered harmful +`__. +Or, `check out this talk at PyCon 2018 +`__ to see a +demonstration of implementing the "Happy Eyeballs" algorithm in an +older library versus Trio. + +**Cool, but will it work on my system?** Probably! As long as you have +some kind of Python 3.9-or-better (CPython or `currently maintained versions of +PyPy3 `__ +are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio +will work. Other environments might work too, but those +are the ones we test on. And all of our dependencies are pure Python, +except for CFFI on Windows, which has wheels available, so +installation should be easy (no C compiler needed). + +**I tried it, but it's not working.** Sorry to hear that! You can try +asking for help in our `chat room +`__ or `forum +`__, `filing a bug +`__, or `posting a +question on StackOverflow +`__, +and we'll do our best to help you out. + +**Trio is awesome, and I want to help make it more awesome!** You're +the best! There's tons of work to do – filling in missing +functionality, building up an ecosystem of Trio-using libraries, +usability testing (e.g., maybe try teaching yourself or a friend to +use Trio and make a list of every error message you hit and place +where you got confused?), improving the docs, ... check out our `guide +for contributors +`__! + +**I don't have any immediate plans to use it, but I love geeking out +about I/O library design!** That's a little weird? But let's be +honest, you'll fit in great around here. We have a `whole sub-forum +for discussing structured concurrency +`__ (developers +of other systems welcome!). Or check out our `discussion of design +choices +`__, +`reading list +`__, and +`issues tagged design-discussion +`__. + +**I want to make sure my company's lawyers won't get angry at me!** No +worries, Trio is permissively licensed under your choice of MIT or +Apache 2. See `LICENSE +`__ for details. + + +Code of conduct +--------------- + +Contributors are requested to follow our `code of conduct +`__ in all +project spaces. diff --git a/contrib/python/trio/.dist-info/entry_points.txt b/contrib/python/trio/.dist-info/entry_points.txt new file mode 100644 index 000000000000..6563bece5ed4 --- /dev/null +++ b/contrib/python/trio/.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[hypothesis] +trio = trio._core._run:_hypothesis_plugin_setup diff --git a/contrib/python/trio/.dist-info/top_level.txt b/contrib/python/trio/.dist-info/top_level.txt new file mode 100644 index 000000000000..ae0d704f07cc --- /dev/null +++ b/contrib/python/trio/.dist-info/top_level.txt @@ -0,0 +1 @@ +trio diff --git a/contrib/python/trio/.yandex_meta/yamaker.yaml b/contrib/python/trio/.yandex_meta/yamaker.yaml new file mode 100644 index 000000000000..2c838790a4e5 --- /dev/null +++ b/contrib/python/trio/.yandex_meta/yamaker.yaml @@ -0,0 +1,3 @@ +mark_as_tests: + - trio/_tests/* + - trio/**/_tests/* diff --git a/contrib/python/trio/LICENSE b/contrib/python/trio/LICENSE new file mode 100644 index 000000000000..b79c96408a4e --- /dev/null +++ b/contrib/python/trio/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the +licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to +Trio are made under the terms of *both* these licenses. diff --git a/contrib/python/trio/LICENSE.APACHE2 b/contrib/python/trio/LICENSE.APACHE2 new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/contrib/python/trio/LICENSE.APACHE2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/contrib/python/trio/LICENSE.MIT b/contrib/python/trio/LICENSE.MIT new file mode 100644 index 000000000000..c26b9f32ae50 --- /dev/null +++ b/contrib/python/trio/LICENSE.MIT @@ -0,0 +1,22 @@ +Copyright Contributors to the Trio project. + +The MIT License (MIT) + +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/contrib/python/trio/README.rst b/contrib/python/trio/README.rst new file mode 100644 index 000000000000..f62c2a37af13 --- /dev/null +++ b/contrib/python/trio/README.rst @@ -0,0 +1,145 @@ +.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg + :target: https://gitter.im/python-trio/general + :alt: Join chatroom + +.. image:: https://img.shields.io/badge/forum-join%20now-blue.svg + :target: https://trio.discourse.group + :alt: Join forum + +.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg + :target: https://trio.readthedocs.io + :alt: Documentation + +.. image:: https://img.shields.io/pypi/v/trio.svg + :target: https://pypi.org/project/trio + :alt: Latest PyPi version + +.. image:: https://img.shields.io/conda/vn/conda-forge/trio.svg + :target: https://anaconda.org/conda-forge/trio + :alt: Latest conda-forge version + +.. image:: https://codecov.io/gh/python-trio/trio/branch/main/graph/badge.svg + :target: https://codecov.io/gh/python-trio/trio + :alt: Test coverage + +Trio – a friendly Python library for async concurrency and I/O +============================================================== + +.. image:: https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg + :width: 200px + :align: right + +The Trio project aims to produce a production-quality, +`permissively licensed +`__, +async/await-native I/O library for Python. Like all async libraries, +its main purpose is to help you write programs that do **multiple +things at the same time** with **parallelized I/O**. A web spider that +wants to fetch lots of pages in parallel, a web server that needs to +juggle lots of downloads and websocket connections simultaneously, a +process supervisor monitoring multiple subprocesses... that sort of +thing. Compared to other libraries, Trio attempts to distinguish +itself with an obsessive focus on **usability** and +**correctness**. Concurrency is complicated; we try to make it *easy* +to get things *right*. + +Trio was built from the ground up to take advantage of the `latest +Python features `__, and +draws inspiration from `many sources +`__, in +particular Dave Beazley's `Curio `__. +The resulting design is radically simpler than older competitors like +`asyncio `__ and +`Twisted `__, yet just as capable. Trio is +the Python I/O library I always wanted; I find it makes building +I/O-oriented programs easier, less error-prone, and just plain more +fun. `Perhaps you'll find the same +`__. + +Trio is a mature and well-tested project: the overall design is solid, +and the existing features are fully documented and widely used in +production. While we occasionally make minor interface adjustments, +breaking changes are rare. We encourage you to use Trio with confidence, +but if you rely on long-term API stability, consider `subscribing to +issue #1 `__ for advance +notice of any compatibility updates. + + +Where to next? +-------------- + +**I want to try it out!** Awesome! We have a `friendly tutorial +`__ to get you +started; no prior experience with async coding is required. + +**Ugh, I don't want to read all that – show me some code!** If you're +impatient, then here's a `simple concurrency example +`__, +an `echo client +`__, +and an `echo server +`__. + +**How does Trio make programs easier to read and reason about than +competing approaches?** Trio is based on a new way of thinking that we +call "structured concurrency". The best theoretical introduction is +the article `Notes on structured concurrency, or: Go statement +considered harmful +`__. +Or, `check out this talk at PyCon 2018 +`__ to see a +demonstration of implementing the "Happy Eyeballs" algorithm in an +older library versus Trio. + +**Cool, but will it work on my system?** Probably! As long as you have +some kind of Python 3.9-or-better (CPython or `currently maintained versions of +PyPy3 `__ +are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio +will work. Other environments might work too, but those +are the ones we test on. And all of our dependencies are pure Python, +except for CFFI on Windows, which has wheels available, so +installation should be easy (no C compiler needed). + +**I tried it, but it's not working.** Sorry to hear that! You can try +asking for help in our `chat room +`__ or `forum +`__, `filing a bug +`__, or `posting a +question on StackOverflow +`__, +and we'll do our best to help you out. + +**Trio is awesome, and I want to help make it more awesome!** You're +the best! There's tons of work to do – filling in missing +functionality, building up an ecosystem of Trio-using libraries, +usability testing (e.g., maybe try teaching yourself or a friend to +use Trio and make a list of every error message you hit and place +where you got confused?), improving the docs, ... check out our `guide +for contributors +`__! + +**I don't have any immediate plans to use it, but I love geeking out +about I/O library design!** That's a little weird? But let's be +honest, you'll fit in great around here. We have a `whole sub-forum +for discussing structured concurrency +`__ (developers +of other systems welcome!). Or check out our `discussion of design +choices +`__, +`reading list +`__, and +`issues tagged design-discussion +`__. + +**I want to make sure my company's lawyers won't get angry at me!** No +worries, Trio is permissively licensed under your choice of MIT or +Apache 2. See `LICENSE +`__ for details. + + +Code of conduct +--------------- + +Contributors are requested to follow our `code of conduct +`__ in all +project spaces. diff --git a/contrib/python/trio/trio/__init__.py b/contrib/python/trio/trio/__init__.py new file mode 100644 index 000000000000..b937ac5b937c --- /dev/null +++ b/contrib/python/trio/trio/__init__.py @@ -0,0 +1,133 @@ +"""Trio - A friendly Python library for async concurrency and I/O""" + +from __future__ import annotations + +from typing import TYPE_CHECKING + +# General layout: +# +# trio/_core/... is the self-contained core library. It does various +# shenanigans to export a consistent "core API", but parts of the core API are +# too low-level to be recommended for regular use. +# +# trio/*.py define a set of more usable tools on top of this. They import from +# trio._core and from each other. +# +# This file pulls together the friendly public API, by re-exporting the more +# innocuous bits of the _core API + the higher-level tools from trio/*.py. +# +# Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) +# +# must be imported early to avoid circular import +from ._core import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED # isort: split + +# Submodules imported by default +from . import abc, from_thread, lowlevel, socket, to_thread +from ._channel import ( + MemoryChannelStatistics as MemoryChannelStatistics, + MemoryReceiveChannel as MemoryReceiveChannel, + MemorySendChannel as MemorySendChannel, + as_safe_channel as as_safe_channel, + open_memory_channel as open_memory_channel, +) +from ._core import ( + BrokenResourceError as BrokenResourceError, + BusyResourceError as BusyResourceError, + Cancelled as Cancelled, + CancelScope as CancelScope, + ClosedResourceError as ClosedResourceError, + EndOfChannel as EndOfChannel, + Nursery as Nursery, + RunFinishedError as RunFinishedError, + TaskStatus as TaskStatus, + TrioInternalError as TrioInternalError, + WouldBlock as WouldBlock, + current_effective_deadline as current_effective_deadline, + current_time as current_time, + open_nursery as open_nursery, + run as run, +) +from ._deprecate import TrioDeprecationWarning as TrioDeprecationWarning +from ._dtls import ( + DTLSChannel as DTLSChannel, + DTLSChannelStatistics as DTLSChannelStatistics, + DTLSEndpoint as DTLSEndpoint, +) +from ._file_io import open_file as open_file, wrap_file as wrap_file +from ._highlevel_generic import ( + StapledStream as StapledStream, + aclose_forcefully as aclose_forcefully, +) +from ._highlevel_open_tcp_listeners import ( + open_tcp_listeners as open_tcp_listeners, + serve_tcp as serve_tcp, +) +from ._highlevel_open_tcp_stream import open_tcp_stream as open_tcp_stream +from ._highlevel_open_unix_stream import open_unix_socket as open_unix_socket +from ._highlevel_serve_listeners import serve_listeners as serve_listeners +from ._highlevel_socket import ( + SocketListener as SocketListener, + SocketStream as SocketStream, +) +from ._highlevel_ssl_helpers import ( + open_ssl_over_tcp_listeners as open_ssl_over_tcp_listeners, + open_ssl_over_tcp_stream as open_ssl_over_tcp_stream, + serve_ssl_over_tcp as serve_ssl_over_tcp, +) +from ._path import Path as Path, PosixPath as PosixPath, WindowsPath as WindowsPath +from ._signals import open_signal_receiver as open_signal_receiver +from ._ssl import ( + NeedHandshakeError as NeedHandshakeError, + SSLListener as SSLListener, + SSLStream as SSLStream, +) +from ._subprocess import Process as Process, run_process as run_process +from ._sync import ( + CapacityLimiter as CapacityLimiter, + CapacityLimiterStatistics as CapacityLimiterStatistics, + Condition as Condition, + ConditionStatistics as ConditionStatistics, + Event as Event, + EventStatistics as EventStatistics, + Lock as Lock, + LockStatistics as LockStatistics, + Semaphore as Semaphore, + StrictFIFOLock as StrictFIFOLock, +) +from ._timeouts import ( + TooSlowError as TooSlowError, + fail_after as fail_after, + fail_at as fail_at, + move_on_after as move_on_after, + move_on_at as move_on_at, + sleep as sleep, + sleep_forever as sleep_forever, + sleep_until as sleep_until, +) +from ._version import __version__ as __version__ + +# Not imported by default, but mentioned here so static analysis tools like +# pylint will know that it exists. +if TYPE_CHECKING: + from . import testing + +from . import _deprecate as _deprecate + +_deprecate.deprecate_attributes(__name__, {}) + +# Having the public path in .__module__ attributes is important for: +# - exception names in printed tracebacks +# - sphinx :show-inheritance: +# - deprecation warnings +# - pickle +# - probably other stuff +from ._util import fixup_module_metadata + +fixup_module_metadata(__name__, globals()) +fixup_module_metadata(lowlevel.__name__, lowlevel.__dict__) +fixup_module_metadata(socket.__name__, socket.__dict__) +fixup_module_metadata(abc.__name__, abc.__dict__) +fixup_module_metadata(from_thread.__name__, from_thread.__dict__) +fixup_module_metadata(to_thread.__name__, to_thread.__dict__) +del fixup_module_metadata +del TYPE_CHECKING diff --git a/contrib/python/trio/trio/__main__.py b/contrib/python/trio/trio/__main__.py new file mode 100644 index 000000000000..3b7c898ad503 --- /dev/null +++ b/contrib/python/trio/trio/__main__.py @@ -0,0 +1,3 @@ +from trio._repl import main + +main(locals()) diff --git a/contrib/python/trio/trio/_abc.py b/contrib/python/trio/trio/_abc.py new file mode 100644 index 000000000000..abb68243810b --- /dev/null +++ b/contrib/python/trio/trio/_abc.py @@ -0,0 +1,714 @@ +from __future__ import annotations + +import socket +from abc import ABC, abstractmethod +from typing import TYPE_CHECKING, Generic, TypeVar + +import trio + +if TYPE_CHECKING: + from types import TracebackType + + from typing_extensions import Self + + # both of these introduce circular imports if outside a TYPE_CHECKING guard + from ._socket import SocketType + from .lowlevel import Task + + +class Clock(ABC): + """The interface for custom run loop clocks.""" + + __slots__ = () + + @abstractmethod + def start_clock(self) -> None: + """Do any setup this clock might need. + + Called at the beginning of the run. + + """ + + @abstractmethod + def current_time(self) -> float: + """Return the current time, according to this clock. + + This is used to implement functions like :func:`trio.current_time` and + :func:`trio.move_on_after`. + + Returns: + float: The current time. + + """ + + @abstractmethod + def deadline_to_sleep_time(self, deadline: float) -> float: + """Compute the real time until the given deadline. + + This is called before we enter a system-specific wait function like + :func:`select.select`, to get the timeout to pass. + + For a clock using wall-time, this should be something like:: + + return deadline - self.current_time() + + but of course it may be different if you're implementing some kind of + virtual clock. + + Args: + deadline (float): The absolute time of the next deadline, + according to this clock. + + Returns: + float: The number of real seconds to sleep until the given + deadline. May be :data:`math.inf`. + + """ + + +class Instrument(ABC): # noqa: B024 # conceptually is ABC + """The interface for run loop instrumentation. + + Instruments don't have to inherit from this abstract base class, and all + of these methods are optional. This class serves mostly as documentation. + + """ + + __slots__ = () + + def before_run(self) -> None: + """Called at the beginning of :func:`trio.run`.""" + return + + def after_run(self) -> None: + """Called just before :func:`trio.run` returns.""" + return + + def task_spawned(self, task: Task) -> None: + """Called when the given task is created. + + Args: + task (trio.lowlevel.Task): The new task. + + """ + return + + def task_scheduled(self, task: Task) -> None: + """Called when the given task becomes runnable. + + It may still be some time before it actually runs, if there are other + runnable tasks ahead of it. + + Args: + task (trio.lowlevel.Task): The task that became runnable. + + """ + return + + def before_task_step(self, task: Task) -> None: + """Called immediately before we resume running the given task. + + Args: + task (trio.lowlevel.Task): The task that is about to run. + + """ + return + + def after_task_step(self, task: Task) -> None: + """Called when we return to the main run loop after a task has yielded. + + Args: + task (trio.lowlevel.Task): The task that just ran. + + """ + return + + def task_exited(self, task: Task) -> None: + """Called when the given task exits. + + Args: + task (trio.lowlevel.Task): The finished task. + + """ + return + + def before_io_wait(self, timeout: float) -> None: + """Called before blocking to wait for I/O readiness. + + Args: + timeout (float): The number of seconds we are willing to wait. + + """ + return + + def after_io_wait(self, timeout: float) -> None: + """Called after handling pending I/O. + + Args: + timeout (float): The number of seconds we were willing to + wait. This much time may or may not have elapsed, depending on + whether any I/O was ready. + + """ + return + + +class HostnameResolver(ABC): + """If you have a custom hostname resolver, then implementing + :class:`HostnameResolver` allows you to register this to be used by Trio. + + See :func:`trio.socket.set_custom_hostname_resolver`. + + """ + + __slots__ = () + + @abstractmethod + async def getaddrinfo( + self, + host: bytes | None, + port: bytes | str | int | None, + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, + ) -> list[ + tuple[ + socket.AddressFamily, + socket.SocketKind, + int, + str, + tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], + ] + ]: + """A custom implementation of :func:`~trio.socket.getaddrinfo`. + + Called by :func:`trio.socket.getaddrinfo`. + + If ``host`` is given as a numeric IP address, then + :func:`~trio.socket.getaddrinfo` may handle the request itself rather + than calling this method. + + Any required IDNA encoding is handled before calling this function; + your implementation can assume that it will never see U-labels like + ``"café.com"``, and only needs to handle A-labels like + ``b"xn--caf-dma.com"``.""" # spellchecker:disable-line + + @abstractmethod + async def getnameinfo( + self, + sockaddr: tuple[str, int] | tuple[str, int, int, int], + flags: int, + ) -> tuple[str, str]: + """A custom implementation of :func:`~trio.socket.getnameinfo`. + + Called by :func:`trio.socket.getnameinfo`. + + """ + + +class SocketFactory(ABC): + """If you write a custom class implementing the Trio socket interface, + then you can use a :class:`SocketFactory` to get Trio to use it. + + See :func:`trio.socket.set_custom_socket_factory`. + + """ + + __slots__ = () + + @abstractmethod + def socket( + self, + family: socket.AddressFamily | int = socket.AF_INET, + type: socket.SocketKind | int = socket.SOCK_STREAM, + proto: int = 0, + ) -> SocketType: + """Create and return a socket object. + + Your socket object must inherit from :class:`trio.socket.SocketType`, + which is an empty class whose only purpose is to "mark" which classes + should be considered valid Trio sockets. + + Called by :func:`trio.socket.socket`. + + Note that unlike :func:`trio.socket.socket`, this does not take a + ``fileno=`` argument. If a ``fileno=`` is specified, then + :func:`trio.socket.socket` returns a regular Trio socket object + instead of calling this method. + + """ + + +class AsyncResource(ABC): + """A standard interface for resources that needs to be cleaned up, and + where that cleanup may require blocking operations. + + This class distinguishes between "graceful" closes, which may perform I/O + and thus block, and a "forceful" close, which cannot. For example, cleanly + shutting down a TLS-encrypted connection requires sending a "goodbye" + message; but if a peer has become non-responsive, then sending this + message might block forever, so we may want to just drop the connection + instead. Therefore the :meth:`aclose` method is unusual in that it + should always close the connection (or at least make its best attempt) + *even if it fails*; failure indicates a failure to achieve grace, not a + failure to close the connection. + + Objects that implement this interface can be used as async context + managers, i.e., you can write:: + + async with create_resource() as some_async_resource: + ... + + Entering the context manager is synchronous (not a checkpoint); exiting it + calls :meth:`aclose`. The default implementations of + ``__aenter__`` and ``__aexit__`` should be adequate for all subclasses. + + """ + + __slots__ = () + + @abstractmethod + async def aclose(self) -> None: + """Close this resource, possibly blocking. + + IMPORTANT: This method may block in order to perform a "graceful" + shutdown. But, if this fails, then it still *must* close any + underlying resources before returning. An error from this method + indicates a failure to achieve grace, *not* a failure to close the + connection. + + For example, suppose we call :meth:`aclose` on a TLS-encrypted + connection. This requires sending a "goodbye" message; but if the peer + has become non-responsive, then our attempt to send this message might + block forever, and eventually time out and be cancelled. In this case + the :meth:`aclose` method on :class:`~trio.SSLStream` will + immediately close the underlying transport stream using + :func:`trio.aclose_forcefully` before raising :exc:`~trio.Cancelled`. + + If the resource is already closed, then this method should silently + succeed. + + Once this method completes, any other pending or future operations on + this resource should generally raise :exc:`~trio.ClosedResourceError`, + unless there's a good reason to do otherwise. + + See also: :func:`trio.aclose_forcefully`. + + """ + + async def __aenter__(self) -> Self: + return self + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + await self.aclose() + + +class SendStream(AsyncResource): + """A standard interface for sending data on a byte stream. + + The underlying stream may be unidirectional, or bidirectional. If it's + bidirectional, then you probably want to also implement + :class:`ReceiveStream`, which makes your object a :class:`Stream`. + + :class:`SendStream` objects also implement the :class:`AsyncResource` + interface, so they can be closed by calling :meth:`~AsyncResource.aclose` + or using an ``async with`` block. + + If you want to send Python objects rather than raw bytes, see + :class:`SendChannel`. + + """ + + __slots__ = () + + @abstractmethod + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + """Sends the given data through the stream, blocking if necessary. + + Args: + data (bytes, bytearray, or memoryview): The data to send. + + Raises: + trio.BusyResourceError: if another task is already executing a + :meth:`send_all`, :meth:`wait_send_all_might_not_block`, or + :meth:`HalfCloseableStream.send_eof` on this stream. + trio.BrokenResourceError: if something has gone wrong, and the stream + is broken. + trio.ClosedResourceError: if you previously closed this stream + object, or if another task closes this stream object while + :meth:`send_all` is running. + + Most low-level operations in Trio provide a guarantee: if they raise + :exc:`trio.Cancelled`, this means that they had no effect, so the + system remains in a known state. This is **not true** for + :meth:`send_all`. If this operation raises :exc:`trio.Cancelled` (or + any other exception for that matter), then it may have sent some, all, + or none of the requested data, and there is no way to know which. + + """ + + @abstractmethod + async def wait_send_all_might_not_block(self) -> None: + """Block until it's possible that :meth:`send_all` might not block. + + This method may return early: it's possible that after it returns, + :meth:`send_all` will still block. (In the worst case, if no better + implementation is available, then it might always return immediately + without blocking. It's nice to do better than that when possible, + though.) + + This method **must not** return *late*: if it's possible for + :meth:`send_all` to complete without blocking, then it must + return. When implementing it, err on the side of returning early. + + Raises: + trio.BusyResourceError: if another task is already executing a + :meth:`send_all`, :meth:`wait_send_all_might_not_block`, or + :meth:`HalfCloseableStream.send_eof` on this stream. + trio.BrokenResourceError: if something has gone wrong, and the stream + is broken. + trio.ClosedResourceError: if you previously closed this stream + object, or if another task closes this stream object while + :meth:`wait_send_all_might_not_block` is running. + + Note: + + This method is intended to aid in implementing protocols that want + to delay choosing which data to send until the last moment. E.g., + suppose you're working on an implementation of a remote display server + like `VNC + `__, and + the network connection is currently backed up so that if you call + :meth:`send_all` now then it will sit for 0.5 seconds before actually + sending anything. In this case it doesn't make sense to take a + screenshot, then wait 0.5 seconds, and then send it, because the + screen will keep changing while you wait; it's better to wait 0.5 + seconds, then take the screenshot, and then send it, because this + way the data you deliver will be more + up-to-date. Using :meth:`wait_send_all_might_not_block` makes it + possible to implement the better strategy. + + If you use this method, you might also want to read up on + ``TCP_NOTSENT_LOWAT``. + + Further reading: + + * `Prioritization Only Works When There's Pending Data to Prioritize + `__ + + * WWDC 2015: Your App and Next Generation Networks: `slides + `__, + `video and transcript + `__ + + """ + + +class ReceiveStream(AsyncResource): + """A standard interface for receiving data on a byte stream. + + The underlying stream may be unidirectional, or bidirectional. If it's + bidirectional, then you probably want to also implement + :class:`SendStream`, which makes your object a :class:`Stream`. + + :class:`ReceiveStream` objects also implement the :class:`AsyncResource` + interface, so they can be closed by calling :meth:`~AsyncResource.aclose` + or using an ``async with`` block. + + If you want to receive Python objects rather than raw bytes, see + :class:`ReceiveChannel`. + + `ReceiveStream` objects can be used in ``async for`` loops. Each iteration + will produce an arbitrary sized chunk of bytes, like calling + `receive_some` with no arguments. Every chunk will contain at least one + byte, and the loop automatically exits when reaching end-of-file. + + """ + + __slots__ = () + + @abstractmethod + async def receive_some(self, max_bytes: int | None = None) -> bytes | bytearray: + """Wait until there is data available on this stream, and then return + some of it. + + A return value of ``b""`` (an empty bytestring) indicates that the + stream has reached end-of-file. Implementations should be careful that + they return ``b""`` if, and only if, the stream has reached + end-of-file! + + Args: + max_bytes (int): The maximum number of bytes to return. Must be + greater than zero. Optional; if omitted, then the stream object + is free to pick a reasonable default. + + Returns: + bytes or bytearray: The data received. + + Raises: + trio.BusyResourceError: if two tasks attempt to call + :meth:`receive_some` on the same stream at the same time. + trio.BrokenResourceError: if something has gone wrong, and the stream + is broken. + trio.ClosedResourceError: if you previously closed this stream + object, or if another task closes this stream object while + :meth:`receive_some` is running. + + """ + + def __aiter__(self) -> Self: + return self + + async def __anext__(self) -> bytes | bytearray: + data = await self.receive_some() + if not data: + raise StopAsyncIteration + return data + + +class Stream(SendStream, ReceiveStream): + """A standard interface for interacting with bidirectional byte streams. + + A :class:`Stream` is an object that implements both the + :class:`SendStream` and :class:`ReceiveStream` interfaces. + + If implementing this interface, you should consider whether you can go one + step further and implement :class:`HalfCloseableStream`. + + """ + + __slots__ = () + + +class HalfCloseableStream(Stream): + """This interface extends :class:`Stream` to also allow closing the send + part of the stream without closing the receive part. + + """ + + __slots__ = () + + @abstractmethod + async def send_eof(self) -> None: + """Send an end-of-file indication on this stream, if possible. + + The difference between :meth:`send_eof` and + :meth:`~AsyncResource.aclose` is that :meth:`send_eof` is a + *unidirectional* end-of-file indication. After you call this method, + you shouldn't try sending any more data on this stream, and your + remote peer should receive an end-of-file indication (eventually, + after receiving all the data you sent before that). But, they may + continue to send data to you, and you can continue to receive it by + calling :meth:`~ReceiveStream.receive_some`. You can think of it as + calling :meth:`~AsyncResource.aclose` on just the + :class:`SendStream` "half" of the stream object (and in fact that's + literally how :class:`trio.StapledStream` implements it). + + Examples: + + * On a socket, this corresponds to ``shutdown(..., SHUT_WR)`` (`man + page `__). + + * The SSH protocol provides the ability to multiplex bidirectional + "channels" on top of a single encrypted connection. A Trio + implementation of SSH could expose these channels as + :class:`HalfCloseableStream` objects, and calling :meth:`send_eof` + would send an ``SSH_MSG_CHANNEL_EOF`` request (see `RFC 4254 §5.3 + `__). + + * On an SSL/TLS-encrypted connection, the protocol doesn't provide any + way to do a unidirectional shutdown without closing the connection + entirely, so :class:`~trio.SSLStream` implements + :class:`Stream`, not :class:`HalfCloseableStream`. + + If an EOF has already been sent, then this method should silently + succeed. + + Raises: + trio.BusyResourceError: if another task is already executing a + :meth:`~SendStream.send_all`, + :meth:`~SendStream.wait_send_all_might_not_block`, or + :meth:`send_eof` on this stream. + trio.BrokenResourceError: if something has gone wrong, and the stream + is broken. + trio.ClosedResourceError: if you previously closed this stream + object, or if another task closes this stream object while + :meth:`send_eof` is running. + + """ + + +# A regular invariant generic type +T = TypeVar("T") + +# The type of object produced by a ReceiveChannel (covariant because +# ReceiveChannel[Derived] can be passed to someone expecting +# ReceiveChannel[Base]) +ReceiveType = TypeVar("ReceiveType", covariant=True) + +# The type of object accepted by a SendChannel (contravariant because +# SendChannel[Base] can be passed to someone expecting +# SendChannel[Derived]) +SendType = TypeVar("SendType", contravariant=True) + +# The type of object produced by a Listener (covariant plus must be +# an AsyncResource) +T_resource = TypeVar("T_resource", bound=AsyncResource, covariant=True) + + +class Listener(AsyncResource, Generic[T_resource]): + """A standard interface for listening for incoming connections. + + :class:`Listener` objects also implement the :class:`AsyncResource` + interface, so they can be closed by calling :meth:`~AsyncResource.aclose` + or using an ``async with`` block. + + """ + + __slots__ = () + + @abstractmethod + async def accept(self) -> T_resource: + """Wait until an incoming connection arrives, and then return it. + + Returns: + AsyncResource: An object representing the incoming connection. In + practice this is generally some kind of :class:`Stream`, + but in principle you could also define a :class:`Listener` that + returned, say, channel objects. + + Raises: + trio.BusyResourceError: if two tasks attempt to call + :meth:`accept` on the same listener at the same time. + trio.ClosedResourceError: if you previously closed this listener + object, or if another task closes this listener object while + :meth:`accept` is running. + + Listeners don't generally raise :exc:`~trio.BrokenResourceError`, + because for listeners there is no general condition of "the + network/remote peer broke the connection" that can be handled in a + generic way, like there is for streams. Other errors *can* occur and + be raised from :meth:`accept` – for example, if you run out of file + descriptors then you might get an :class:`OSError` with its errno set + to ``EMFILE``. + + """ + + +class SendChannel(AsyncResource, Generic[SendType]): + """A standard interface for sending Python objects to some receiver. + + `SendChannel` objects also implement the `AsyncResource` interface, so + they can be closed by calling `~AsyncResource.aclose` or using an ``async + with`` block. + + If you want to send raw bytes rather than Python objects, see + `SendStream`. + + """ + + __slots__ = () + + @abstractmethod + async def send(self, value: SendType) -> None: + """Attempt to send an object through the channel, blocking if necessary. + + Args: + value (object): The object to send. + + Raises: + trio.BrokenResourceError: if something has gone wrong, and the + channel is broken. For example, you may get this if the receiver + has already been closed. + trio.ClosedResourceError: if you previously closed this + :class:`SendChannel` object, or if another task closes it while + :meth:`send` is running. + trio.BusyResourceError: some channels allow multiple tasks to call + `send` at the same time, but others don't. If you try to call + `send` simultaneously from multiple tasks on a channel that + doesn't support it, then you can get `~trio.BusyResourceError`. + + """ + + +class ReceiveChannel(AsyncResource, Generic[ReceiveType]): + """A standard interface for receiving Python objects from some sender. + + You can iterate over a :class:`ReceiveChannel` using an ``async for`` + loop:: + + async for value in receive_channel: + ... + + This is equivalent to calling :meth:`receive` repeatedly. The loop exits + without error when `receive` raises `~trio.EndOfChannel`. + + `ReceiveChannel` objects also implement the `AsyncResource` interface, so + they can be closed by calling `~AsyncResource.aclose` or using an ``async + with`` block. + + If you want to receive raw bytes rather than Python objects, see + `ReceiveStream`. + + """ + + __slots__ = () + + @abstractmethod + async def receive(self) -> ReceiveType: + """Attempt to receive an incoming object, blocking if necessary. + + Returns: + object: Whatever object was received. + + Raises: + trio.EndOfChannel: if the sender has been closed cleanly, and no + more objects are coming. This is not an error condition. + trio.ClosedResourceError: if you previously closed this + :class:`ReceiveChannel` object. + trio.BrokenResourceError: if something has gone wrong, and the + channel is broken. + trio.BusyResourceError: some channels allow multiple tasks to call + `receive` at the same time, but others don't. If you try to call + `receive` simultaneously from multiple tasks on a channel that + doesn't support it, then you can get `~trio.BusyResourceError`. + + """ + + def __aiter__(self) -> Self: + return self + + async def __anext__(self) -> ReceiveType: + try: + return await self.receive() + except trio.EndOfChannel: + raise StopAsyncIteration from None + + +# these are necessary for Sphinx's :show-inheritance: with type args. +# (this should be removed if possible) +# see: https://github.com/python/cpython/issues/123250 +SendChannel.__module__ = SendChannel.__module__.replace("_abc", "abc") +ReceiveChannel.__module__ = ReceiveChannel.__module__.replace("_abc", "abc") +Listener.__module__ = Listener.__module__.replace("_abc", "abc") + + +class Channel(SendChannel[T], ReceiveChannel[T]): + """A standard interface for interacting with bidirectional channels. + + A `Channel` is an object that implements both the `SendChannel` and + `ReceiveChannel` interfaces, so you can both send and receive objects. + + """ + + __slots__ = () + + +# see above +Channel.__module__ = Channel.__module__.replace("_abc", "abc") diff --git a/contrib/python/trio/trio/_channel.py b/contrib/python/trio/trio/_channel.py new file mode 100644 index 000000000000..2afca9d7cdb1 --- /dev/null +++ b/contrib/python/trio/trio/_channel.py @@ -0,0 +1,615 @@ +from __future__ import annotations + +import sys +from collections import OrderedDict, deque +from collections.abc import AsyncGenerator, Callable # noqa: TC003 # Needed for Sphinx +from contextlib import AbstractAsyncContextManager, asynccontextmanager +from functools import wraps +from math import inf +from typing import ( + TYPE_CHECKING, + Generic, +) + +import attrs +from outcome import Error, Value + +import trio + +from ._abc import ReceiveChannel, ReceiveType, SendChannel, SendType, T +from ._core import Abort, RaiseCancelT, Task, enable_ki_protection +from ._util import ( + MultipleExceptionError, + NoPublicConstructor, + final, + generic_function, + raise_single_exception_from_group, +) + +if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup + +if TYPE_CHECKING: + from types import TracebackType + + from typing_extensions import ParamSpec, Self + + P = ParamSpec("P") +elif "sphinx.ext.autodoc" in sys.modules: + # P needs to exist for Sphinx to parse the type hints successfully. + try: + from typing_extensions import ParamSpec + except ImportError: + P = ... # This is valid in Callable, though not correct + else: + P = ParamSpec("P") + + +def _open_memory_channel( + max_buffer_size: int | float, # noqa: PYI041 +) -> tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]: + """Open a channel for passing objects between tasks within a process. + + Memory channels are lightweight, cheap to allocate, and entirely + in-memory. They don't involve any operating-system resources, or any kind + of serialization. They just pass Python objects directly between tasks + (with a possible stop in an internal buffer along the way). + + Channel objects can be closed by calling `~trio.abc.AsyncResource.aclose` + or using ``async with``. They are *not* automatically closed when garbage + collected. Closing memory channels isn't mandatory, but it is generally a + good idea, because it helps avoid situations where tasks get stuck waiting + on a channel when there's no-one on the other side. See + :ref:`channel-shutdown` for details. + + Memory channel operations are all atomic with respect to + cancellation, either `~trio.abc.ReceiveChannel.receive` will + successfully return an object, or it will raise :exc:`Cancelled` + while leaving the channel unchanged. + + Args: + max_buffer_size (int or math.inf): The maximum number of items that can + be buffered in the channel before :meth:`~trio.abc.SendChannel.send` + blocks. Choosing a sensible value here is important to ensure that + backpressure is communicated promptly and avoid unnecessary latency; + see :ref:`channel-buffering` for more details. If in doubt, use 0. + + Returns: + A pair ``(send_channel, receive_channel)``. If you have + trouble remembering which order these go in, remember: data + flows from left → right. + + In addition to the standard channel methods, all memory channel objects + provide a ``statistics()`` method, which returns an object with the + following fields: + + * ``current_buffer_used``: The number of items currently stored in the + channel buffer. + * ``max_buffer_size``: The maximum number of items allowed in the buffer, + as passed to :func:`open_memory_channel`. + * ``open_send_channels``: The number of open + :class:`MemorySendChannel` endpoints pointing to this channel. + Initially 1, but can be increased by + :meth:`MemorySendChannel.clone`. + * ``open_receive_channels``: Likewise, but for open + :class:`MemoryReceiveChannel` endpoints. + * ``tasks_waiting_send``: The number of tasks blocked in ``send`` on this + channel (summing over all clones). + * ``tasks_waiting_receive``: The number of tasks blocked in ``receive`` on + this channel (summing over all clones). + + """ + if max_buffer_size != inf and not isinstance(max_buffer_size, int): + raise TypeError("max_buffer_size must be an integer or math.inf") + if max_buffer_size < 0: + raise ValueError("max_buffer_size must be >= 0") + state: MemoryChannelState[T] = MemoryChannelState(max_buffer_size) + return ( + MemorySendChannel[T]._create(state), + MemoryReceiveChannel[T]._create(state), + ) + + +# This workaround requires python3.9+, once older python versions are not supported +# or there's a better way of achieving type-checking on a generic factory function, +# it could replace the normal function header +if TYPE_CHECKING: + # written as a class so you can say open_memory_channel[int](5) + class open_memory_channel(tuple["MemorySendChannel[T]", "MemoryReceiveChannel[T]"]): + def __new__( # type: ignore[misc] # "must return a subtype" + cls, + max_buffer_size: int | float, # noqa: PYI041 + ) -> tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]: + return _open_memory_channel(max_buffer_size) + + def __init__(self, max_buffer_size: int | float) -> None: # noqa: PYI041 + ... + +else: + # apply the generic_function decorator to make open_memory_channel indexable + # so it's valid to say e.g. ``open_memory_channel[bytes](5)`` at runtime + open_memory_channel = generic_function(_open_memory_channel) + + +@attrs.frozen +class MemoryChannelStatistics: + current_buffer_used: int + max_buffer_size: int | float + open_send_channels: int + open_receive_channels: int + tasks_waiting_send: int + tasks_waiting_receive: int + + +@attrs.define +class MemoryChannelState(Generic[T]): + max_buffer_size: int | float + data: deque[T] = attrs.Factory(deque) + # Counts of open endpoints using this state + open_send_channels: int = 0 + open_receive_channels: int = 0 + # {task: value} + send_tasks: OrderedDict[Task, T] = attrs.Factory(OrderedDict) + # {task: None} + receive_tasks: OrderedDict[Task, None] = attrs.Factory(OrderedDict) + + def statistics(self) -> MemoryChannelStatistics: + return MemoryChannelStatistics( + current_buffer_used=len(self.data), + max_buffer_size=self.max_buffer_size, + open_send_channels=self.open_send_channels, + open_receive_channels=self.open_receive_channels, + tasks_waiting_send=len(self.send_tasks), + tasks_waiting_receive=len(self.receive_tasks), + ) + + +@final +@attrs.define(eq=False, repr=False, slots=False) +class MemorySendChannel(SendChannel[SendType], metaclass=NoPublicConstructor): + _state: MemoryChannelState[SendType] + _closed: bool = False + # This is just the tasks waiting on *this* object. As compared to + # self._state.send_tasks, which includes tasks from this object and + # all clones. + _tasks: set[Task] = attrs.Factory(set) + + def __attrs_post_init__(self) -> None: + self._state.open_send_channels += 1 + + def __repr__(self) -> str: + return f"" + + def statistics(self) -> MemoryChannelStatistics: + """Returns a `MemoryChannelStatistics` for the memory channel this is + associated with.""" + # XX should we also report statistics specific to this object? + return self._state.statistics() + + @enable_ki_protection + def send_nowait(self, value: SendType) -> None: + """Like `~trio.abc.SendChannel.send`, but if the channel's buffer is + full, raises `WouldBlock` instead of blocking. + + """ + if self._closed: + raise trio.ClosedResourceError + if self._state.open_receive_channels == 0: + raise trio.BrokenResourceError + if self._state.receive_tasks: + assert not self._state.data + task, _ = self._state.receive_tasks.popitem(last=False) + task.custom_sleep_data._tasks.remove(task) + trio.lowlevel.reschedule(task, Value(value)) + elif len(self._state.data) < self._state.max_buffer_size: + self._state.data.append(value) + else: + raise trio.WouldBlock + + @enable_ki_protection + async def send(self, value: SendType) -> None: + """See `SendChannel.send `. + + Memory channels allow multiple tasks to call `send` at the same time. + + """ + await trio.lowlevel.checkpoint_if_cancelled() + try: + self.send_nowait(value) + except trio.WouldBlock: + pass + else: + await trio.lowlevel.cancel_shielded_checkpoint() + return + + task = trio.lowlevel.current_task() + self._tasks.add(task) + self._state.send_tasks[task] = value + task.custom_sleep_data = self + + def abort_fn(_: RaiseCancelT) -> Abort: + self._tasks.remove(task) + del self._state.send_tasks[task] + return trio.lowlevel.Abort.SUCCEEDED + + await trio.lowlevel.wait_task_rescheduled(abort_fn) + + # Return type must be stringified or use a TypeVar + @enable_ki_protection + def clone(self) -> MemorySendChannel[SendType]: + """Clone this send channel object. + + This returns a new `MemorySendChannel` object, which acts as a + duplicate of the original: sending on the new object does exactly the + same thing as sending on the old object. (If you're familiar with + `os.dup`, then this is a similar idea.) + + However, closing one of the objects does not close the other, and + receivers don't get `EndOfChannel` until *all* clones have been + closed. + + This is useful for communication patterns that involve multiple + producers all sending objects to the same destination. If you give + each producer its own clone of the `MemorySendChannel`, and then make + sure to close each `MemorySendChannel` when it's finished, receivers + will automatically get notified when all producers are finished. See + :ref:`channel-mpmc` for examples. + + Raises: + trio.ClosedResourceError: if you already closed this + `MemorySendChannel` object. + + """ + if self._closed: + raise trio.ClosedResourceError + return MemorySendChannel._create(self._state) + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self.close() + + @enable_ki_protection + def close(self) -> None: + """Close this send channel object synchronously. + + All channel objects have an asynchronous `~.AsyncResource.aclose` method. + Memory channels can also be closed synchronously. This has the same + effect on the channel and other tasks using it, but `close` is not a + trio checkpoint. This simplifies cleaning up in cancelled tasks. + + Using ``with send_channel:`` will close the channel object on leaving + the with block. + + """ + if self._closed: + return + self._closed = True + for task in self._tasks: + trio.lowlevel.reschedule(task, Error(trio.ClosedResourceError())) + del self._state.send_tasks[task] + self._tasks.clear() + self._state.open_send_channels -= 1 + if self._state.open_send_channels == 0: + assert not self._state.send_tasks + for task in self._state.receive_tasks: + task.custom_sleep_data._tasks.remove(task) + trio.lowlevel.reschedule(task, Error(trio.EndOfChannel())) + self._state.receive_tasks.clear() + + @enable_ki_protection + async def aclose(self) -> None: + """Close this send channel object asynchronously. + + See `MemorySendChannel.close`.""" + self.close() + await trio.lowlevel.checkpoint() + + +@final +@attrs.define(eq=False, repr=False, slots=False) +class MemoryReceiveChannel(ReceiveChannel[ReceiveType], metaclass=NoPublicConstructor): + _state: MemoryChannelState[ReceiveType] + _closed: bool = False + _tasks: set[trio._core._run.Task] = attrs.Factory(set) + + def __attrs_post_init__(self) -> None: + self._state.open_receive_channels += 1 + + def statistics(self) -> MemoryChannelStatistics: + """Returns a `MemoryChannelStatistics` for the memory channel this is + associated with.""" + return self._state.statistics() + + def __repr__(self) -> str: + return ( + f"" + ) + + @enable_ki_protection + def receive_nowait(self) -> ReceiveType: + """Like `~trio.abc.ReceiveChannel.receive`, but if there's nothing + ready to receive, raises `WouldBlock` instead of blocking. + + """ + if self._closed: + raise trio.ClosedResourceError + if self._state.send_tasks: + task, value = self._state.send_tasks.popitem(last=False) + task.custom_sleep_data._tasks.remove(task) + trio.lowlevel.reschedule(task) + self._state.data.append(value) + # Fall through + if self._state.data: + return self._state.data.popleft() + if not self._state.open_send_channels: + raise trio.EndOfChannel + raise trio.WouldBlock + + @enable_ki_protection + async def receive(self) -> ReceiveType: + """See `ReceiveChannel.receive `. + + Memory channels allow multiple tasks to call `receive` at the same + time. The first task will get the first item sent, the second task + will get the second item sent, and so on. + + """ + await trio.lowlevel.checkpoint_if_cancelled() + try: + value = self.receive_nowait() + except trio.WouldBlock: + pass + else: + await trio.lowlevel.cancel_shielded_checkpoint() + return value + + task = trio.lowlevel.current_task() + self._tasks.add(task) + self._state.receive_tasks[task] = None + task.custom_sleep_data = self + + def abort_fn(_: RaiseCancelT) -> Abort: + self._tasks.remove(task) + del self._state.receive_tasks[task] + return trio.lowlevel.Abort.SUCCEEDED + + # Not strictly guaranteed to return ReceiveType, but will do so unless + # you intentionally reschedule with a bad value. + return await trio.lowlevel.wait_task_rescheduled(abort_fn) # type: ignore[no-any-return] + + @enable_ki_protection + def clone(self) -> MemoryReceiveChannel[ReceiveType]: + """Clone this receive channel object. + + This returns a new `MemoryReceiveChannel` object, which acts as a + duplicate of the original: receiving on the new object does exactly + the same thing as receiving on the old object. + + However, closing one of the objects does not close the other, and the + underlying channel is not closed until all clones are closed. (If + you're familiar with `os.dup`, then this is a similar idea.) + + This is useful for communication patterns that involve multiple + consumers all receiving objects from the same underlying channel. See + :ref:`channel-mpmc` for examples. + + .. warning:: The clones all share the same underlying channel. + Whenever a clone :meth:`receive`\\s a value, it is removed from the + channel and the other clones do *not* receive that value. If you + want to send multiple copies of the same stream of values to + multiple destinations, like :func:`itertools.tee`, then you need to + find some other solution; this method does *not* do that. + + Raises: + trio.ClosedResourceError: if you already closed this + `MemoryReceiveChannel` object. + + """ + if self._closed: + raise trio.ClosedResourceError + return MemoryReceiveChannel._create(self._state) + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self.close() + + @enable_ki_protection + def close(self) -> None: + """Close this receive channel object synchronously. + + All channel objects have an asynchronous `~.AsyncResource.aclose` method. + Memory channels can also be closed synchronously. This has the same + effect on the channel and other tasks using it, but `close` is not a + trio checkpoint. This simplifies cleaning up in cancelled tasks. + + Using ``with receive_channel:`` will close the channel object on + leaving the with block. + + """ + if self._closed: + return + self._closed = True + for task in self._tasks: + trio.lowlevel.reschedule(task, Error(trio.ClosedResourceError())) + del self._state.receive_tasks[task] + self._tasks.clear() + self._state.open_receive_channels -= 1 + if self._state.open_receive_channels == 0: + assert not self._state.receive_tasks + for task in self._state.send_tasks: + task.custom_sleep_data._tasks.remove(task) + trio.lowlevel.reschedule(task, Error(trio.BrokenResourceError())) + self._state.send_tasks.clear() + self._state.data.clear() + + @enable_ki_protection + async def aclose(self) -> None: + """Close this receive channel object asynchronously. + + See `MemoryReceiveChannel.close`.""" + self.close() + await trio.lowlevel.checkpoint() + + +class RecvChanWrapper(ReceiveChannel[T]): + def __init__( + self, recv_chan: MemoryReceiveChannel[T], send_semaphore: trio.Semaphore + ) -> None: + self._recv_chan = recv_chan + self._send_semaphore = send_semaphore + + async def receive(self) -> T: + self._send_semaphore.release() + return await self._recv_chan.receive() + + async def aclose(self) -> None: + await self._recv_chan.aclose() + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self._recv_chan.close() + + +def as_safe_channel( + fn: Callable[P, AsyncGenerator[T, None]], +) -> Callable[P, AbstractAsyncContextManager[ReceiveChannel[T]]]: + """Decorate an async generator function to make it cancellation-safe. + + The ``yield`` keyword offers a very convenient way to write iterators... + which makes it really unfortunate that async generators are so difficult + to call correctly. Yielding from the inside of a cancel scope or a nursery + to the outside `violates structured concurrency `_ + with consequences explained in :pep:`789`. Even then, resource cleanup + errors remain common (:pep:`533`) unless you wrap every call in + :func:`~contextlib.aclosing`. + + This decorator gives you the best of both worlds: with careful exception + handling and a background task we preserve structured concurrency by + offering only the safe interface, and you can still write your iterables + with the convenience of ``yield``. For example:: + + @as_safe_channel + async def my_async_iterable(arg, *, kwarg=True): + while ...: + item = await ... + yield item + + async with my_async_iterable(...) as recv_chan: + async for item in recv_chan: + ... + + While the combined async-with-async-for can be inconvenient at first, + the context manager is indispensable for both correctness and for prompt + cleanup of resources. + """ + # Perhaps a future PEP will adopt `async with for` syntax, like + # https://coconut.readthedocs.io/en/master/DOCS.html#async-with-for + + @asynccontextmanager + @wraps(fn) + async def context_manager( + *args: P.args, **kwargs: P.kwargs + ) -> AsyncGenerator[trio._channel.RecvChanWrapper[T], None]: + send_chan, recv_chan = trio.open_memory_channel[T](0) + try: + async with trio.open_nursery(strict_exception_groups=True) as nursery: + agen = fn(*args, **kwargs) + send_semaphore = trio.Semaphore(0) + # `nursery.start` to make sure that we will clean up send_chan & agen + # If this errors we don't close `recv_chan`, but the caller + # never gets access to it, so that's not a problem. + await nursery.start( + _move_elems_to_channel, agen, send_chan, send_semaphore + ) + # `async with recv_chan` could eat exceptions, so use sync cm + with RecvChanWrapper(recv_chan, send_semaphore) as wrapped_recv_chan: + yield wrapped_recv_chan + # User has exited context manager, cancel to immediately close the + # abandoned generator if it's still alive. + nursery.cancel_scope.cancel( + "exited trio.as_safe_channel context manager" + ) + except BaseExceptionGroup as eg: + try: + raise_single_exception_from_group(eg) + except MultipleExceptionError: + # In case user has except* we make it possible for them to handle the + # exceptions. + raise BaseExceptionGroup( + "Encountered exception during cleanup of generator object, as well as exception in the contextmanager body - unable to unwrap.", + [eg], + ) from None + + async def _move_elems_to_channel( + agen: AsyncGenerator[T, None], + send_chan: trio.MemorySendChannel[T], + send_semaphore: trio.Semaphore, + task_status: trio.TaskStatus, + ) -> None: + # `async with send_chan` will eat exceptions, + # see https://github.com/python-trio/trio/issues/1559 + with send_chan: + # replace try-finally with contextlib.aclosing once python39 is + # dropped: + try: + task_status.started() + while True: + # wait for receiver to call next on the aiter + await send_semaphore.acquire() + try: + value = await agen.__anext__() + except StopAsyncIteration: + return + # Send the value to the channel + await send_chan.send(value) + finally: + # work around `.aclose()` not suppressing GeneratorExit in an + # ExceptionGroup: + # TODO: make an issue on CPython about this + try: + await agen.aclose() + except BaseExceptionGroup as exceptions: + removed, narrowed_exceptions = exceptions.split(GeneratorExit) + + # TODO: extract a helper to flatten exception groups + removed_exceptions: list[BaseException | None] = [removed] + genexits_seen = 0 + for e in removed_exceptions: + if isinstance(e, BaseExceptionGroup): + removed_exceptions.extend(e.exceptions) # noqa: B909 + else: + genexits_seen += 1 + + if genexits_seen > 1: + exc = AssertionError("More than one GeneratorExit found.") + if narrowed_exceptions is None: + narrowed_exceptions = exceptions.derive([exc]) + else: + narrowed_exceptions = narrowed_exceptions.derive( + [*narrowed_exceptions.exceptions, exc] + ) + if narrowed_exceptions is not None: + raise narrowed_exceptions from None + + return context_manager diff --git a/contrib/python/trio/trio/_core/__init__.py b/contrib/python/trio/trio/_core/__init__.py new file mode 100644 index 000000000000..f9d8068f0cca --- /dev/null +++ b/contrib/python/trio/trio/_core/__init__.py @@ -0,0 +1,94 @@ +""" +This namespace represents the core functionality that has to be built-in +and deal with private internal data structures. Things in this namespace +are publicly available in either trio, trio.lowlevel, or trio.testing. +""" + +import sys +import typing as _t + +from ._entry_queue import TrioToken +from ._exceptions import ( + BrokenResourceError, + BusyResourceError, + Cancelled, + ClosedResourceError, + EndOfChannel, + RunFinishedError, + TrioInternalError, + WouldBlock, +) +from ._ki import currently_ki_protected, disable_ki_protection, enable_ki_protection +from ._local import RunVar, RunVarToken +from ._mock_clock import MockClock +from ._parking_lot import ( + ParkingLot, + ParkingLotStatistics, + add_parking_lot_breaker, + remove_parking_lot_breaker, +) + +# Imports that always exist +from ._run import ( + TASK_STATUS_IGNORED, + CancelScope, + Nursery, + RunStatistics, + Task, + TaskStatus, + add_instrument, + checkpoint, + checkpoint_if_cancelled, + current_clock, + current_effective_deadline, + current_root_task, + current_statistics, + current_task, + current_time, + current_trio_token, + in_trio_run, + in_trio_task, + notify_closing, + open_nursery, + remove_instrument, + reschedule, + run, + spawn_system_task, + start_guest_run, + wait_all_tasks_blocked, + wait_readable, + wait_writable, +) +from ._thread_cache import start_thread_soon + +# Has to come after _run to resolve a circular import +from ._traps import ( + Abort, + RaiseCancelT, + cancel_shielded_checkpoint, + permanently_detach_coroutine_object, + reattach_detached_coroutine_object, + temporarily_detach_coroutine_object, + wait_task_rescheduled, +) +from ._unbounded_queue import UnboundedQueue, UnboundedQueueStatistics + +# Windows imports +if sys.platform == "win32" or ( + not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules +): + from ._run import ( + current_iocp, + monitor_completion_key, + readinto_overlapped, + register_with_iocp, + wait_overlapped, + write_overlapped, + ) +# Kqueue imports +if (sys.platform != "linux" and sys.platform != "win32") or ( + not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules +): + from ._run import current_kqueue, monitor_kevent, wait_kevent + +del sys # It would be better to import sys as _sys, but mypy does not understand it diff --git a/contrib/python/trio/trio/_core/_asyncgens.py b/contrib/python/trio/trio/_core/_asyncgens.py new file mode 100644 index 000000000000..fea41e0e4de0 --- /dev/null +++ b/contrib/python/trio/trio/_core/_asyncgens.py @@ -0,0 +1,243 @@ +from __future__ import annotations + +import logging +import sys +import warnings +import weakref +from typing import TYPE_CHECKING, NoReturn, TypeVar + +import attrs + +from .. import _core +from .._util import name_asyncgen +from . import _run + +# Used to log exceptions in async generator finalizers +ASYNCGEN_LOGGER = logging.getLogger("trio.async_generator_errors") + +if TYPE_CHECKING: + from collections.abc import Callable + from types import AsyncGeneratorType + + from typing_extensions import ParamSpec + + _P = ParamSpec("_P") + + _WEAK_ASYNC_GEN_SET = weakref.WeakSet[AsyncGeneratorType[object, NoReturn]] + _ASYNC_GEN_SET = set[AsyncGeneratorType[object, NoReturn]] +else: + _WEAK_ASYNC_GEN_SET = weakref.WeakSet + _ASYNC_GEN_SET = set + +_R = TypeVar("_R") + + +@_core.disable_ki_protection +def _call_without_ki_protection( + f: Callable[_P, _R], + /, + *args: _P.args, + **kwargs: _P.kwargs, +) -> _R: + return f(*args, **kwargs) + + +@attrs.define(eq=False) +class AsyncGenerators: + # Async generators are added to this set when first iterated. Any + # left after the main task exits will be closed before trio.run() + # returns. During most of the run, this is a WeakSet so GC works. + # During shutdown, when we're finalizing all the remaining + # asyncgens after the system nursery has been closed, it's a + # regular set so we don't have to deal with GC firing at + # unexpected times. + alive: _WEAK_ASYNC_GEN_SET | _ASYNC_GEN_SET = attrs.Factory(_WEAK_ASYNC_GEN_SET) + # The ids of foreign async generators are added to this set when first + # iterated. Usually it is not safe to refer to ids like this, but because + # we're using a finalizer we can ensure ids in this set do not outlive + # their async generator. + foreign: set[int] = attrs.Factory(set) + + # This collects async generators that get garbage collected during + # the one-tick window between the system nursery closing and the + # init task starting end-of-run asyncgen finalization. + trailing_needs_finalize: _ASYNC_GEN_SET = attrs.Factory(_ASYNC_GEN_SET) + + prev_hooks: sys._asyncgen_hooks = attrs.field(init=False) + + def install_hooks(self, runner: _run.Runner) -> None: + def firstiter(agen: AsyncGeneratorType[object, NoReturn]) -> None: + if hasattr(_run.GLOBAL_RUN_CONTEXT, "task"): + self.alive.add(agen) + else: + # An async generator first iterated outside of a Trio + # task doesn't belong to Trio. Probably we're in guest + # mode and the async generator belongs to our host. + # A strong set of ids is one of the only good places to + # remember this fact, at least until + # https://github.com/python/cpython/issues/85093 is implemented. + self.foreign.add(id(agen)) + if self.prev_hooks.firstiter is not None: + self.prev_hooks.firstiter(agen) + + def finalize_in_trio_context( + agen: AsyncGeneratorType[object, NoReturn], + agen_name: str, + ) -> None: + try: + runner.spawn_system_task( + self._finalize_one, + agen, + agen_name, + name=f"close asyncgen {agen_name} (abandoned)", + ) + except RuntimeError: + # There is a one-tick window where the system nursery + # is closed but the init task hasn't yet made + # self.asyncgens a strong set to disable GC. We seem to + # have hit it. + self.trailing_needs_finalize.add(agen) + + @_core.enable_ki_protection + def finalizer(agen: AsyncGeneratorType[object, NoReturn]) -> None: + try: + self.foreign.remove(id(agen)) + except KeyError: + is_ours = True + else: + is_ours = False + + agen_name = name_asyncgen(agen) + if is_ours: + runner.entry_queue.run_sync_soon( + finalize_in_trio_context, + agen, + agen_name, + ) + + # Do this last, because it might raise an exception + # depending on the user's warnings filter. (That + # exception will be printed to the terminal and + # ignored, since we're running in GC context.) + warnings.warn( + f"Async generator {agen_name!r} was garbage collected before it " + "had been exhausted. Surround its use in 'async with " + "aclosing(...):' to ensure that it gets cleaned up as soon as " + "you're done using it.", + ResourceWarning, + stacklevel=2, + source=agen, + ) + else: + # Not ours -> forward to the host loop's async generator finalizer + finalizer = self.prev_hooks.finalizer + if finalizer is not None: + _call_without_ki_protection(finalizer, agen) + else: + # Host has no finalizer. Reimplement the default + # Python behavior with no hooks installed: throw in + # GeneratorExit, step once, raise RuntimeError if + # it doesn't exit. + closer = agen.aclose() + try: + # If the next thing is a yield, this will raise RuntimeError + # which we allow to propagate + _call_without_ki_protection(closer.send, None) + except StopIteration: + pass + else: + # If the next thing is an await, we get here. Give a nicer + # error than the default "async generator ignored GeneratorExit" + raise RuntimeError( + f"Non-Trio async generator {agen_name!r} awaited something " + "during finalization; install a finalization hook to " + "support this, or wrap it in 'async with aclosing(...):'", + ) + + self.prev_hooks = sys.get_asyncgen_hooks() + sys.set_asyncgen_hooks(firstiter=firstiter, finalizer=finalizer) # type: ignore[arg-type] # Finalizer doesn't use AsyncGeneratorType + + async def finalize_remaining(self, runner: _run.Runner) -> None: + # This is called from init after shutting down the system nursery. + # The only tasks running at this point are init and + # the run_sync_soon task, and since the system nursery is closed, + # there's no way for user code to spawn more. + assert _core.current_task() is runner.init_task + assert len(runner.tasks) == 2 + + # To make async generator finalization easier to reason + # about, we'll shut down asyncgen garbage collection by turning + # the alive WeakSet into a regular set. + self.alive = set(self.alive) + + # Process all pending run_sync_soon callbacks, in case one of + # them was an asyncgen finalizer that snuck in under the wire. + runner.entry_queue.run_sync_soon(runner.reschedule, runner.init_task) + await _core.wait_task_rescheduled( + lambda _: _core.Abort.FAILED, # pragma: no cover + ) + self.alive.update(self.trailing_needs_finalize) + self.trailing_needs_finalize.clear() + + # None of the still-living tasks use async generators, so + # every async generator must be suspended at a yield point -- + # there's no one to be doing the iteration. That's good, + # because aclose() only works on an asyncgen that's suspended + # at a yield point. (If it's suspended at an event loop trap, + # because someone is in the middle of iterating it, then you + # get a RuntimeError on 3.8+, and a nasty surprise on earlier + # versions due to https://bugs.python.org/issue32526.) + # + # However, once we start aclose() of one async generator, it + # might start fetching the next value from another, thus + # preventing us from closing that other (at least until + # aclose() of the first one is complete). This constraint + # effectively requires us to finalize the remaining asyncgens + # in arbitrary order, rather than doing all of them at the + # same time. On 3.8+ we could defer any generator with + # ag_running=True to a later batch, but that only catches + # the case where our aclose() starts after the user's + # asend()/etc. If our aclose() starts first, then the + # user's asend()/etc will raise RuntimeError, since they're + # probably not checking ag_running. + # + # It might be possible to allow some parallelized cleanup if + # we can determine that a certain set of asyncgens have no + # interdependencies, using gc.get_referents() and such. + # But just doing one at a time will typically work well enough + # (since each aclose() executes in a cancelled scope) and + # is much easier to reason about. + + # It's possible that that cleanup code will itself create + # more async generators, so we iterate repeatedly until + # all are gone. + while self.alive: + batch = self.alive + self.alive = _ASYNC_GEN_SET() + for agen in batch: + await self._finalize_one(agen, name_asyncgen(agen)) + + def close(self) -> None: + sys.set_asyncgen_hooks(*self.prev_hooks) + + async def _finalize_one( + self, + agen: AsyncGeneratorType[object, NoReturn], + name: object, + ) -> None: + try: + # This shield ensures that finalize_asyncgen never exits + # with an exception, not even a Cancelled. The inside + # is cancelled so there's no deadlock risk. + with _core.CancelScope(shield=True) as cancel_scope: + cancel_scope.cancel( + reason="disallow async work when closing async generators during trio shutdown" + ) + await agen.aclose() + except BaseException: + ASYNCGEN_LOGGER.exception( + "Exception ignored during finalization of async generator %r -- " + "surround your use of the generator in 'async with aclosing(...):' " + "to raise exceptions like this in the context where they're generated", + name, + ) diff --git a/contrib/python/trio/trio/_core/_concat_tb.py b/contrib/python/trio/trio/_core/_concat_tb.py new file mode 100644 index 000000000000..9d0291ccf80c --- /dev/null +++ b/contrib/python/trio/trio/_core/_concat_tb.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +from types import TracebackType + + +# this is used for collapsing single-exception ExceptionGroups when using +# `strict_exception_groups=False`. Once that is retired this function can +# be removed as well. +def concat_tb( + head: TracebackType | None, + tail: TracebackType | None, +) -> TracebackType | None: + # We have to use an iterative algorithm here, because in the worst case + # this might be a RecursionError stack that is by definition too deep to + # process by recursion! + head_tbs = [] + pointer = head + while pointer is not None: + head_tbs.append(pointer) + pointer = pointer.tb_next + current_head = tail + for head_tb in reversed(head_tbs): + current_head = TracebackType( + current_head, head_tb.tb_frame, head_tb.tb_lasti, head_tb.tb_lineno + ) + return current_head diff --git a/contrib/python/trio/trio/_core/_entry_queue.py b/contrib/python/trio/trio/_core/_entry_queue.py new file mode 100644 index 000000000000..988b45ca00dc --- /dev/null +++ b/contrib/python/trio/trio/_core/_entry_queue.py @@ -0,0 +1,223 @@ +from __future__ import annotations + +import threading +from collections import deque +from collections.abc import Callable +from typing import TYPE_CHECKING, NoReturn + +import attrs + +from .. import _core +from .._util import NoPublicConstructor, final +from ._wakeup_socketpair import WakeupSocketpair + +if TYPE_CHECKING: + from typing_extensions import TypeVarTuple, Unpack + + PosArgsT = TypeVarTuple("PosArgsT") + +Function = Callable[..., object] # type: ignore[explicit-any] +Job = tuple[Function, tuple[object, ...]] + + +@attrs.define +class EntryQueue: + # This used to use a queue.Queue. but that was broken, because Queues are + # implemented in Python, and not reentrant -- so it was thread-safe, but + # not signal-safe. deque is implemented in C, so each operation is atomic + # WRT threads (and this is guaranteed in the docs), AND each operation is + # atomic WRT signal delivery (signal handlers can run on either side, but + # not *during* a deque operation). dict makes similar guarantees - and + # it's even ordered! + queue: deque[Job] = attrs.Factory(deque) + idempotent_queue: dict[Job, None] = attrs.Factory(dict) + + wakeup: WakeupSocketpair = attrs.Factory(WakeupSocketpair) + done: bool = False + # Must be a reentrant lock, because it's acquired from signal handlers. + # RLock is signal-safe as of cpython 3.2. NB that this does mean that the + # lock is effectively *disabled* when we enter from signal context. The + # way we use the lock this is OK though, because when + # run_sync_soon is called from a signal it's atomic WRT the + # main thread -- it just might happen at some inconvenient place. But if + # you look at the one place where the main thread holds the lock, it's + # just to make 1 assignment, so that's atomic WRT a signal anyway. + lock: threading.RLock = attrs.Factory(threading.RLock) + + async def task(self) -> None: + assert _core.currently_ki_protected() + # RLock has two implementations: a signal-safe version in _thread, and + # and signal-UNsafe version in threading. We need the signal safe + # version. Python 3.2 and later should always use this anyway, but, + # since the symptoms if this goes wrong are just "weird rare + # deadlocks", then let's make a little check. + # See: + # https://bugs.python.org/issue13697#msg237140 + assert self.lock.__class__.__module__ == "_thread" + + def run_cb(job: Job) -> None: + # We run this with KI protection enabled; it's the callback's + # job to disable it if it wants it disabled. Exceptions are + # treated like system task exceptions (i.e., converted into + # TrioInternalError and cause everything to shut down). + sync_fn, args = job + try: + sync_fn(*args) + except BaseException as exc: + + async def kill_everything( # noqa: RUF029 # await not used + exc: BaseException, + ) -> NoReturn: + raise exc + + try: + _core.spawn_system_task(kill_everything, exc) + except RuntimeError: + # We're quite late in the shutdown process and the + # system nursery is already closed. + # TODO(2020-06): this is a gross hack and should + # be fixed soon when we address #1607. + parent_nursery = _core.current_task().parent_nursery + if parent_nursery is None: + raise AssertionError( + "Internal error: `parent_nursery` should never be `None`", + ) from exc # pragma: no cover + parent_nursery.start_soon(kill_everything, exc) + + # This has to be carefully written to be safe in the face of new items + # being queued while we iterate, and to do a bounded amount of work on + # each pass: + def run_all_bounded() -> None: + for _ in range(len(self.queue)): + run_cb(self.queue.popleft()) + for job in list(self.idempotent_queue): + del self.idempotent_queue[job] + run_cb(job) + + try: + while True: + run_all_bounded() + if not self.queue and not self.idempotent_queue: + await self.wakeup.wait_woken() + else: + await _core.checkpoint() + except _core.Cancelled: + # Keep the work done with this lock held as minimal as possible, + # because it doesn't protect us against concurrent signal delivery + # (see the comment above). Notice that this code would still be + # correct if written like: + # self.done = True + # with self.lock: + # pass + # because all we want is to force run_sync_soon + # to either be completely before or completely after the write to + # done. That's why we don't need the lock to protect + # against signal handlers. + with self.lock: + self.done = True + # No more jobs will be submitted, so just clear out any residual + # ones: + run_all_bounded() + assert not self.queue + assert not self.idempotent_queue + + def close(self) -> None: + self.wakeup.close() + + def size(self) -> int: + return len(self.queue) + len(self.idempotent_queue) + + def run_sync_soon( + self, + sync_fn: Callable[[Unpack[PosArgsT]], object], + *args: Unpack[PosArgsT], + idempotent: bool = False, + ) -> None: + with self.lock: + if self.done: + raise _core.RunFinishedError("run() has exited") + # We have to hold the lock all the way through here, because + # otherwise the main thread might exit *while* we're doing these + # calls, and then our queue item might not be processed, or the + # wakeup call might trigger an OSError b/c the IO manager has + # already been shut down. + if idempotent: + self.idempotent_queue[sync_fn, args] = None + else: + self.queue.append((sync_fn, args)) + self.wakeup.wakeup_thread_and_signal_safe() + + +@final +@attrs.define(eq=False) +class TrioToken(metaclass=NoPublicConstructor): + """An opaque object representing a single call to :func:`trio.run`. + + It has no public constructor; instead, see :func:`current_trio_token`. + + This object has two uses: + + 1. It lets you re-enter the Trio run loop from external threads or signal + handlers. This is the low-level primitive that :func:`trio.to_thread` + and `trio.from_thread` use to communicate with worker threads, that + `trio.open_signal_receiver` uses to receive notifications about + signals, and so forth. + + 2. Each call to :func:`trio.run` has exactly one associated + :class:`TrioToken` object, so you can use it to identify a particular + call. + + """ + + _reentry_queue: EntryQueue + + def run_sync_soon( + self, + sync_fn: Callable[[Unpack[PosArgsT]], object], + *args: Unpack[PosArgsT], + idempotent: bool = False, + ) -> None: + """Schedule a call to ``sync_fn(*args)`` to occur in the context of a + Trio task. + + This is safe to call from the main thread, from other threads, and + from signal handlers. This is the fundamental primitive used to + re-enter the Trio run loop from outside of it. + + The call will happen "soon", but there's no guarantee about exactly + when, and no mechanism provided for finding out when it's happened. + If you need this, you'll have to build your own. + + The call is effectively run as part of a system task (see + :func:`~trio.lowlevel.spawn_system_task`). In particular this means + that: + + * :exc:`KeyboardInterrupt` protection is *enabled* by default; if + you want ``sync_fn`` to be interruptible by control-C, then you + need to use :func:`~trio.lowlevel.disable_ki_protection` + explicitly. + + * If ``sync_fn`` raises an exception, then it's converted into a + :exc:`~trio.TrioInternalError` and *all* tasks are cancelled. You + should be careful that ``sync_fn`` doesn't crash. + + All calls with ``idempotent=False`` are processed in strict + first-in first-out order. + + If ``idempotent=True``, then ``sync_fn`` and ``args`` must be + hashable, and Trio will make a best-effort attempt to discard any + call submission which is equal to an already-pending call. Trio + will process these in first-in first-out order. + + Any ordering guarantees apply separately to ``idempotent=False`` + and ``idempotent=True`` calls; there's no rule for how calls in the + different categories are ordered with respect to each other. + + :raises trio.RunFinishedError: + if the associated call to :func:`trio.run` + has already exited. (Any call that *doesn't* raise this error + is guaranteed to be fully processed before :func:`trio.run` + exits.) + + """ + self._reentry_queue.run_sync_soon(sync_fn, *args, idempotent=idempotent) diff --git a/contrib/python/trio/trio/_core/_exceptions.py b/contrib/python/trio/trio/_core/_exceptions.py new file mode 100644 index 000000000000..f70d5e0e95bc --- /dev/null +++ b/contrib/python/trio/trio/_core/_exceptions.py @@ -0,0 +1,169 @@ +from __future__ import annotations + +from functools import partial +from typing import TYPE_CHECKING, Literal + +import attrs + +from trio._util import NoPublicConstructor, final + +if TYPE_CHECKING: + from collections.abc import Callable + + from typing_extensions import Self, TypeAlias + +CancelReasonLiteral: TypeAlias = Literal[ + "KeyboardInterrupt", + "deadline", + "explicit", + "nursery", + "shutdown", + "unknown", +] + + +class TrioInternalError(Exception): + """Raised by :func:`run` if we encounter a bug in Trio, or (possibly) a + misuse of one of the low-level :mod:`trio.lowlevel` APIs. + + This should never happen! If you get this error, please file a bug. + + Unfortunately, if you get this error it also means that all bets are off – + Trio doesn't know what is going on and its normal invariants may be void. + (For example, we might have "lost track" of a task. Or lost track of all + tasks.) Again, though, this shouldn't happen. + + """ + + +class RunFinishedError(RuntimeError): + """Raised by `trio.from_thread.run` and similar functions if the + corresponding call to :func:`trio.run` has already finished. + + """ + + +class WouldBlock(Exception): + """Raised by ``X_nowait`` functions if ``X`` would block.""" + + +@final +@attrs.define(eq=False, kw_only=True) +class Cancelled(BaseException, metaclass=NoPublicConstructor): + """Raised by blocking calls if the surrounding scope has been cancelled. + + You should let this exception propagate, to be caught by the relevant + cancel scope. To remind you of this, it inherits from :exc:`BaseException` + instead of :exc:`Exception`, just like :exc:`KeyboardInterrupt` and + :exc:`SystemExit` do. This means that if you write something like:: + + try: + ... + except Exception: + ... + + then this *won't* catch a :exc:`Cancelled` exception. + + You cannot raise :exc:`Cancelled` yourself. Attempting to do so + will produce a :exc:`TypeError`. Use :meth:`cancel_scope.cancel() + ` instead. + + .. note:: + + In the US it's also common to see this word spelled "canceled", with + only one "l". This is a `recent + `__ + and `US-specific + `__ + innovation, and even in the US both forms are still commonly used. So + for consistency with the rest of the world and with "cancellation" + (which always has two "l"s), Trio uses the two "l" spelling + everywhere. + + """ + + source: CancelReasonLiteral = "unknown" + # repr(Task), so as to avoid gc troubles from holding a reference + source_task: str | None = None + reason: str | None = None + + def __str__(self) -> str: + return ( + f"cancelled due to {self.source}" + + ("" if self.reason is None else f" with reason {self.reason!r}") + + ("" if self.source_task is None else f" from task {self.source_task}") + ) + + def __reduce__(self) -> tuple[Callable[[], Cancelled], tuple[()]]: + # The `__reduce__` tuple does not support directly passing kwargs, and the + # kwargs are required so we can't use the third item for adding to __dict__, + # so we use partial. + return ( + partial( + Cancelled._create, + source=self.source, + source_task=self.source_task, + reason=self.reason, + ), + (), + ) + + if TYPE_CHECKING: + # for type checking on internal code + @classmethod + def _create( + cls, + *, + source: CancelReasonLiteral = "unknown", + source_task: str | None = None, + reason: str | None = None, + ) -> Self: ... + + +class BusyResourceError(Exception): + """Raised when a task attempts to use a resource that some other task is + already using, and this would lead to bugs and nonsense. + + For example, if two tasks try to send data through the same socket at the + same time, Trio will raise :class:`BusyResourceError` instead of letting + the data get scrambled. + + """ + + +class ClosedResourceError(Exception): + """Raised when attempting to use a resource after it has been closed. + + Note that "closed" here means that *your* code closed the resource, + generally by calling a method with a name like ``close`` or ``aclose``, or + by exiting a context manager. If a problem arises elsewhere – for example, + because of a network failure, or because a remote peer closed their end of + a connection – then that should be indicated by a different exception + class, like :exc:`BrokenResourceError` or an :exc:`OSError` subclass. + + """ + + +class BrokenResourceError(Exception): + """Raised when an attempt to use a resource fails due to external + circumstances. + + For example, you might get this if you try to send data on a stream where + the remote side has already closed the connection. + + You *don't* get this error if *you* closed the resource – in that case you + get :class:`ClosedResourceError`. + + This exception's ``__cause__`` attribute will often contain more + information about the underlying error. + + """ + + +class EndOfChannel(Exception): + """Raised when trying to receive from a :class:`trio.abc.ReceiveChannel` + that has no more data to receive. + + This is analogous to an "end-of-file" condition, but for channels. + + """ diff --git a/contrib/python/trio/trio/_core/_generated_instrumentation.py b/contrib/python/trio/trio/_core/_generated_instrumentation.py new file mode 100644 index 000000000000..d03ef9db7de0 --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_instrumentation.py @@ -0,0 +1,50 @@ +# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +from typing import TYPE_CHECKING + +from ._ki import enable_ki_protection +from ._run import GLOBAL_RUN_CONTEXT + +if TYPE_CHECKING: + from ._instrumentation import Instrument + +__all__ = ["add_instrument", "remove_instrument"] + + +@enable_ki_protection +def add_instrument(instrument: Instrument) -> None: + """Start instrumenting the current run loop with the given instrument. + + Args: + instrument (trio.abc.Instrument): The instrument to activate. + + If ``instrument`` is already active, does nothing. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.instruments.add_instrument(instrument) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def remove_instrument(instrument: Instrument) -> None: + """Stop instrumenting the current run loop with the given instrument. + + Args: + instrument (trio.abc.Instrument): The instrument to de-activate. + + Raises: + KeyError: if the instrument is not currently active. This could + occur either because you never added it, or because you added it + and then it raised an unhandled exception and was automatically + deactivated. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.instruments.remove_instrument(instrument) + except AttributeError: + raise RuntimeError("must be called from async context") from None diff --git a/contrib/python/trio/trio/_core/_generated_io_epoll.py b/contrib/python/trio/trio/_core/_generated_io_epoll.py new file mode 100644 index 000000000000..41cbb4065028 --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_io_epoll.py @@ -0,0 +1,98 @@ +# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +import sys +from typing import TYPE_CHECKING + +from ._ki import enable_ki_protection +from ._run import GLOBAL_RUN_CONTEXT + +if TYPE_CHECKING: + from .._file_io import _HasFileNo + +assert not TYPE_CHECKING or sys.platform == "linux" + + +__all__ = ["notify_closing", "wait_readable", "wait_writable"] + + +@enable_ki_protection +async def wait_readable(fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``fd`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``fd`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_readable(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_writable(fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``fd``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_writable(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def notify_closing(fd: int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.notify_closing(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None diff --git a/contrib/python/trio/trio/_core/_generated_io_kqueue.py b/contrib/python/trio/trio/_core/_generated_io_kqueue.py new file mode 100644 index 000000000000..556d29e1f26e --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_io_kqueue.py @@ -0,0 +1,153 @@ +# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +import sys +from typing import TYPE_CHECKING + +from ._ki import enable_ki_protection +from ._run import GLOBAL_RUN_CONTEXT + +if TYPE_CHECKING: + import select + from collections.abc import Callable + from contextlib import AbstractContextManager + + from .. import _core + from .._file_io import _HasFileNo + from ._traps import Abort, RaiseCancelT + +assert not TYPE_CHECKING or sys.platform == "darwin" + + +__all__ = [ + "current_kqueue", + "monitor_kevent", + "notify_closing", + "wait_kevent", + "wait_readable", + "wait_writable", +] + + +@enable_ki_protection +def current_kqueue() -> select.kqueue: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.current_kqueue() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def monitor_kevent( + ident: int, filter: int +) -> AbstractContextManager[_core.UnboundedQueue[select.kevent]]: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.monitor_kevent(ident, filter) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_kevent( + ident: int, filter: int, abort_func: Callable[[RaiseCancelT], Abort] +) -> Abort: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_kevent( + ident, filter, abort_func + ) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_readable(fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``fd`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``fd`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_readable(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_writable(fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``fd``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_writable(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def notify_closing(fd: int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.notify_closing(fd) + except AttributeError: + raise RuntimeError("must be called from async context") from None diff --git a/contrib/python/trio/trio/_core/_generated_io_windows.py b/contrib/python/trio/trio/_core/_generated_io_windows.py new file mode 100644 index 000000000000..211f81215c56 --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_io_windows.py @@ -0,0 +1,204 @@ +# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +import sys +from typing import TYPE_CHECKING + +from ._ki import enable_ki_protection +from ._run import GLOBAL_RUN_CONTEXT + +if TYPE_CHECKING: + from contextlib import AbstractContextManager + + from typing_extensions import Buffer + + from .._file_io import _HasFileNo + from ._unbounded_queue import UnboundedQueue + from ._windows_cffi import CData, Handle + +assert not TYPE_CHECKING or sys.platform == "win32" + + +__all__ = [ + "current_iocp", + "monitor_completion_key", + "notify_closing", + "readinto_overlapped", + "register_with_iocp", + "wait_overlapped", + "wait_readable", + "wait_writable", + "write_overlapped", +] + + +@enable_ki_protection +async def wait_readable(sock: _HasFileNo | int) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``sock`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``sock`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_readable(sock) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_writable(sock: _HasFileNo | int) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``sock``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_writable(sock) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def notify_closing(handle: Handle | int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.notify_closing(handle) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def register_with_iocp(handle: int | CData) -> None: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.register_with_iocp(handle) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_overlapped(handle_: int | CData, lpOverlapped: CData | int) -> object: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_overlapped( + handle_, lpOverlapped + ) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def write_overlapped( + handle: int | CData, data: Buffer, file_offset: int = 0 +) -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.write_overlapped( + handle, data, file_offset + ) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def readinto_overlapped( + handle: int | CData, buffer: Buffer, file_offset: int = 0 +) -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.io_manager.readinto_overlapped( + handle, buffer, file_offset + ) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def current_iocp() -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.current_iocp() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def monitor_completion_key() -> ( + AbstractContextManager[tuple[int, UnboundedQueue[object]]] +): + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + try: + return GLOBAL_RUN_CONTEXT.runner.io_manager.monitor_completion_key() + except AttributeError: + raise RuntimeError("must be called from async context") from None diff --git a/contrib/python/trio/trio/_core/_generated_run.py b/contrib/python/trio/trio/_core/_generated_run.py new file mode 100644 index 000000000000..db1454e6c76e --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_run.py @@ -0,0 +1,269 @@ +# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +from typing import TYPE_CHECKING + +from ._ki import enable_ki_protection +from ._run import _NO_SEND, GLOBAL_RUN_CONTEXT, RunStatistics, Task + +if TYPE_CHECKING: + import contextvars + from collections.abc import Awaitable, Callable + + from outcome import Outcome + from typing_extensions import Unpack + + from .._abc import Clock + from ._entry_queue import TrioToken + from ._run import PosArgT + + +__all__ = [ + "current_clock", + "current_root_task", + "current_statistics", + "current_time", + "current_trio_token", + "reschedule", + "spawn_system_task", + "wait_all_tasks_blocked", +] + + +@enable_ki_protection +def current_statistics() -> RunStatistics: + """Returns ``RunStatistics``, which contains run-loop-level debugging information. + + Currently, the following fields are defined: + + * ``tasks_living`` (int): The number of tasks that have been spawned + and not yet exited. + * ``tasks_runnable`` (int): The number of tasks that are currently + queued on the run queue (as opposed to blocked waiting for something + to happen). + * ``seconds_to_next_deadline`` (float): The time until the next + pending cancel scope deadline. May be negative if the deadline has + expired but we haven't yet processed cancellations. May be + :data:`~math.inf` if there are no pending deadlines. + * ``run_sync_soon_queue_size`` (int): The number of + unprocessed callbacks queued via + :meth:`trio.lowlevel.TrioToken.run_sync_soon`. + * ``io_statistics`` (object): Some statistics from Trio's I/O + backend. This always has an attribute ``backend`` which is a string + naming which operating-system-specific I/O backend is in use; the + other attributes vary between backends. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.current_statistics() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def current_time() -> float: + """Returns the current time according to Trio's internal clock. + + Returns: + float: The current time. + + Raises: + RuntimeError: if not inside a call to :func:`trio.run`. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.current_time() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def current_clock() -> Clock: + """Returns the current :class:`~trio.abc.Clock`.""" + try: + return GLOBAL_RUN_CONTEXT.runner.current_clock() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def current_root_task() -> Task | None: + """Returns the current root :class:`Task`. + + This is the task that is the ultimate parent of all other tasks. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.current_root_task() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def reschedule(task: Task, next_send: Outcome[object] = _NO_SEND) -> None: + """Reschedule the given task with the given + :class:`outcome.Outcome`. + + See :func:`wait_task_rescheduled` for the gory details. + + There must be exactly one call to :func:`reschedule` for every call to + :func:`wait_task_rescheduled`. (And when counting, keep in mind that + returning :data:`Abort.SUCCEEDED` from an abort callback is equivalent + to calling :func:`reschedule` once.) + + Args: + task (trio.lowlevel.Task): the task to be rescheduled. Must be blocked + in a call to :func:`wait_task_rescheduled`. + next_send (outcome.Outcome): the value (or error) to return (or + raise) from :func:`wait_task_rescheduled`. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.reschedule(task, next_send) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def spawn_system_task( + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + *args: Unpack[PosArgT], + name: object = None, + context: contextvars.Context | None = None, +) -> Task: + """Spawn a "system" task. + + System tasks have a few differences from regular tasks: + + * They don't need an explicit nursery; instead they go into the + internal "system nursery". + + * If a system task raises an exception, then it's converted into a + :exc:`~trio.TrioInternalError` and *all* tasks are cancelled. If you + write a system task, you should be careful to make sure it doesn't + crash. + + * System tasks are automatically cancelled when the main task exits. + + * By default, system tasks have :exc:`KeyboardInterrupt` protection + *enabled*. If you want your task to be interruptible by control-C, + then you need to use :func:`disable_ki_protection` explicitly (and + come up with some plan for what to do with a + :exc:`KeyboardInterrupt`, given that system tasks aren't allowed to + raise exceptions). + + * System tasks do not inherit context variables from their creator. + + Towards the end of a call to :meth:`trio.run`, after the main + task and all system tasks have exited, the system nursery + becomes closed. At this point, new calls to + :func:`spawn_system_task` will raise ``RuntimeError("Nursery + is closed to new arrivals")`` instead of creating a system + task. It's possible to encounter this state either in + a ``finally`` block in an async generator, or in a callback + passed to :meth:`TrioToken.run_sync_soon` at the right moment. + + Args: + async_fn: An async callable. + args: Positional arguments for ``async_fn``. If you want to pass + keyword arguments, use :func:`functools.partial`. + name: The name for this task. Only used for debugging/introspection + (e.g. ``repr(task_obj)``). If this isn't a string, + :func:`spawn_system_task` will try to make it one. A common use + case is if you're wrapping a function before spawning a new + task, you might pass the original function as the ``name=`` to + make debugging easier. + context: An optional ``contextvars.Context`` object with context variables + to use for this task. You would normally get a copy of the current + context with ``context = contextvars.copy_context()`` and then you would + pass that ``context`` object here. + + Returns: + Task: the newly spawned task + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.spawn_system_task( + async_fn, *args, name=name, context=context + ) + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +def current_trio_token() -> TrioToken: + """Retrieve the :class:`TrioToken` for the current call to + :func:`trio.run`. + + """ + try: + return GLOBAL_RUN_CONTEXT.runner.current_trio_token() + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +@enable_ki_protection +async def wait_all_tasks_blocked(cushion: float = 0.0) -> None: + """Block until there are no runnable tasks. + + This is useful in testing code when you want to give other tasks a + chance to "settle down". The calling task is blocked, and doesn't wake + up until all other tasks are also blocked for at least ``cushion`` + seconds. (Setting a non-zero ``cushion`` is intended to handle cases + like two tasks talking to each other over a local socket, where we + want to ignore the potential brief moment between a send and receive + when all tasks are blocked.) + + Note that ``cushion`` is measured in *real* time, not the Trio clock + time. + + If there are multiple tasks blocked in :func:`wait_all_tasks_blocked`, + then the one with the shortest ``cushion`` is the one woken (and + this task becoming unblocked resets the timers for the remaining + tasks). If there are multiple tasks that have exactly the same + ``cushion``, then all are woken. + + You should also consider :class:`trio.testing.Sequencer`, which + provides a more explicit way to control execution ordering within a + test, and will often produce more readable tests. + + Example: + Here's an example of one way to test that Trio's locks are fair: we + take the lock in the parent, start a child, wait for the child to be + blocked waiting for the lock (!), and then check that we can't + release and immediately re-acquire the lock:: + + async def lock_taker(lock): + await lock.acquire() + lock.release() + + async def test_lock_fairness(): + lock = trio.Lock() + await lock.acquire() + async with trio.open_nursery() as nursery: + nursery.start_soon(lock_taker, lock) + # child hasn't run yet, we have the lock + assert lock.locked() + assert lock._owner is trio.lowlevel.current_task() + await trio.testing.wait_all_tasks_blocked() + # now the child has run and is blocked on lock.acquire(), we + # still have the lock + assert lock.locked() + assert lock._owner is trio.lowlevel.current_task() + lock.release() + try: + # The child has a prior claim, so we can't have it + lock.acquire_nowait() + except trio.WouldBlock: + assert lock._owner is not trio.lowlevel.current_task() + print("PASS") + else: + print("FAIL") + + """ + try: + return await GLOBAL_RUN_CONTEXT.runner.wait_all_tasks_blocked(cushion) + except AttributeError: + raise RuntimeError("must be called from async context") from None diff --git a/contrib/python/trio/trio/_core/_generated_windows_ffi.py b/contrib/python/trio/trio/_core/_generated_windows_ffi.py new file mode 100644 index 000000000000..0178993e375c --- /dev/null +++ b/contrib/python/trio/trio/_core/_generated_windows_ffi.py @@ -0,0 +1,10 @@ +# auto-generated file +import _cffi_backend + +ffi = _cffi_backend.FFI('trio._core._generated_windows_ffi', + _version = 0x2601, + _types = b'\x00\x00\x39\x0D\x00\x00\x1A\x01\x00\x00\x0A\x01\x00\x00\x72\x03\x00\x00\x0A\x01\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x02\x03\x00\x00\x6D\x03\x00\x00\x03\x11\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x04\x01\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x07\x11\x00\x00\x08\x11\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x07\x11\x00\x00\x08\x11\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x72\x03\x00\x00\x0A\x01\x00\x00\x07\x11\x00\x00\x08\x11\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x00\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x02\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x08\x11\x00\x00\x02\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x6E\x03\x00\x00\x0A\x01\x00\x00\x07\x11\x00\x00\x0A\x01\x00\x00\x07\x01\x00\x00\x02\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x07\x01\x00\x00\x02\x0F\x00\x00\x39\x0D\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x1A\x01\x00\x00\x08\x11\x00\x00\x02\x0F\x00\x00\x02\x0D\x00\x00\x08\x01\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x0A\x01\x00\x00\x03\x03\x00\x00\x07\x01\x00\x00\x0A\x01\x00\x00\x00\x0F\x00\x00\x02\x0D\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x00\x0F\x00\x00\x03\x0D\x00\x00\x03\x11\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x03\x11\x00\x00\x00\x0F\x00\x00\x03\x0D\x00\x00\x73\x03\x00\x00\x0A\x01\x00\x00\x0A\x01\x00\x00\x03\x11\x00\x00\x0A\x01\x00\x00\x0A\x01\x00\x00\x03\x11\x00\x00\x00\x0F\x00\x00\x03\x0D\x00\x00\x03\x11\x00\x00\x03\x11\x00\x00\x1A\x01\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x68\x03\x00\x00\x02\x09\x00\x00\x68\x05\x00\x00\x00\x01\x00\x00\x6C\x03\x00\x00\x03\x09\x00\x00\x04\x09\x00\x00\x05\x09\x00\x00\x17\x01\x00\x00\x01\x09\x00\x00\x00\x09\x00\x00\x00\x01\x00\x00\x10\x01', + _globals = (b'\x00\x00\x2F\x23CancelIoEx',0,b'\x00\x00\x2C\x23CloseHandle',0,b'\x00\x00\x52\x23CreateEventA',0,b'\x00\x00\x58\x23CreateFileW',0,b'\x00\x00\x61\x23CreateIoCompletionPort',0,b'\x00\x00\x12\x23DeviceIoControl',0,b'\x00\x00\x33\x23GetQueuedCompletionStatusEx',0,b'\x00\x00\x3F\x23PostQueuedCompletionStatus',0,b'\x00\x00\x1C\x23ReadFile',0,b'\x00\x00\x0B\x23ResetEvent',0,b'\x00\x00\x45\x23RtlNtStatusToDosError',0,b'\x00\x00\x3B\x23SetConsoleCtrlHandler',0,b'\x00\x00\x0B\x23SetEvent',0,b'\x00\x00\x0E\x23SetFileCompletionNotificationModes',0,b'\x00\x00\x2A\x23WSAGetLastError',0,b'\x00\x00\x00\x23WSAIoctl',0,b'\x00\x00\x48\x23WaitForMultipleObjects',0,b'\x00\x00\x4E\x23WaitForSingleObject',0,b'\x00\x00\x23\x23WriteFile',0), + _struct_unions = ((b'\x00\x00\x00\x71\x00\x00\x00\x03$1',b'\x00\x00\x70\x11DUMMYSTRUCTNAME',b'\x00\x00\x03\x11Pointer'),(b'\x00\x00\x00\x70\x00\x00\x00\x02$2',b'\x00\x00\x02\x11Offset',b'\x00\x00\x02\x11OffsetHigh'),(b'\x00\x00\x00\x68\x00\x00\x00\x02_AFD_POLL_HANDLE_INFO',b'\x00\x00\x03\x11Handle',b'\x00\x00\x02\x11Events',b'\x00\x00\x46\x11Status'),(b'\x00\x00\x00\x6C\x00\x00\x00\x02_AFD_POLL_INFO',b'\x00\x00\x6F\x11Timeout',b'\x00\x00\x02\x11NumberOfHandles',b'\x00\x00\x02\x11Exclusive',b'\x00\x00\x69\x11Handles'),(b'\x00\x00\x00\x6D\x00\x00\x00\x02_OVERLAPPED',b'\x00\x00\x01\x11Internal',b'\x00\x00\x01\x11InternalHigh',b'\x00\x00\x71\x11DUMMYUNIONNAME',b'\x00\x00\x03\x11hEvent'),(b'\x00\x00\x00\x6E\x00\x00\x00\x02_OVERLAPPED_ENTRY',b'\x00\x00\x01\x11lpCompletionKey',b'\x00\x00\x08\x11lpOverlapped',b'\x00\x00\x01\x11Internal',b'\x00\x00\x02\x11dwNumberOfBytesTransferred')), + _typenames = (b'\x00\x00\x00\x68AFD_POLL_HANDLE_INFO',b'\x00\x00\x00\x6CAFD_POLL_INFO',b'\x00\x00\x00\x39BOOL',b'\x00\x00\x00\x10BOOLEAN',b'\x00\x00\x00\x10BYTE',b'\x00\x00\x00\x02DWORD',b'\x00\x00\x00\x03HANDLE',b'\x00\x00\x00\x6FLARGE_INTEGER',b'\x00\x00\x00\x03LPCSTR',b'\x00\x00\x00\x25LPCVOID',b'\x00\x00\x00\x59LPCWSTR',b'\x00\x00\x00\x07LPDWORD',b'\x00\x00\x00\x08LPOVERLAPPED',b'\x00\x00\x00\x35LPOVERLAPPED_ENTRY',b'\x00\x00\x00\x03LPSECURITY_ATTRIBUTES',b'\x00\x00\x00\x03LPVOID',b'\x00\x00\x00\x08LPWSAOVERLAPPED',b'\x00\x00\x00\x46NTSTATUS',b'\x00\x00\x00\x6DOVERLAPPED',b'\x00\x00\x00\x6EOVERLAPPED_ENTRY',b'\x00\x00\x00\x67PAFD_POLL_HANDLE_INFO',b'\x00\x00\x00\x6BPAFD_POLL_INFO',b'\x00\x00\x00\x07PULONG',b'\x00\x00\x00\x03PVOID',b'\x00\x00\x00\x01SOCKET',b'\x00\x00\x00\x10UCHAR',b'\x00\x00\x00\x01UINT_PTR',b'\x00\x00\x00\x02ULONG',b'\x00\x00\x00\x01ULONG_PTR',b'\x00\x00\x00\x6DWSAOVERLAPPED',b'\x00\x00\x00\x02u_long'), +) diff --git a/contrib/python/trio/trio/_core/_instrumentation.py b/contrib/python/trio/trio/_core/_instrumentation.py new file mode 100644 index 000000000000..f2a106e29b43 --- /dev/null +++ b/contrib/python/trio/trio/_core/_instrumentation.py @@ -0,0 +1,117 @@ +from __future__ import annotations + +import logging +import types +from collections import UserDict +from typing import TYPE_CHECKING, TypeVar + +from .._abc import Instrument + +# Used to log exceptions in instruments +INSTRUMENT_LOGGER = logging.getLogger("trio.abc.Instrument") + +if TYPE_CHECKING: + from collections.abc import Sequence + + T = TypeVar("T") + + +# Decorator to mark methods public. This does nothing by itself, but +# trio/_tools/gen_exports.py looks for it. +def _public(fn: T) -> T: + return fn + + +class Instruments(UserDict[str, dict[Instrument, None]]): + """A collection of `trio.abc.Instrument` organized by hook. + + Instrumentation calls are rather expensive, and we don't want a + rarely-used instrument (like before_run()) to slow down hot + operations (like before_task_step()). Thus, we cache the set of + instruments to be called for each hook, and skip the instrumentation + call if there's nothing currently installed for that hook. + """ + + __slots__ = () + + def __init__(self, incoming: Sequence[Instrument]) -> None: + super().__init__({"_all": {}}) + for instrument in incoming: + self.add_instrument(instrument) + + @_public + def add_instrument(self, instrument: Instrument) -> None: + """Start instrumenting the current run loop with the given instrument. + + Args: + instrument (trio.abc.Instrument): The instrument to activate. + + If ``instrument`` is already active, does nothing. + + """ + if instrument in self.data["_all"]: + return + self.data["_all"][instrument] = None + try: + for name in dir(instrument): + if name.startswith("_"): + continue + try: + prototype = getattr(Instrument, name) + except AttributeError: + continue + impl = getattr(instrument, name) + if isinstance(impl, types.MethodType) and impl.__func__ is prototype: + # Inherited unchanged from _abc.Instrument + continue + self.data.setdefault(name, {})[instrument] = None + except: + self.remove_instrument(instrument) + raise + + @_public + def remove_instrument(self, instrument: Instrument) -> None: + """Stop instrumenting the current run loop with the given instrument. + + Args: + instrument (trio.abc.Instrument): The instrument to de-activate. + + Raises: + KeyError: if the instrument is not currently active. This could + occur either because you never added it, or because you added it + and then it raised an unhandled exception and was automatically + deactivated. + + """ + # If instrument isn't present, the KeyError propagates out + self.data["_all"].pop(instrument) + for hookname, instruments in list(self.data.items()): + if instrument in instruments: + del instruments[instrument] + if not instruments: + del self.data[hookname] + + def call( + self, + hookname: str, + *args: object, + ) -> None: + """Call hookname(*args) on each applicable instrument. + + You must first check whether there are any instruments installed for + that hook, e.g.:: + + if "before_task_step" in instruments: + instruments.call("before_task_step", task) + """ + for instrument in list(self.data[hookname]): + try: + getattr(instrument, hookname)(*args) + except BaseException: + self.remove_instrument(instrument) + INSTRUMENT_LOGGER.exception( + "Exception raised when calling %r on instrument %r. " + "Instrument has been disabled.", + hookname, + instrument, + ) diff --git a/contrib/python/trio/trio/_core/_io_common.py b/contrib/python/trio/trio/_core/_io_common.py new file mode 100644 index 000000000000..14cd9d33e635 --- /dev/null +++ b/contrib/python/trio/trio/_core/_io_common.py @@ -0,0 +1,31 @@ +from __future__ import annotations + +import copy +from typing import TYPE_CHECKING + +import outcome + +from .. import _core + +if TYPE_CHECKING: + from ._io_epoll import EpollWaiters + from ._io_windows import AFDWaiters + + +# Utility function shared between _io_epoll and _io_windows +def wake_all(waiters: EpollWaiters | AFDWaiters, exc: BaseException) -> None: + try: + current_task = _core.current_task() + except RuntimeError: + current_task = None + raise_at_end = False + for attr_name in ["read_task", "write_task"]: + task = getattr(waiters, attr_name) + if task is not None: + if task is current_task: + raise_at_end = True + else: + _core.reschedule(task, outcome.Error(copy.copy(exc))) + setattr(waiters, attr_name, None) + if raise_at_end: + raise exc diff --git a/contrib/python/trio/trio/_core/_io_epoll.py b/contrib/python/trio/trio/_core/_io_epoll.py new file mode 100644 index 000000000000..5e05f0813fe4 --- /dev/null +++ b/contrib/python/trio/trio/_core/_io_epoll.py @@ -0,0 +1,387 @@ +from __future__ import annotations + +import contextlib +import select +import sys +from collections import defaultdict +from typing import TYPE_CHECKING, Literal + +import attrs + +from .. import _core +from ._io_common import wake_all +from ._run import Task, _public +from ._wakeup_socketpair import WakeupSocketpair + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + + from .._core import Abort, RaiseCancelT + from .._file_io import _HasFileNo + + +@attrs.define(eq=False) +class EpollWaiters: + read_task: Task | None = None + write_task: Task | None = None + current_flags: int = 0 + + +assert not TYPE_CHECKING or sys.platform == "linux" + + +EventResult: TypeAlias = "list[tuple[int, int]]" + + +@attrs.frozen(eq=False) +class _EpollStatistics: + tasks_waiting_read: int + tasks_waiting_write: int + backend: Literal["epoll"] = attrs.field(init=False, default="epoll") + + +# Some facts about epoll +# ---------------------- +# +# Internally, an epoll object is sort of like a WeakKeyDictionary where the +# keys are tuples of (fd number, file object). When you call epoll_ctl, you +# pass in an fd; that gets converted to an (fd number, file object) tuple by +# looking up the fd in the process's fd table at the time of the call. When an +# event happens on the file object, epoll_wait drops the file object part, and +# just returns the fd number in its event. So from the outside it looks like +# it's keeping a table of fds, but really it's a bit more complicated. This +# has some subtle consequences. +# +# In general, file objects inside the kernel are reference counted. Each entry +# in a process's fd table holds a strong reference to the corresponding file +# object, and most operations that use file objects take a temporary strong +# reference while they're working. So when you call close() on an fd, that +# might or might not cause the file object to be deallocated -- it depends on +# whether there are any other references to that file object. Some common ways +# this can happen: +# +# - after calling dup(), you have two fds in the same process referring to the +# same file object. Even if you close one fd (= remove that entry from the +# fd table), the file object will be kept alive by the other fd. +# - when calling fork(), the child inherits a copy of the parent's fd table, +# so all the file objects get another reference. (But if the fork() is +# followed by exec(), then all of the child's fds that have the CLOEXEC flag +# set will be closed at that point.) +# - most syscalls that work on fds take a strong reference to the underlying +# file object while they're using it. So there's one thread blocked in +# read(fd), and then another thread calls close() on the last fd referring +# to that object, the underlying file won't actually be closed until +# after read() returns. +# +# However, epoll does *not* take a reference to any of the file objects in its +# interest set (that's what makes it similar to a WeakKeyDictionary). File +# objects inside an epoll interest set will be deallocated if all *other* +# references to them are closed. And when that happens, the epoll object will +# automatically deregister that file object and stop reporting events on it. +# So that's quite handy. +# +# But, what happens if we do this? +# +# fd1 = open(...) +# epoll_ctl(EPOLL_CTL_ADD, fd1, ...) +# fd2 = dup(fd1) +# close(fd1) +# +# In this case, the dup() keeps the underlying file object alive, so it +# remains registered in the epoll object's interest set, as the tuple (fd1, +# file object). But, fd1 no longer refers to this file object! You might think +# there was some magic to handle this, but unfortunately no; the consequences +# are totally predictable from what I said above: +# +# If any events occur on the file object, then epoll will report them as +# happening on fd1, even though that doesn't make sense. +# +# Perhaps we would like to deregister fd1 to stop getting nonsensical events. +# But how? When we call epoll_ctl, we have to pass an fd number, which will +# get expanded to an (fd number, file object) tuple. We can't pass fd1, +# because when epoll_ctl tries to look it up, it won't find our file object. +# And we can't pass fd2, because that will get expanded to (fd2, file object), +# which is a different lookup key. In fact, it's *impossible* to de-register +# this fd! +# +# We could even have fd1 get assigned to another file object, and then we can +# have multiple keys registered simultaneously using the same fd number, like: +# (fd1, file object 1), (fd1, file object 2). And if events happen on either +# file object, then epoll will happily report that something happened to +# "fd1". +# +# Now here's what makes this especially nasty: suppose the old file object +# becomes, say, readable. That means that every time we call epoll_wait, it +# will return immediately to tell us that "fd1" is readable. Normally, we +# would handle this by de-registering fd1, waking up the corresponding call to +# wait_readable, then the user will call read() or recv() or something, and +# we're fine. But if this happens on a stale fd where we can't remove the +# registration, then we might get stuck in a state where epoll_wait *always* +# returns immediately, so our event loop becomes unable to sleep, and now our +# program is burning 100% of the CPU doing nothing, with no way out. +# +# +# What does this mean for Trio? +# ----------------------------- +# +# Since we don't control the user's code, we have no way to guarantee that we +# don't get stuck with stale fd's in our epoll interest set. For example, a +# user could call wait_readable(fd) in one task, and then while that's +# running, they might close(fd) from another task. In this situation, they're +# *supposed* to call notify_closing(fd) to let us know what's happening, so we +# can interrupt the wait_readable() call and avoid getting into this mess. And +# that's the only thing that can possibly work correctly in all cases. But +# sometimes user code has bugs. So if this does happen, we'd like to degrade +# gracefully, and survive without corrupting Trio's internal state or +# otherwise causing the whole program to explode messily. +# +# Our solution: we always use EPOLLONESHOT. This way, we might get *one* +# spurious event on a stale fd, but then epoll will automatically silence it +# until we explicitly say that we want more events... and if we have a stale +# fd, then we actually can't re-enable it! So we can't get stuck in an +# infinite busy-loop. If there's a stale fd hanging around, then it might +# cause a spurious `BusyResourceError`, or cause one wait_* call to return +# before it should have... but in general, the wait_* functions are allowed to +# have some spurious wakeups; the user code will just attempt the operation, +# get EWOULDBLOCK, and call wait_* again. And the program as a whole will +# survive, any exceptions will propagate, etc. +# +# As a bonus, EPOLLONESHOT also saves us having to explicitly deregister fds +# on the normal wakeup path, so it's a bit more efficient in general. +# +# However, EPOLLONESHOT has a few trade-offs to consider: +# +# First, you can't combine EPOLLONESHOT with EPOLLEXCLUSIVE. This is a bit sad +# in one somewhat rare case: if you have a multi-process server where a group +# of processes all share the same listening socket, then EPOLLEXCLUSIVE can be +# used to avoid "thundering herd" problems when a new connection comes in. But +# this isn't too bad. It's not clear if EPOLLEXCLUSIVE even works for us +# anyway: +# +# https://stackoverflow.com/questions/41582560/how-does-epolls-epollexclusive-mode-interact-with-level-triggering +# +# And it's not clear that EPOLLEXCLUSIVE is a great approach either: +# +# https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/ +# +# And if we do need to support this, we could always add support through some +# more-specialized API in the future. So this isn't a blocker to using +# EPOLLONESHOT. +# +# Second, EPOLLONESHOT does not actually *deregister* the fd after delivering +# an event (EPOLL_CTL_DEL). Instead, it keeps the fd registered, but +# effectively does an EPOLL_CTL_MOD to set the fd's interest flags to +# all-zeros. So we could still end up with an fd hanging around in the +# interest set for a long time, even if we're not using it. +# +# Fortunately, this isn't a problem, because it's only a weak reference – if +# we have a stale fd that's been silenced by EPOLLONESHOT, then it wastes a +# tiny bit of kernel memory remembering this fd that can never be revived, but +# when the underlying file object is eventually closed, that memory will be +# reclaimed. So that's OK. +# +# The other issue is that when someone calls wait_*, using EPOLLONESHOT means +# that if we have ever waited for this fd before, we have to use EPOLL_CTL_MOD +# to re-enable it; but if it's a new fd, we have to use EPOLL_CTL_ADD. How do +# we know which one to use? There's no reasonable way to track which fds are +# currently registered -- remember, we're assuming the user might have gone +# and rearranged their fds without telling us! +# +# Fortunately, this also has a simple solution: if we wait on a socket or +# other fd once, then we'll probably wait on it lots of times. And the epoll +# object itself knows which fds it already has registered. So when an fd comes +# in, we optimistically assume that it's been waited on before, and try doing +# EPOLL_CTL_MOD. And if that fails with an ENOENT error, then we try again +# with EPOLL_CTL_ADD. +# +# So that's why this code is the way it is. And now you know more than you +# wanted to about how epoll works. + + +@attrs.define(eq=False) +class EpollIOManager: + # Using lambda here because otherwise crash on import with gevent monkey patching + # See https://github.com/python-trio/trio/issues/2848 + _epoll: select.epoll = attrs.Factory(lambda: select.epoll()) + # {fd: EpollWaiters} + _registered: defaultdict[int, EpollWaiters] = attrs.Factory( + lambda: defaultdict(EpollWaiters), + ) + _force_wakeup: WakeupSocketpair = attrs.Factory(WakeupSocketpair) + _force_wakeup_fd: int | None = None + + def __attrs_post_init__(self) -> None: + self._epoll.register(self._force_wakeup.wakeup_sock, select.EPOLLIN) + self._force_wakeup_fd = self._force_wakeup.wakeup_sock.fileno() + + def statistics(self) -> _EpollStatistics: + tasks_waiting_read = 0 + tasks_waiting_write = 0 + for waiter in self._registered.values(): + if waiter.read_task is not None: + tasks_waiting_read += 1 + if waiter.write_task is not None: + tasks_waiting_write += 1 + return _EpollStatistics( + tasks_waiting_read=tasks_waiting_read, + tasks_waiting_write=tasks_waiting_write, + ) + + def close(self) -> None: + self._epoll.close() + self._force_wakeup.close() + + def force_wakeup(self) -> None: + self._force_wakeup.wakeup_thread_and_signal_safe() + + # Return value must be False-y IFF the timeout expired, NOT if any I/O + # happened or force_wakeup was called. Otherwise it can be anything; gets + # passed straight through to process_events. + def get_events(self, timeout: float) -> EventResult: + # max_events must be > 0 or epoll gets cranky + # accessing self._registered from a thread looks dangerous, but it's + # OK because it doesn't matter if our value is a little bit off. + max_events = max(1, len(self._registered)) + return self._epoll.poll(timeout, max_events) + + def process_events(self, events: EventResult) -> None: + for fd, flags in events: + if fd == self._force_wakeup_fd: + self._force_wakeup.drain() + continue + waiters = self._registered[fd] + # EPOLLONESHOT always clears the flags when an event is delivered + waiters.current_flags = 0 + # Clever hack stolen from selectors.EpollSelector: an event + # with EPOLLHUP or EPOLLERR flags wakes both readers and + # writers. + if flags & ~select.EPOLLIN and waiters.write_task is not None: + _core.reschedule(waiters.write_task) + waiters.write_task = None + if flags & ~select.EPOLLOUT and waiters.read_task is not None: + _core.reschedule(waiters.read_task) + waiters.read_task = None + self._update_registrations(fd) + + def _update_registrations(self, fd: int) -> None: + waiters = self._registered[fd] + wanted_flags = 0 + if waiters.read_task is not None: + wanted_flags |= select.EPOLLIN + if waiters.write_task is not None: + wanted_flags |= select.EPOLLOUT + if wanted_flags != waiters.current_flags: + try: + try: + # First try EPOLL_CTL_MOD + self._epoll.modify(fd, wanted_flags | select.EPOLLONESHOT) + except OSError: + # If that fails, it might be a new fd; try EPOLL_CTL_ADD + self._epoll.register(fd, wanted_flags | select.EPOLLONESHOT) + waiters.current_flags = wanted_flags + except OSError as exc: + # If everything fails, probably it's a bad fd, e.g. because + # the fd was closed behind our back. In this case we don't + # want to try to unregister the fd, because that will probably + # fail too. Just clear our state and wake everyone up. + del self._registered[fd] + # This could raise (in case we're calling this inside one of + # the to-be-woken tasks), so we have to do it last. + wake_all(waiters, exc) + return + if not wanted_flags: + del self._registered[fd] + + async def _epoll_wait(self, fd: int | _HasFileNo, attr_name: str) -> None: + if not isinstance(fd, int): + fd = fd.fileno() + waiters = self._registered[fd] + if getattr(waiters, attr_name) is not None: + raise _core.BusyResourceError( + "another task is already reading / writing this fd", + ) + setattr(waiters, attr_name, _core.current_task()) + self._update_registrations(fd) + + def abort(_: RaiseCancelT) -> Abort: + setattr(waiters, attr_name, None) + self._update_registrations(fd) + return _core.Abort.SUCCEEDED + + await _core.wait_task_rescheduled(abort) + + @_public + async def wait_readable(self, fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``fd`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``fd`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._epoll_wait(fd, "read_task") + + @_public + async def wait_writable(self, fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``fd``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._epoll_wait(fd, "write_task") + + @_public + def notify_closing(self, fd: int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + if not isinstance(fd, int): + fd = fd.fileno() + wake_all( + self._registered[fd], + _core.ClosedResourceError("another task closed this fd"), + ) + del self._registered[fd] + with contextlib.suppress(OSError, ValueError): + self._epoll.unregister(fd) diff --git a/contrib/python/trio/trio/_core/_io_kqueue.py b/contrib/python/trio/trio/_core/_io_kqueue.py new file mode 100644 index 000000000000..9718c4df809f --- /dev/null +++ b/contrib/python/trio/trio/_core/_io_kqueue.py @@ -0,0 +1,294 @@ +from __future__ import annotations + +import errno +import select +import sys +from contextlib import contextmanager +from typing import TYPE_CHECKING, Literal + +import attrs +import outcome + +from .. import _core +from ._run import _public +from ._wakeup_socketpair import WakeupSocketpair + +if TYPE_CHECKING: + from collections.abc import Callable, Iterator + + from typing_extensions import TypeAlias + + from .._core import Abort, RaiseCancelT, Task, UnboundedQueue + from .._file_io import _HasFileNo + +assert not TYPE_CHECKING or (sys.platform != "linux" and sys.platform != "win32") + +EventResult: TypeAlias = "list[select.kevent]" + + +@attrs.frozen(eq=False) +class _KqueueStatistics: + tasks_waiting: int + monitors: int + backend: Literal["kqueue"] = attrs.field(init=False, default="kqueue") + + +@attrs.define(eq=False) +class KqueueIOManager: + _kqueue: select.kqueue = attrs.Factory(select.kqueue) + # {(ident, filter): Task or UnboundedQueue} + _registered: dict[tuple[int, int], Task | UnboundedQueue[select.kevent]] = ( + attrs.Factory(dict) + ) + _force_wakeup: WakeupSocketpair = attrs.Factory(WakeupSocketpair) + _force_wakeup_fd: int | None = None + + def __attrs_post_init__(self) -> None: + force_wakeup_event = select.kevent( + self._force_wakeup.wakeup_sock, + select.KQ_FILTER_READ, + select.KQ_EV_ADD, + ) + self._kqueue.control([force_wakeup_event], 0) + self._force_wakeup_fd = self._force_wakeup.wakeup_sock.fileno() + + def statistics(self) -> _KqueueStatistics: + tasks_waiting = 0 + monitors = 0 + for receiver in self._registered.values(): + if type(receiver) is _core.Task: + tasks_waiting += 1 + else: + monitors += 1 + return _KqueueStatistics(tasks_waiting=tasks_waiting, monitors=monitors) + + def close(self) -> None: + self._kqueue.close() + self._force_wakeup.close() + + def force_wakeup(self) -> None: + self._force_wakeup.wakeup_thread_and_signal_safe() + + def get_events(self, timeout: float) -> EventResult: + # max_events must be > 0 or kqueue gets cranky + # and we generally want this to be strictly larger than the actual + # number of events we get, so that we can tell that we've gotten + # all the events in just 1 call. + max_events = len(self._registered) + 1 + events = [] + while True: + batch = self._kqueue.control([], max_events, timeout) + events += batch + if len(batch) < max_events: + break + else: # TODO: test this line + timeout = 0 + # and loop back to the start + return events + + def process_events(self, events: EventResult) -> None: + for event in events: + key = (event.ident, event.filter) + if event.ident == self._force_wakeup_fd: + self._force_wakeup.drain() + continue + receiver = self._registered[key] + if event.flags & select.KQ_EV_ONESHOT: # TODO: test this branch + del self._registered[key] + if isinstance(receiver, _core.Task): + _core.reschedule(receiver, outcome.Value(event)) + else: + receiver.put_nowait(event) # TODO: test this line + + # kevent registration is complicated -- e.g. aio submission can + # implicitly perform a EV_ADD, and EVFILT_PROC with NOTE_TRACK will + # automatically register filters for child processes. So our lowlevel + # API is *very* low-level: we expose the kqueue itself for adding + # events or sticking into AIO submission structs, and split waiting + # off into separate methods. It's your responsibility to make sure + # that handle_io never receives an event without a corresponding + # registration! This may be challenging if you want to be careful + # about e.g. KeyboardInterrupt. Possibly this API could be improved to + # be more ergonomic... + + @_public + def current_kqueue(self) -> select.kqueue: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + return self._kqueue + + @contextmanager + @_public + def monitor_kevent( + self, + ident: int, + filter: int, + ) -> Iterator[_core.UnboundedQueue[select.kevent]]: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + key = (ident, filter) + if key in self._registered: + raise _core.BusyResourceError( + "attempt to register multiple listeners for same ident/filter pair", + ) + q = _core.UnboundedQueue[select.kevent]() + self._registered[key] = q + try: + yield q + finally: + del self._registered[key] + + @_public + async def wait_kevent( + self, + ident: int, + filter: int, + abort_func: Callable[[RaiseCancelT], Abort], + ) -> Abort: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__. + """ + key = (ident, filter) + if key in self._registered: + raise _core.BusyResourceError( + "attempt to register multiple listeners for same ident/filter pair", + ) + self._registered[key] = _core.current_task() + + def abort(raise_cancel: RaiseCancelT) -> Abort: + r = abort_func(raise_cancel) + if r is _core.Abort.SUCCEEDED: # TODO: test this branch + del self._registered[key] + return r + + # wait_task_rescheduled does not have its return type typed + return await _core.wait_task_rescheduled(abort) # type: ignore[no-any-return] + + async def _wait_common( + self, + fd: int | _HasFileNo, + filter: int, + ) -> None: + if not isinstance(fd, int): + fd = fd.fileno() + flags = select.KQ_EV_ADD | select.KQ_EV_ONESHOT + event = select.kevent(fd, filter, flags) + self._kqueue.control([event], 0) + + def abort(_: RaiseCancelT) -> Abort: + event = select.kevent(fd, filter, select.KQ_EV_DELETE) + try: + self._kqueue.control([event], 0) + except OSError as exc: + # kqueue tracks individual fds (*not* the underlying file + # object, see _io_epoll.py for a long discussion of why this + # distinction matters), and automatically deregisters an event + # if the fd is closed. So if kqueue.control says that it + # doesn't know about this event, then probably it's because + # the fd was closed behind our backs. (Too bad we can't ask it + # to wake us up when this happens, versus discovering it after + # the fact... oh well, you can't have everything.) + # + # FreeBSD reports this using EBADF. macOS uses ENOENT. + if exc.errno in (errno.EBADF, errno.ENOENT): # pragma: no branch + pass + else: # pragma: no cover + # As far as we know, this branch can't happen. + raise + return _core.Abort.SUCCEEDED + + await self.wait_kevent(fd, filter, abort) + + @_public + async def wait_readable(self, fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``fd`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``fd`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._wait_common(fd, select.KQ_FILTER_READ) + + @_public + async def wait_writable(self, fd: int | _HasFileNo) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``fd``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._wait_common(fd, select.KQ_FILTER_WRITE) + + @_public + def notify_closing(self, fd: int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + if not isinstance(fd, int): + fd = fd.fileno() + + for filter_ in [select.KQ_FILTER_READ, select.KQ_FILTER_WRITE]: + key = (fd, filter_) + receiver = self._registered.get(key) + + if receiver is None: + continue + + if type(receiver) is _core.Task: + event = select.kevent(fd, filter_, select.KQ_EV_DELETE) + self._kqueue.control([event], 0) + exc = _core.ClosedResourceError("another task closed this fd") + _core.reschedule(receiver, outcome.Error(exc)) + del self._registered[key] + else: + # XX this is an interesting example of a case where being able + # to close a queue would be useful... + raise NotImplementedError( + "can't close an fd that monitor_kevent is using", + ) diff --git a/contrib/python/trio/trio/_core/_io_windows.py b/contrib/python/trio/trio/_core/_io_windows.py new file mode 100644 index 000000000000..9a9d6b9cc41d --- /dev/null +++ b/contrib/python/trio/trio/_core/_io_windows.py @@ -0,0 +1,1042 @@ +from __future__ import annotations + +import enum +import itertools +import socket +import sys +from contextlib import contextmanager +from typing import ( + TYPE_CHECKING, + Literal, + Protocol, + TypeVar, + cast, +) + +import attrs +from outcome import Value + +from .. import _core +from ._io_common import wake_all +from ._run import _public +from ._windows_cffi import ( + INVALID_HANDLE_VALUE, + AFDPollFlags, + CData, + CompletionModes, + CType, + ErrorCodes, + FileFlags, + Handle, + IoControlCodes, + WSAIoctls, + _handle, + _Overlapped, + ffi, + kernel32, + ntdll, + raise_winerror, + ws2_32, +) + +if TYPE_CHECKING: + from collections.abc import Callable, Iterator + + from typing_extensions import Buffer, TypeAlias + + from .._file_io import _HasFileNo + from ._traps import Abort, RaiseCancelT + from ._unbounded_queue import UnboundedQueue + +EventResult: TypeAlias = int +T = TypeVar("T") + +# There's a lot to be said about the overall design of a Windows event +# loop. See +# +# https://github.com/python-trio/trio/issues/52 +# +# for discussion. This now just has some lower-level notes: +# +# How IOCP fits together: +# +# The general model is that you call some function like ReadFile or WriteFile +# to tell the kernel that you want it to perform some operation, and the +# kernel goes off and does that in the background, then at some point later it +# sends you a notification that the operation is complete. There are some more +# exotic APIs that don't quite fit this pattern, but most APIs do. +# +# Each background operation is tracked using an OVERLAPPED struct, that +# uniquely identifies that particular operation. +# +# An "IOCP" (or "I/O completion port") is an object that lets the kernel send +# us these notifications -- basically it's just a kernel->userspace queue. +# +# Each IOCP notification is represented by an OVERLAPPED_ENTRY struct, which +# contains 3 fields: +# - The "completion key". This is an opaque integer that we pick, and use +# however is convenient. +# - pointer to the OVERLAPPED struct for the completed operation. +# - dwNumberOfBytesTransferred (an integer). +# +# And in addition, for regular I/O, the OVERLAPPED structure gets filled in +# with: +# - result code (named "Internal") +# - number of bytes transferred (named "InternalHigh"); usually redundant +# with dwNumberOfBytesTransferred. +# +# There are also some other entries in OVERLAPPED which only matter on input: +# - Offset and OffsetHigh which are inputs to {Read,Write}File and +# otherwise always zero +# - hEvent which is for if you aren't using IOCP; we always set it to zero. +# +# That describes the usual pattern for operations and the usual meaning of +# these struct fields, but really these are just some arbitrary chunks of +# bytes that get passed back and forth, so some operations like to overload +# them to mean something else. +# +# You can also directly queue an OVERLAPPED_ENTRY object to an IOCP by calling +# PostQueuedCompletionStatus. When you use this you get to set all the +# OVERLAPPED_ENTRY fields to arbitrary values. +# +# You can request to cancel any operation if you know which handle it was +# issued on + the OVERLAPPED struct that identifies it (via CancelIoEx). This +# request might fail because the operation has already completed, or it might +# be queued to happen in the background, so you only find out whether it +# succeeded or failed later, when we get back the notification for the +# operation being complete. +# +# There are three types of operations that we support: +# +# == Regular I/O operations on handles (e.g. files or named pipes) == +# +# Implemented by: register_with_iocp, wait_overlapped +# +# To use these, you have to register the handle with your IOCP first. Once +# it's registered, any operations on that handle will automatically send +# completion events to that IOCP, with a completion key that you specify *when +# the handle is registered* (so you can't use different completion keys for +# different operations). +# +# We give these two dedicated completion keys: CKeys.WAIT_OVERLAPPED for +# regular operations, and CKeys.LATE_CANCEL that's used to make +# wait_overlapped cancellable even if the user forgot to call +# register_with_iocp. The problem here is that after we request the cancel, +# wait_overlapped keeps blocking until it sees the completion notification... +# but if the user forgot to register_with_iocp, then the completion will never +# come, so the cancellation will never resolve. To avoid this, whenever we try +# to cancel an I/O operation and the cancellation fails, we use +# PostQueuedCompletionStatus to send a CKeys.LATE_CANCEL notification. If this +# arrives before the real completion, we assume the user forgot to call +# register_with_iocp on their handle, and raise an error accordingly. +# +# == Socket state notifications == +# +# Implemented by: wait_readable, wait_writable +# +# The public APIs that windows provides for this are all really awkward and +# don't integrate with IOCP. So we drop down to a lower level, and talk +# directly to the socket device driver in the kernel, which is called "AFD". +# Unfortunately, this is a totally undocumented internal API. Fortunately +# libuv also does this, so we can be pretty confident that MS won't break it +# on us, and there is a *little* bit of information out there if you go +# digging. +# +# Basically: we open a magic file that refers to the AFD driver, register the +# magic file with our IOCP, and then we can issue regular overlapped I/O +# operations on that handle. Specifically, the operation we use is called +# IOCTL_AFD_POLL, which lets us pass in a buffer describing which events we're +# interested in on a given socket (readable, writable, etc.). Later, when the +# operation completes, the kernel rewrites the buffer we passed in to record +# which events happened, and uses IOCP as normal to notify us that this +# operation has completed. +# +# Unfortunately, the Windows kernel seems to have bugs if you try to issue +# multiple simultaneous IOCTL_AFD_POLL operations on the same socket (see +# https://github.com/python-trio/trio/wiki/notes-to-self#afd-labpy). +# So if a user calls wait_readable and +# wait_writable at the same time, we have to combine those into a single +# IOCTL_AFD_POLL. This means we can't just use the wait_overlapped machinery. +# Instead we have some dedicated code to handle these operations, and a +# dedicated completion key CKeys.AFD_POLL. +# +# Sources of information: +# - https://github.com/python-trio/trio/issues/52 +# - Wepoll: https://github.com/piscisaureus/wepoll/ +# - libuv: https://github.com/libuv/libuv/ +# - ReactOS: https://github.com/reactos/reactos/ +# - Ancient leaked copies of the Windows NT and Winsock source code: +# https://github.com/pustladi/Windows-2000/blob/661d000d50637ed6fab2329d30e31775046588a9/private/net/sockets/winsock2/wsp/msafd/select.c#L59-L655 +# https://github.com/metoo10987/WinNT4/blob/f5c14e6b42c8f45c20fe88d14c61f9d6e0386b8e/private/ntos/afd/poll.c#L68-L707 +# - The WSAEventSelect docs (this exposes a finer-grained set of events than +# select(), so if you squint you can treat it as a source of information on +# the fine-grained AFD poll types) +# +# +# == Everything else == +# +# There are also some weirder APIs for interacting with IOCP. For example, the +# "Job" API lets you specify an IOCP handle and "completion key", and then in +# the future whenever certain events happen it sends uses IOCP to send a +# notification. These notifications don't correspond to any particular +# operation; they're just spontaneous messages you get. The +# "dwNumberOfBytesTransferred" field gets repurposed to carry an identifier +# for the message type (e.g. JOB_OBJECT_MSG_EXIT_PROCESS), and the +# "lpOverlapped" field gets repurposed to carry some arbitrary data that +# depends on the message type (e.g. the pid of the process that exited). +# +# To handle these, we have monitor_completion_key, where we hand out an +# unassigned completion key, let users set it up however they want, and then +# get any events that arrive on that key. +# +# (Note: monitor_completion_key is not documented or fully baked; expect it to +# change in the future.) + + +# Our completion keys +class CKeys(enum.IntEnum): + AFD_POLL = 0 + WAIT_OVERLAPPED = 1 + LATE_CANCEL = 2 + FORCE_WAKEUP = 3 + USER_DEFINED = 4 # and above + + +# AFD_POLL has a finer-grained set of events than other APIs. We collapse them +# down into Unix-style "readable" and "writable". +# +# Note: AFD_POLL_LOCAL_CLOSE isn't a reliable substitute for notify_closing(), +# because even if the user closes the socket *handle*, the socket *object* +# could still remain open, e.g. if the socket was dup'ed (possibly into +# another process). Explicitly calling notify_closing() guarantees that +# everyone waiting on the *handle* wakes up, which is what you'd expect. +# +# However, we can't avoid getting LOCAL_CLOSE notifications -- the kernel +# delivers them whether we ask for them or not -- so better to include them +# here for documentation, and so that when we check (delivered & requested) we +# get a match. + +READABLE_FLAGS = ( + AFDPollFlags.AFD_POLL_RECEIVE + | AFDPollFlags.AFD_POLL_ACCEPT + | AFDPollFlags.AFD_POLL_DISCONNECT # other side sent an EOF + | AFDPollFlags.AFD_POLL_ABORT + | AFDPollFlags.AFD_POLL_LOCAL_CLOSE +) + +WRITABLE_FLAGS = ( + AFDPollFlags.AFD_POLL_SEND + | AFDPollFlags.AFD_POLL_CONNECT_FAIL + | AFDPollFlags.AFD_POLL_ABORT + | AFDPollFlags.AFD_POLL_LOCAL_CLOSE +) + + +# Annoyingly, while the API makes it *seem* like you can happily issue as many +# independent AFD_POLL operations as you want without them interfering with +# each other, in fact if you issue two AFD_POLL operations for the same socket +# at the same time with notification going to the same IOCP port, then Windows +# gets super confused. For example, if we issue one operation from +# wait_readable, and another independent operation from wait_writable, then +# Windows may complete the wait_writable operation when the socket becomes +# readable. +# +# To avoid this, we have to coalesce all the operations on a single socket +# into one, and when the set of waiters changes we have to throw away the old +# operation and start a new one. +@attrs.define(eq=False) +class AFDWaiters: + read_task: _core.Task | None = None + write_task: _core.Task | None = None + current_op: AFDPollOp | None = None + + +# Just used for internal type checking. +class _AFDHandle(Protocol): + Handle: Handle + Status: int + Events: int + + +# Just used for internal type checking. +class _AFDPollInfo(Protocol): + Timeout: int + NumberOfHandles: int + Exclusive: int + Handles: list[_AFDHandle] + + +# We also need to bundle up all the info for a single op into a standalone +# object, because we need to keep all these objects alive until the operation +# finishes, even if we're throwing it away. +@attrs.frozen(eq=False) +class AFDPollOp: + lpOverlapped: CData + poll_info: _AFDPollInfo + waiters: AFDWaiters + afd_group: AFDGroup + + +# The Windows kernel has a weird issue when using AFD handles. If you have N +# instances of wait_readable/wait_writable registered with a single AFD handle, +# then cancelling any one of them takes something like O(N**2) time. So if we +# used just a single AFD handle, then cancellation would quickly become very +# expensive, e.g. a program with N active sockets would take something like +# O(N**3) time to unwind after control-C. The solution is to spread our sockets +# out over multiple AFD handles, so that N doesn't grow too large for any +# individual handle. +MAX_AFD_GROUP_SIZE = 500 # at 1000, the cubic scaling is just starting to bite + + +@attrs.define(eq=False) +class AFDGroup: + size: int + handle: Handle + + +assert not TYPE_CHECKING or sys.platform == "win32" + + +@attrs.frozen(eq=False) +class _WindowsStatistics: + tasks_waiting_read: int + tasks_waiting_write: int + tasks_waiting_overlapped: int + completion_key_monitors: int + backend: Literal["windows"] = attrs.field(init=False, default="windows") + + +# Maximum number of events to dequeue from the completion port on each pass +# through the run loop. Somewhat arbitrary. Should be large enough to collect +# a good set of tasks on each loop, but not so large to waste tons of memory. +# (Each WindowsIOManager holds a buffer whose size is ~32x this number.) +MAX_EVENTS = 1000 + + +def _check(success: T) -> T: + if not success: + raise_winerror() + return success + + +def _get_underlying_socket( + sock: _HasFileNo | int | Handle, + *, + which: WSAIoctls = WSAIoctls.SIO_BASE_HANDLE, +) -> Handle: + if hasattr(sock, "fileno"): + sock = sock.fileno() + base_ptr = ffi.new("HANDLE *") + out_size = ffi.new("DWORD *") + failed = ws2_32.WSAIoctl( + ffi.cast("SOCKET", sock), + which, + ffi.NULL, + 0, + base_ptr, + ffi.sizeof("HANDLE"), + out_size, + ffi.NULL, + ffi.NULL, + ) + if failed: + code = ws2_32.WSAGetLastError() + raise_winerror(code) + return Handle(base_ptr[0]) + + +def _get_base_socket(sock: _HasFileNo | int | Handle) -> Handle: + # There is a development kit for LSPs called Komodia Redirector. + # It does some unusual (some might say evil) things like intercepting + # SIO_BASE_HANDLE (fails) and SIO_BSP_HANDLE_SELECT (returns the same + # socket) in a misguided attempt to prevent bypassing it. It's been used + # in malware including the infamous Lenovo Superfish incident from 2015, + # but unfortunately is also used in some legitimate products such as + # parental control tools and Astrill VPN. Komodia happens to not + # block SIO_BSP_HANDLE_POLL, so we'll try SIO_BASE_HANDLE and fall back + # to SIO_BSP_HANDLE_POLL if it doesn't work. + # References: + # - https://github.com/piscisaureus/wepoll/blob/0598a791bf9cbbf480793d778930fc635b044980/wepoll.c#L2223 + # - https://github.com/tokio-rs/mio/issues/1314 + + while True: + try: + # If this is not a Komodia-intercepted socket, we can just use + # SIO_BASE_HANDLE. + return _get_underlying_socket(sock) + except OSError as ex: + if ex.winerror == ErrorCodes.ERROR_NOT_SOCKET: + # SIO_BASE_HANDLE might fail even without LSP intervention, + # if we get something that's not a socket. + raise + if hasattr(sock, "fileno"): + sock = sock.fileno() + sock = _handle(sock) + next_sock = _get_underlying_socket( + sock, + which=WSAIoctls.SIO_BSP_HANDLE_POLL, + ) + if next_sock == sock: + # If BSP_HANDLE_POLL returns the same socket we already had, + # then there's no layering going on and we need to fail + # to prevent an infinite loop. + raise RuntimeError( + "Unexpected network configuration detected: " + "SIO_BASE_HANDLE failed and SIO_BSP_HANDLE_POLL didn't " + "return a different socket. Please file a bug at " + "https://github.com/python-trio/trio/issues/new, " + "and include the output of running: " + "netsh winsock show catalog", + ) from ex + # Otherwise we've gotten at least one layer deeper, so + # loop back around to keep digging. + sock = next_sock + + +def _afd_helper_handle() -> Handle: + # The "AFD" driver is exposed at the NT path "\Device\Afd". We're using + # the Win32 CreateFile, though, so we have to pass a Win32 path. \\.\ is + # how Win32 refers to the NT \GLOBAL??\ directory, and GLOBALROOT is a + # symlink inside that directory that points to the root of the NT path + # system. So by sticking that in front of the NT path, we get a Win32 + # path. Alternatively, we could use NtCreateFile directly, since it takes + # an NT path. But we already wrap CreateFileW so this was easier. + # References: + # https://blogs.msdn.microsoft.com/jeremykuhne/2016/05/02/dos-to-nt-a-paths-journey/ + # https://stackoverflow.com/a/21704022 + # + # I'm actually not sure what the \Trio part at the end of the path does. + # Wepoll uses \Device\Afd\Wepoll, so I just copied them. (I'm guessing it + # might be visible in some debug tools, and is otherwise arbitrary?) + rawname = r"\\.\GLOBALROOT\Device\Afd\Trio".encode("utf-16le") + b"\0\0" + rawname_buf = ffi.from_buffer(rawname) + + handle = kernel32.CreateFileW( + ffi.cast("LPCWSTR", rawname_buf), + FileFlags.SYNCHRONIZE, + FileFlags.FILE_SHARE_READ | FileFlags.FILE_SHARE_WRITE, + ffi.NULL, # no security attributes + FileFlags.OPEN_EXISTING, + FileFlags.FILE_FLAG_OVERLAPPED, + ffi.NULL, # no template file + ) + if handle == INVALID_HANDLE_VALUE: # pragma: no cover + raise_winerror() + return handle + + +@attrs.frozen(slots=False) +class CompletionKeyEventInfo: + lpOverlapped: CData | int + dwNumberOfBytesTransferred: int + + +class WindowsIOManager: + def __init__(self) -> None: + # If this method raises an exception, then __del__ could run on a + # half-initialized object. So we initialize everything that __del__ + # touches to safe values up front, before we do anything that can + # fail. + self._iocp = None + self._all_afd_handles: list[Handle] = [] + + self._iocp = _check( + kernel32.CreateIoCompletionPort(INVALID_HANDLE_VALUE, ffi.NULL, 0, 0), + ) + self._events = ffi.new("OVERLAPPED_ENTRY[]", MAX_EVENTS) + + self._vacant_afd_groups: set[AFDGroup] = set() + # {lpOverlapped: AFDPollOp} + self._afd_ops: dict[CData, AFDPollOp] = {} + # {socket handle: AFDWaiters} + self._afd_waiters: dict[Handle, AFDWaiters] = {} + + # {lpOverlapped: task} + self._overlapped_waiters: dict[CData, _core.Task] = {} + self._posted_too_late_to_cancel: set[CData] = set() + + self._completion_key_queues: dict[int, UnboundedQueue[object]] = {} + self._completion_key_counter = itertools.count(CKeys.USER_DEFINED) + + with socket.socket() as s: + # We assume we're not working with any LSP that changes + # how select() is supposed to work. Validate this by + # ensuring that the result of SIO_BSP_HANDLE_SELECT (the + # LSP-hookable mechanism for "what should I use for + # select()?") matches that of SIO_BASE_HANDLE ("what is + # the real non-hooked underlying socket here?"). + # + # This doesn't work for Komodia-based LSPs; see the comments + # in _get_base_socket() for details. But we have special + # logic for those, so we just skip this check if + # SIO_BASE_HANDLE fails. + + # LSPs can in theory override this, but we believe that it never + # actually happens in the wild (except Komodia) + select_handle = _get_underlying_socket( + s, + which=WSAIoctls.SIO_BSP_HANDLE_SELECT, + ) + try: + # LSPs shouldn't override this... + base_handle = _get_underlying_socket(s, which=WSAIoctls.SIO_BASE_HANDLE) + except OSError: + # But Komodia-based LSPs do anyway, in a way that causes + # a failure with WSAEFAULT. We have special handling for + # them in _get_base_socket(). Make sure it works. + _get_base_socket(s) + else: + if base_handle != select_handle: + raise RuntimeError( + "Unexpected network configuration detected: " + "SIO_BASE_HANDLE and SIO_BSP_HANDLE_SELECT differ. " + "Please file a bug at " + "https://github.com/python-trio/trio/issues/new, " + "and include the output of running: " + "netsh winsock show catalog", + ) + + def close(self) -> None: + try: + if self._iocp is not None: + iocp = self._iocp + self._iocp = None + _check(kernel32.CloseHandle(iocp)) + finally: + while self._all_afd_handles: + afd_handle = self._all_afd_handles.pop() + _check(kernel32.CloseHandle(afd_handle)) + + def __del__(self) -> None: + self.close() + + def statistics(self) -> _WindowsStatistics: + tasks_waiting_read = 0 + tasks_waiting_write = 0 + for waiter in self._afd_waiters.values(): + if waiter.read_task is not None: + tasks_waiting_read += 1 + if waiter.write_task is not None: + tasks_waiting_write += 1 + return _WindowsStatistics( + tasks_waiting_read=tasks_waiting_read, + tasks_waiting_write=tasks_waiting_write, + tasks_waiting_overlapped=len(self._overlapped_waiters), + completion_key_monitors=len(self._completion_key_queues), + ) + + def force_wakeup(self) -> None: + assert self._iocp is not None + _check( + kernel32.PostQueuedCompletionStatus( + self._iocp, + 0, + CKeys.FORCE_WAKEUP, + ffi.NULL, + ), + ) + + def get_events(self, timeout: float) -> EventResult: + received = ffi.new("PULONG") + milliseconds = round(1000 * timeout) + if timeout > 0 and milliseconds == 0: + milliseconds = 1 + try: + assert self._iocp is not None + _check( + kernel32.GetQueuedCompletionStatusEx( + self._iocp, + self._events, + MAX_EVENTS, + received, + milliseconds, + 0, + ), + ) + except OSError as exc: + if exc.winerror != ErrorCodes.WAIT_TIMEOUT: # pragma: no cover + raise + return 0 + result = received[0] + assert isinstance(result, int) + return result + + def process_events(self, received: EventResult) -> None: + for i in range(received): + entry = self._events[i] + if entry.lpCompletionKey == CKeys.AFD_POLL: + lpo = entry.lpOverlapped + op = self._afd_ops.pop(lpo) + waiters = op.waiters + if waiters.current_op is not op: + # Stale op, nothing to do + pass + else: + waiters.current_op = None + # I don't think this can happen, so if it does let's crash + # and get a debug trace. + if lpo.Internal != 0: # pragma: no cover + code = ntdll.RtlNtStatusToDosError(lpo.Internal) + raise_winerror(code) + flags = op.poll_info.Handles[0].Events + if waiters.read_task and flags & READABLE_FLAGS: + _core.reschedule(waiters.read_task) + waiters.read_task = None + if waiters.write_task and flags & WRITABLE_FLAGS: + _core.reschedule(waiters.write_task) + waiters.write_task = None + self._refresh_afd(op.poll_info.Handles[0].Handle) + elif entry.lpCompletionKey == CKeys.WAIT_OVERLAPPED: + # Regular I/O event, dispatch on lpOverlapped + waiter = self._overlapped_waiters.pop(entry.lpOverlapped) + overlapped = entry.lpOverlapped + transferred = entry.dwNumberOfBytesTransferred + info = CompletionKeyEventInfo( + lpOverlapped=overlapped, + dwNumberOfBytesTransferred=transferred, + ) + _core.reschedule(waiter, Value(info)) + elif entry.lpCompletionKey == CKeys.LATE_CANCEL: + # Post made by a regular I/O event's abort_fn + # after it failed to cancel the I/O. If we still + # have a waiter with this lpOverlapped, we didn't + # get the regular I/O completion and almost + # certainly the user forgot to call + # register_with_iocp. + self._posted_too_late_to_cancel.remove(entry.lpOverlapped) + try: + waiter = self._overlapped_waiters.pop(entry.lpOverlapped) + except KeyError: + # Looks like the actual completion got here before this + # fallback post did -- we're in the "expected" case of + # too-late-to-cancel, where the user did nothing wrong. + # Nothing more to do. + pass + else: + exc = _core.TrioInternalError( + f"Failed to cancel overlapped I/O in {waiter.name} and didn't " + "receive the completion either. Did you forget to " + "call register_with_iocp()?", + ) + # Raising this out of handle_io ensures that + # the user will see our message even if some + # other task is in an uncancellable wait due + # to the same underlying forgot-to-register + # issue (if their CancelIoEx succeeds, we + # have no way of noticing that their completion + # won't arrive). Unfortunately it loses the + # task traceback. If you're debugging this + # error and can't tell where it's coming from, + # try changing this line to + # _core.reschedule(waiter, outcome.Error(exc)) + raise exc + elif entry.lpCompletionKey == CKeys.FORCE_WAKEUP: + pass + else: + # dispatch on lpCompletionKey + queue = self._completion_key_queues[entry.lpCompletionKey] + overlapped = int(ffi.cast("uintptr_t", entry.lpOverlapped)) + transferred = entry.dwNumberOfBytesTransferred + info = CompletionKeyEventInfo( + lpOverlapped=overlapped, + dwNumberOfBytesTransferred=transferred, + ) + queue.put_nowait(info) + + def _register_with_iocp(self, handle_: int | CData, completion_key: int) -> None: + handle = _handle(handle_) + assert self._iocp is not None + _check(kernel32.CreateIoCompletionPort(handle, self._iocp, completion_key, 0)) + # Supposedly this makes things slightly faster, by disabling the + # ability to do WaitForSingleObject(handle). We would never want to do + # that anyway, so might as well get the extra speed (if any). + # Ref: http://www.lenholgate.com/blog/2009/09/interesting-blog-posts-on-high-performance-servers.html + _check( + kernel32.SetFileCompletionNotificationModes( + handle, + CompletionModes.FILE_SKIP_SET_EVENT_ON_HANDLE, + ), + ) + + ################################################################ + # AFD stuff + ################################################################ + + def _refresh_afd(self, base_handle: Handle) -> None: + waiters = self._afd_waiters[base_handle] + if waiters.current_op is not None: + afd_group = waiters.current_op.afd_group + try: + _check( + kernel32.CancelIoEx( + afd_group.handle, + waiters.current_op.lpOverlapped, + ), + ) + except OSError as exc: + if exc.winerror != ErrorCodes.ERROR_NOT_FOUND: + # I don't think this is possible, so if it happens let's + # crash noisily. + raise # pragma: no cover + waiters.current_op = None + afd_group.size -= 1 + self._vacant_afd_groups.add(afd_group) + + flags = 0 + if waiters.read_task is not None: + flags |= READABLE_FLAGS + if waiters.write_task is not None: + flags |= WRITABLE_FLAGS + + if not flags: + del self._afd_waiters[base_handle] + else: + try: + afd_group = self._vacant_afd_groups.pop() + except KeyError: + afd_group = AFDGroup(0, _afd_helper_handle()) + self._register_with_iocp(afd_group.handle, CKeys.AFD_POLL) + self._all_afd_handles.append(afd_group.handle) + self._vacant_afd_groups.add(afd_group) + + lpOverlapped = ffi.new("LPOVERLAPPED") + + poll_info = cast("_AFDPollInfo", ffi.new("AFD_POLL_INFO *")) + poll_info.Timeout = 2**63 - 1 # INT64_MAX + poll_info.NumberOfHandles = 1 + poll_info.Exclusive = 0 + poll_info.Handles[0].Handle = base_handle + poll_info.Handles[0].Status = 0 + poll_info.Handles[0].Events = flags + + try: + _check( + kernel32.DeviceIoControl( + afd_group.handle, + IoControlCodes.IOCTL_AFD_POLL, + cast("CType", poll_info), # type: ignore[arg-type] + ffi.sizeof("AFD_POLL_INFO"), + cast("CType", poll_info), # type: ignore[arg-type] + ffi.sizeof("AFD_POLL_INFO"), + ffi.NULL, + lpOverlapped, + ), + ) + except OSError as exc: + if exc.winerror != ErrorCodes.ERROR_IO_PENDING: + # This could happen if the socket handle got closed behind + # our back while a wait_* call was pending, and we tried + # to re-issue the call. Clear our state and wake up any + # pending calls. + del self._afd_waiters[base_handle] + # Do this last, because it could raise. + wake_all(waiters, exc) + return + op = AFDPollOp(lpOverlapped, poll_info, waiters, afd_group) + waiters.current_op = op + self._afd_ops[lpOverlapped] = op + afd_group.size += 1 + if afd_group.size >= MAX_AFD_GROUP_SIZE: + self._vacant_afd_groups.remove(afd_group) + + async def _afd_poll(self, sock: _HasFileNo | int, mode: str) -> None: + base_handle = _get_base_socket(sock) + waiters = self._afd_waiters.get(base_handle) + if waiters is None: + waiters = AFDWaiters() + self._afd_waiters[base_handle] = waiters + if getattr(waiters, mode) is not None: + raise _core.BusyResourceError + setattr(waiters, mode, _core.current_task()) + # Could potentially raise if the handle is somehow invalid; that's OK, + # we let it escape. + self._refresh_afd(base_handle) + + def abort_fn(_: RaiseCancelT) -> Abort: + setattr(waiters, mode, None) + self._refresh_afd(base_handle) + return _core.Abort.SUCCEEDED + + await _core.wait_task_rescheduled(abort_fn) + + @_public + async def wait_readable(self, sock: _HasFileNo | int) -> None: + """Block until the kernel reports that the given object is readable. + + On Unix systems, ``sock`` must either be an integer file descriptor, + or else an object with a ``.fileno()`` method which returns an + integer file descriptor. Any kind of file descriptor can be passed, + though the exact semantics will depend on your kernel. For example, + this probably won't do anything useful for on-disk files. + + On Windows systems, ``sock`` must either be an integer ``SOCKET`` + handle, or else an object with a ``.fileno()`` method which returns + an integer ``SOCKET`` handle. File descriptors aren't supported, + and neither are handles that refer to anything besides a + ``SOCKET``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become readable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._afd_poll(sock, "read_task") + + @_public + async def wait_writable(self, sock: _HasFileNo | int) -> None: + """Block until the kernel reports that the given object is writable. + + See `wait_readable` for the definition of ``sock``. + + :raises trio.BusyResourceError: + if another task is already waiting for the given socket to + become writable. + :raises trio.ClosedResourceError: + if another task calls :func:`notify_closing` while this + function is still working. + """ + await self._afd_poll(sock, "write_task") + + @_public + def notify_closing(self, handle: Handle | int | _HasFileNo) -> None: + """Notify waiters of the given object that it will be closed. + + Call this before closing a file descriptor (on Unix) or socket (on + Windows). This will cause any `wait_readable` or `wait_writable` + calls on the given object to immediately wake up and raise + `~trio.ClosedResourceError`. + + This doesn't actually close the object – you still have to do that + yourself afterwards. Also, you want to be careful to make sure no + new tasks start waiting on the object in between when you call this + and when it's actually closed. So to close something properly, you + usually want to do these steps in order: + + 1. Explicitly mark the object as closed, so that any new attempts + to use it will abort before they start. + 2. Call `notify_closing` to wake up any already-existing users. + 3. Actually close the object. + + It's also possible to do them in a different order if that's more + convenient, *but only if* you make sure not to have any checkpoints in + between the steps. This way they all happen in a single atomic + step, so other tasks won't be able to tell what order they happened + in anyway. + """ + handle = _get_base_socket(handle) + waiters = self._afd_waiters.get(handle) + if waiters is not None: + wake_all(waiters, _core.ClosedResourceError()) + self._refresh_afd(handle) + + ################################################################ + # Regular overlapped operations + ################################################################ + + @_public + def register_with_iocp(self, handle: int | CData) -> None: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + self._register_with_iocp(handle, CKeys.WAIT_OVERLAPPED) + + @_public + async def wait_overlapped( + self, + handle_: int | CData, + lpOverlapped: CData | int, + ) -> object: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + handle = _handle(handle_) + if isinstance(lpOverlapped, int): # TODO: test this line + lpOverlapped = ffi.cast("LPOVERLAPPED", lpOverlapped) + if lpOverlapped in self._overlapped_waiters: # TODO: test this line + raise _core.BusyResourceError( + "another task is already waiting on that lpOverlapped", + ) + task = _core.current_task() + self._overlapped_waiters[lpOverlapped] = task + raise_cancel = None + + def abort(raise_cancel_: RaiseCancelT) -> Abort: + nonlocal raise_cancel + raise_cancel = raise_cancel_ + try: + _check(kernel32.CancelIoEx(handle, lpOverlapped)) + except OSError as exc: + if exc.winerror == ErrorCodes.ERROR_NOT_FOUND: + assert self._iocp is not None + # Too late to cancel. If this happens because the + # operation is already completed, we don't need to do + # anything; we'll get a notification of that completion + # soon. But another possibility is that the operation was + # performed on a handle that wasn't registered with our + # IOCP (ie, the user forgot to call register_with_iocp), + # in which case we're just never going to see the + # completion. To avoid an uncancellable infinite sleep in + # the latter case, we'll PostQueuedCompletionStatus here, + # and if our post arrives before the original completion + # does, we'll assume the handle wasn't registered. + _check( + kernel32.PostQueuedCompletionStatus( + self._iocp, + 0, + CKeys.LATE_CANCEL, + lpOverlapped, + ), + ) + # Keep the lpOverlapped referenced so its address + # doesn't get reused until our posted completion + # status has been processed. Otherwise, we can + # get confused about which completion goes with + # which I/O. + self._posted_too_late_to_cancel.add(lpOverlapped) + else: # pragma: no cover + raise _core.TrioInternalError( + "CancelIoEx failed with unexpected error", + ) from exc + return _core.Abort.FAILED + + # TODO: what type does this return? + info = await _core.wait_task_rescheduled(abort) + lpOverlappedTyped = cast("_Overlapped", lpOverlapped) + if lpOverlappedTyped.Internal != 0: + # the lpOverlapped reports the error as an NT status code, + # which we must convert back to a Win32 error code before + # it will produce the right sorts of exceptions + code = ntdll.RtlNtStatusToDosError(lpOverlappedTyped.Internal) + if code == ErrorCodes.ERROR_OPERATION_ABORTED: + if raise_cancel is not None: + raise_cancel() + else: + # We didn't request this cancellation, so assume + # it happened due to the underlying handle being + # closed before the operation could complete. + raise _core.ClosedResourceError("another task closed this resource") + else: + raise_winerror(code) + return info + + async def _perform_overlapped( + self, + handle: int | CData, + submit_fn: Callable[[_Overlapped], None], + ) -> _Overlapped: + # submit_fn(lpOverlapped) submits some I/O + # it may raise an OSError with ERROR_IO_PENDING + # the handle must already be registered using + # register_with_iocp(handle) + # This always does a schedule point, but it's possible that the + # operation will not be cancellable, depending on how Windows is + # feeling today. So we need to check for cancellation manually. + await _core.checkpoint_if_cancelled() + lpOverlapped = cast("_Overlapped", ffi.new("LPOVERLAPPED")) + try: + submit_fn(lpOverlapped) + except OSError as exc: + if exc.winerror != ErrorCodes.ERROR_IO_PENDING: + raise + await self.wait_overlapped(handle, cast("CData", lpOverlapped)) + return lpOverlapped + + @_public + async def write_overlapped( + self, + handle: int | CData, + data: Buffer, + file_offset: int = 0, + ) -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + with ffi.from_buffer(data) as cbuf: + + def submit_write(lpOverlapped: _Overlapped) -> None: + # yes, these are the real documented names + offset_fields = lpOverlapped.DUMMYUNIONNAME.DUMMYSTRUCTNAME + offset_fields.Offset = file_offset & 0xFFFFFFFF + offset_fields.OffsetHigh = file_offset >> 32 + _check( + kernel32.WriteFile( + _handle(handle), + ffi.cast("LPCVOID", cbuf), + len(cbuf), + ffi.NULL, + lpOverlapped, + ), + ) + + lpOverlapped = await self._perform_overlapped(handle, submit_write) + # this is "number of bytes transferred" + return lpOverlapped.InternalHigh + + @_public + async def readinto_overlapped( + self, + handle: int | CData, + buffer: Buffer, + file_offset: int = 0, + ) -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + with ffi.from_buffer(buffer, require_writable=True) as cbuf: + + def submit_read(lpOverlapped: _Overlapped) -> None: + offset_fields = lpOverlapped.DUMMYUNIONNAME.DUMMYSTRUCTNAME + offset_fields.Offset = file_offset & 0xFFFFFFFF + offset_fields.OffsetHigh = file_offset >> 32 + _check( + kernel32.ReadFile( + _handle(handle), + ffi.cast("LPVOID", cbuf), + len(cbuf), + ffi.NULL, + lpOverlapped, + ), + ) + + lpOverlapped = await self._perform_overlapped(handle, submit_read) + return lpOverlapped.InternalHigh + + ################################################################ + # Raw IOCP operations + ################################################################ + + @_public + def current_iocp(self) -> int: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + assert self._iocp is not None + return int(ffi.cast("uintptr_t", self._iocp)) + + @contextmanager + @_public + def monitor_completion_key(self) -> Iterator[tuple[int, UnboundedQueue[object]]]: + """TODO: these are implemented, but are currently more of a sketch than + anything real. See `#26 + `__ and `#52 + `__. + """ + key = next(self._completion_key_counter) + queue = _core.UnboundedQueue[object]() + self._completion_key_queues[key] = queue + try: + yield (key, queue) + finally: + del self._completion_key_queues[key] diff --git a/contrib/python/trio/trio/_core/_ki.py b/contrib/python/trio/trio/_core/_ki.py new file mode 100644 index 000000000000..9fa849229a30 --- /dev/null +++ b/contrib/python/trio/trio/_core/_ki.py @@ -0,0 +1,272 @@ +from __future__ import annotations + +import signal +import sys +import types +import weakref +from typing import TYPE_CHECKING, Generic, Protocol, TypeVar + +import attrs + +from .._util import is_main_thread +from ._run_context import GLOBAL_RUN_CONTEXT + +if TYPE_CHECKING: + import types + from collections.abc import Callable + + from typing_extensions import Self, TypeGuard +# In ordinary single-threaded Python code, when you hit control-C, it raises +# an exception and automatically does all the regular unwinding stuff. +# +# In Trio code, we would like hitting control-C to raise an exception and +# automatically do all the regular unwinding stuff. In particular, we would +# like to maintain our invariant that all tasks always run to completion (one +# way or another), by unwinding all of them. +# +# But it's basically impossible to write the core task running code in such a +# way that it can maintain this invariant in the face of KeyboardInterrupt +# exceptions arising at arbitrary bytecode positions. Similarly, if a +# KeyboardInterrupt happened at the wrong moment inside pretty much any of our +# inter-task synchronization or I/O primitives, then the system state could +# get corrupted and prevent our being able to clean up properly. +# +# So, we need a way to defer KeyboardInterrupt processing from these critical +# sections. +# +# Things that don't work: +# +# - Listen for SIGINT and process it in a system task: works fine for +# well-behaved programs that regularly pass through the event loop, but if +# user-code goes into an infinite loop then it can't be interrupted. Which +# is unfortunate, since dealing with infinite loops is what +# KeyboardInterrupt is for! +# +# - Use pthread_sigmask to disable signal delivery during critical section: +# (a) windows has no pthread_sigmask, (b) python threads start with all +# signals unblocked, so if there are any threads around they'll receive the +# signal and then tell the main thread to run the handler, even if the main +# thread has that signal blocked. +# +# - Install a signal handler which checks a global variable to decide whether +# to raise the exception immediately (if we're in a non-critical section), +# or to schedule it on the event loop (if we're in a critical section). The +# problem here is that it's impossible to transition safely out of user code: +# +# with keyboard_interrupt_enabled: +# msg = coro.send(value) +# +# If this raises a KeyboardInterrupt, it might be because the coroutine got +# interrupted and has unwound... or it might be the KeyboardInterrupt +# arrived just *after* 'send' returned, so the coroutine is still running, +# but we just lost the message it sent. (And worse, in our actual task +# runner, the send is hidden inside a utility function etc.) +# +# Solution: +# +# Mark *stack frames* as being interrupt-safe or interrupt-unsafe, and from +# the signal handler check which kind of frame we're currently in when +# deciding whether to raise or schedule the exception. +# +# There are still some cases where this can fail, like if someone hits +# control-C while the process is in the event loop, and then it immediately +# enters an infinite loop in user code. In this case the user has to hit +# control-C a second time. And of course if the user code is written so that +# it doesn't actually exit after a task crashes and everything gets cancelled, +# then there's not much to be done. (Hitting control-C repeatedly might help, +# but in general the solution is to kill the process some other way, just like +# for any Python program that's written to catch and ignore +# KeyboardInterrupt.) + +_T = TypeVar("_T") + + +class _IdRef(weakref.ref[_T]): + __slots__ = ("_hash",) + _hash: int + + def __new__( + cls, + ob: _T, + callback: Callable[[Self], object] | None = None, + /, + ) -> Self: + self: Self = weakref.ref.__new__(cls, ob, callback) + self._hash = object.__hash__(ob) + return self + + def __eq__(self, other: object) -> bool: + if self is other: + return True + + if not isinstance(other, _IdRef): + return NotImplemented + + my_obj = None + try: + my_obj = self() + return my_obj is not None and my_obj is other() + finally: + del my_obj + + # we're overriding a builtin so we do need this + def __ne__(self, other: object) -> bool: + return not self == other + + def __hash__(self) -> int: + return self._hash + + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + + +# see also: https://github.com/python/cpython/issues/88306 +class WeakKeyIdentityDictionary(Generic[_KT, _VT]): + def __init__(self) -> None: + self._data: dict[_IdRef[_KT], _VT] = {} + + def remove( + k: _IdRef[_KT], + selfref: weakref.ref[ + WeakKeyIdentityDictionary[_KT, _VT] + ] = weakref.ref( # noqa: B008 # function-call-in-default-argument + self, + ), + ) -> None: + self = selfref() + if self is not None: + try: # noqa: SIM105 # suppressible-exception + del self._data[k] + except KeyError: + pass + + self._remove = remove + + def __getitem__(self, k: _KT) -> _VT: + return self._data[_IdRef(k)] + + def __setitem__(self, k: _KT, v: _VT) -> None: + self._data[_IdRef(k, self._remove)] = v + + +_CODE_KI_PROTECTION_STATUS_WMAP: WeakKeyIdentityDictionary[ + types.CodeType, + bool, +] = WeakKeyIdentityDictionary() + + +# This is to support the async_generator package necessary for aclosing on <3.10 +# functions decorated @async_generator are given this magic property that's a +# reference to the object itself +# see python-trio/async_generator/async_generator/_impl.py +def legacy_isasyncgenfunction( + obj: object, +) -> TypeGuard[Callable[..., types.AsyncGeneratorType[object, object]]]: + return getattr(obj, "_async_gen_function", None) == id(obj) + + +# NB: according to the signal.signal docs, 'frame' can be None on entry to +# this function: +def ki_protection_enabled(frame: types.FrameType | None) -> bool: + try: + task = GLOBAL_RUN_CONTEXT.task + except AttributeError: + task_ki_protected = False + task_frame = None + else: + task_ki_protected = task._ki_protected + task_frame = task.coro.cr_frame + + while frame is not None: + try: + v = _CODE_KI_PROTECTION_STATUS_WMAP[frame.f_code] + except KeyError: + pass + else: + return bool(v) + if frame.f_code.co_name == "__del__": + return True + if frame is task_frame: + return task_ki_protected + frame = frame.f_back + return True + + +def currently_ki_protected() -> bool: + r"""Check whether the calling code has :exc:`KeyboardInterrupt` protection + enabled. + + It's surprisingly easy to think that one's :exc:`KeyboardInterrupt` + protection is enabled when it isn't, or vice-versa. This function tells + you what Trio thinks of the matter, which makes it useful for ``assert``\s + and unit tests. + + Returns: + bool: True if protection is enabled, and False otherwise. + + """ + return ki_protection_enabled(sys._getframe()) + + +class _SupportsCode(Protocol): + __code__: types.CodeType + + +_T_supports_code = TypeVar("_T_supports_code", bound=_SupportsCode) + + +def enable_ki_protection(f: _T_supports_code, /) -> _T_supports_code: + """Decorator to enable KI protection.""" + orig = f + + if legacy_isasyncgenfunction(f): + f = f.__wrapped__ # type: ignore + + _CODE_KI_PROTECTION_STATUS_WMAP[f.__code__] = True + return orig + + +def disable_ki_protection(f: _T_supports_code, /) -> _T_supports_code: + """Decorator to disable KI protection.""" + orig = f + + if legacy_isasyncgenfunction(f): + f = f.__wrapped__ # type: ignore + + _CODE_KI_PROTECTION_STATUS_WMAP[f.__code__] = False + return orig + + +@attrs.define(slots=False) +class KIManager: + handler: Callable[[int, types.FrameType | None], None] | None = None + + def install( + self, + deliver_cb: Callable[[], object], + restrict_keyboard_interrupt_to_checkpoints: bool, + ) -> None: + assert self.handler is None + if ( + not is_main_thread() + or signal.getsignal(signal.SIGINT) != signal.default_int_handler + ): + return + + def handler(signum: int, frame: types.FrameType | None) -> None: + assert signum == signal.SIGINT + protection_enabled = ki_protection_enabled(frame) + if protection_enabled or restrict_keyboard_interrupt_to_checkpoints: + deliver_cb() + else: + raise KeyboardInterrupt + + self.handler = handler + signal.signal(signal.SIGINT, handler) + + def close(self) -> None: + if self.handler is not None: + if signal.getsignal(signal.SIGINT) is self.handler: + signal.signal(signal.SIGINT, signal.default_int_handler) + self.handler = None diff --git a/contrib/python/trio/trio/_core/_local.py b/contrib/python/trio/trio/_core/_local.py new file mode 100644 index 000000000000..fff1234f59ef --- /dev/null +++ b/contrib/python/trio/trio/_core/_local.py @@ -0,0 +1,104 @@ +from __future__ import annotations + +from typing import Generic, TypeVar, cast + +# Runvar implementations +import attrs + +from .._util import NoPublicConstructor, final +from . import _run + +T = TypeVar("T") + + +@final +class _NoValue: ... + + +@final +@attrs.define(eq=False) +class RunVarToken(Generic[T], metaclass=NoPublicConstructor): + _var: RunVar[T] + previous_value: T | type[_NoValue] = _NoValue + redeemed: bool = attrs.field(default=False, init=False) + + @classmethod + def _empty(cls, var: RunVar[T]) -> RunVarToken[T]: + return cls._create(var) + + +@final +@attrs.define(eq=False, repr=False) +class RunVar(Generic[T]): + """The run-local variant of a context variable. + + :class:`RunVar` objects are similar to context variable objects, + except that they are shared across a single call to :func:`trio.run` + rather than a single task. + + """ + + _name: str = attrs.field(alias="name") + _default: T | type[_NoValue] = attrs.field(default=_NoValue, alias="default") + + def get(self, default: T | type[_NoValue] = _NoValue) -> T: + """Gets the value of this :class:`RunVar` for the current run call.""" + try: + return cast("T", _run.GLOBAL_RUN_CONTEXT.runner._locals[self]) + except AttributeError: + raise RuntimeError("Cannot be used outside of a run context") from None + except KeyError: + # contextvars consistency + # `type: ignore` awaiting https://github.com/python/mypy/issues/15553 to be fixed & released + if default is not _NoValue: + return default # type: ignore[return-value] + + if self._default is not _NoValue: + return self._default # type: ignore[return-value] + + raise LookupError(self) from None + + def set(self, value: T) -> RunVarToken[T]: + """Sets the value of this :class:`RunVar` for this current run + call. + + """ + try: + old_value = self.get() + except LookupError: + token = RunVarToken._empty(self) + else: + token = RunVarToken[T]._create(self, old_value) + + # This can't fail, because if we weren't in Trio context then the + # get() above would have failed. + _run.GLOBAL_RUN_CONTEXT.runner._locals[self] = value + return token + + def reset(self, token: RunVarToken[T]) -> None: + """Resets the value of this :class:`RunVar` to what it was + previously specified by the token. + + """ + if token is None: + raise TypeError("token must not be none") + + if token.redeemed: + raise ValueError("token has already been used") + + if token._var is not self: + raise ValueError("token is not for us") + + previous = token.previous_value + try: + if previous is _NoValue: + _run.GLOBAL_RUN_CONTEXT.runner._locals.pop(self) + else: + _run.GLOBAL_RUN_CONTEXT.runner._locals[self] = previous + except AttributeError: + raise RuntimeError("Cannot be used outside of a run context") from None + + token.redeemed = True + + def __repr__(self) -> str: + return f"" diff --git a/contrib/python/trio/trio/_core/_mock_clock.py b/contrib/python/trio/trio/_core/_mock_clock.py new file mode 100644 index 000000000000..e437464b65e9 --- /dev/null +++ b/contrib/python/trio/trio/_core/_mock_clock.py @@ -0,0 +1,165 @@ +import time +from math import inf + +from .. import _core +from .._abc import Clock +from .._util import final +from ._run import GLOBAL_RUN_CONTEXT + +################################################################ +# The glorious MockClock +################################################################ + + +# Prior art: +# https://twistedmatrix.com/documents/current/api/twisted.internet.task.Clock.html +# https://github.com/ztellman/manifold/issues/57 +@final +class MockClock(Clock): + """A user-controllable clock suitable for writing tests. + + Args: + rate (float): the initial :attr:`rate`. + autojump_threshold (float): the initial :attr:`autojump_threshold`. + + .. attribute:: rate + + How many seconds of clock time pass per second of real time. Default is + 0.0, i.e. the clock only advances through manuals calls to :meth:`jump` + or when the :attr:`autojump_threshold` is triggered. You can assign to + this attribute to change it. + + .. attribute:: autojump_threshold + + The clock keeps an eye on the run loop, and if at any point it detects + that all tasks have been blocked for this many real seconds (i.e., + according to the actual clock, not this clock), then the clock + automatically jumps ahead to the run loop's next scheduled + timeout. Default is :data:`math.inf`, i.e., to never autojump. You can + assign to this attribute to change it. + + Basically the idea is that if you have code or tests that use sleeps + and timeouts, you can use this to make it run much faster, totally + automatically. (At least, as long as those sleeps/timeouts are + happening inside Trio; if your test involves talking to external + service and waiting for it to timeout then obviously we can't help you + there.) + + You should set this to the smallest value that lets you reliably avoid + "false alarms" where some I/O is in flight (e.g. between two halves of + a socketpair) but the threshold gets triggered and time gets advanced + anyway. This will depend on the details of your tests and test + environment. If you aren't doing any I/O (like in our sleeping example + above) then just set it to zero, and the clock will jump whenever all + tasks are blocked. + + .. note:: If you use ``autojump_threshold`` and + `wait_all_tasks_blocked` at the same time, then you might wonder how + they interact, since they both cause things to happen after the run + loop goes idle for some time. The answer is: + `wait_all_tasks_blocked` takes priority. If there's a task blocked + in `wait_all_tasks_blocked`, then the autojump feature treats that + as active task and does *not* jump the clock. + + """ + + def __init__(self, rate: float = 0.0, autojump_threshold: float = inf) -> None: + # when the real clock said 'real_base', the virtual time was + # 'virtual_base', and since then it's advanced at 'rate' virtual + # seconds per real second. + self._real_base = 0.0 + self._virtual_base = 0.0 + self._rate = 0.0 + + # kept as an attribute so that our tests can monkeypatch it + self._real_clock = time.perf_counter + + # use the property update logic to set initial values + self.rate = rate + self.autojump_threshold = autojump_threshold + + def __repr__(self) -> str: + return f"" + + @property + def rate(self) -> float: + return self._rate + + @rate.setter + def rate(self, new_rate: float) -> None: + if new_rate < 0: + raise ValueError("rate must be >= 0") + else: + real = self._real_clock() + virtual = self._real_to_virtual(real) + self._virtual_base = virtual + self._real_base = real + self._rate = float(new_rate) + + @property + def autojump_threshold(self) -> float: + return self._autojump_threshold + + @autojump_threshold.setter + def autojump_threshold(self, new_autojump_threshold: float) -> None: + self._autojump_threshold = float(new_autojump_threshold) + self._try_resync_autojump_threshold() + + # runner.clock_autojump_threshold is an internal API that isn't easily + # usable by custom third-party Clock objects. If you need access to this + # functionality, let us know, and we'll figure out how to make a public + # API. Discussion: + # + # https://github.com/python-trio/trio/issues/1587 + def _try_resync_autojump_threshold(self) -> None: + try: + runner = GLOBAL_RUN_CONTEXT.runner + if runner.is_guest: + runner.force_guest_tick_asap() + except AttributeError: + pass + else: + if runner.clock is self: + runner.clock_autojump_threshold = self._autojump_threshold + + # Invoked by the run loop when runner.clock_autojump_threshold is + # exceeded. + def _autojump(self) -> None: + statistics = _core.current_statistics() + jump = statistics.seconds_to_next_deadline + if 0 < jump < inf: + self.jump(jump) + + def _real_to_virtual(self, real: float) -> float: + real_offset = real - self._real_base + virtual_offset = self._rate * real_offset + return self._virtual_base + virtual_offset + + def start_clock(self) -> None: + self._try_resync_autojump_threshold() + + def current_time(self) -> float: + return self._real_to_virtual(self._real_clock()) + + def deadline_to_sleep_time(self, deadline: float) -> float: + virtual_timeout = deadline - self.current_time() + if virtual_timeout <= 0: + return 0 + elif self._rate > 0: + return virtual_timeout / self._rate + else: + return 999999999 + + def jump(self, seconds: float) -> None: + """Manually advance the clock by the given number of seconds. + + Args: + seconds (float): the number of seconds to jump the clock forward. + + Raises: + ValueError: if you try to pass a negative value for ``seconds``. + + """ + if seconds < 0: + raise ValueError("time can't go backwards") + self._virtual_base += seconds diff --git a/contrib/python/trio/trio/_core/_parking_lot.py b/contrib/python/trio/trio/_core/_parking_lot.py new file mode 100644 index 000000000000..ddf62761176d --- /dev/null +++ b/contrib/python/trio/trio/_core/_parking_lot.py @@ -0,0 +1,317 @@ +# ParkingLot provides an abstraction for a fair waitqueue with cancellation +# and requeuing support. Inspiration: +# +# https://webkit.org/blog/6161/locking-in-webkit/ +# https://amanieu.github.io/parking_lot/ +# +# which were in turn heavily influenced by +# +# http://gee.cs.oswego.edu/dl/papers/aqs.pdf +# +# Compared to these, our use of cooperative scheduling allows some +# simplifications (no need for internal locking). On the other hand, the need +# to support Trio's strong cancellation semantics adds some complications +# (tasks need to know where they're queued so they can cancel). Also, in the +# above work, the ParkingLot is a global structure that holds a collection of +# waitqueues keyed by lock address, and which are opportunistically allocated +# and destroyed as contention arises; this allows the worst-case memory usage +# for all waitqueues to be O(#tasks). Here we allocate a separate wait queue +# for each synchronization object, so we're O(#objects + #tasks). This isn't +# *so* bad since compared to our synchronization objects are heavier than +# theirs and our tasks are lighter, so for us #objects is smaller and #tasks +# is larger. +# +# This is in the core because for two reasons. First, it's used by +# UnboundedQueue, and UnboundedQueue is used for a number of things in the +# core. And second, it's responsible for providing fairness to all of our +# high-level synchronization primitives (locks, queues, etc.). For now with +# our FIFO scheduler this is relatively trivial (it's just a FIFO waitqueue), +# but in the future we ever start support task priorities or fair scheduling +# +# https://github.com/python-trio/trio/issues/32 +# +# then all we'll have to do is update this. (Well, full-fledged task +# priorities might also require priority inheritance, which would require more +# work.) +# +# For discussion of data structures to use here, see: +# +# https://github.com/dabeaz/curio/issues/136 +# +# (and also the articles above). Currently we use a SortedDict ordered by a +# global monotonic counter that ensures FIFO ordering. The main advantage of +# this is that it's easy to implement :-). An intrusive doubly-linked list +# would also be a natural approach, so long as we only handle FIFO ordering. +# +# XX: should we switch to the shared global ParkingLot approach? +# +# XX: we should probably add support for "parking tokens" to allow for +# task-fair RWlock (basically: when parking a task needs to be able to mark +# itself as a reader or a writer, and then a task-fair wakeup policy is, wake +# the next task, and if it's a reader than keep waking tasks so long as they +# are readers). Without this I think you can implement write-biased or +# read-biased RWlocks (by using two parking lots and drawing from whichever is +# preferred), but not task-fair -- and task-fair plays much more nicely with +# WFQ. (Consider what happens in the two-lot implementation if you're +# write-biased but all the pending writers are blocked at the scheduler level +# by the WFQ logic...) +# ...alternatively, "phase-fair" RWlocks are pretty interesting: +# http://www.cs.unc.edu/~anderson/papers/ecrts09b.pdf +# Useful summary: +# https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReadWriteLock.html +# +# XX: if we do add WFQ, then we might have to drop the current feature where +# unpark returns the tasks that were unparked. Rationale: suppose that at the +# time we call unpark, the next task is deprioritized... and then, before it +# becomes runnable, a new task parks which *is* runnable. Ideally we should +# immediately wake the new task, and leave the old task on the queue for +# later. But this means we can't commit to which task we are unparking when +# unpark is called. +# +# See: https://github.com/python-trio/trio/issues/53 +from __future__ import annotations + +import inspect +import math +from collections import OrderedDict +from typing import TYPE_CHECKING + +import attrs +import outcome + +from .. import _core +from .._util import final + +if TYPE_CHECKING: + from collections.abc import Iterator + + from ._run import Task + + +GLOBAL_PARKING_LOT_BREAKER: dict[Task, list[ParkingLot]] = {} + + +def add_parking_lot_breaker(task: Task, lot: ParkingLot) -> None: + """Register a task as a breaker for a lot. See :meth:`ParkingLot.break_lot`. + + raises: + trio.BrokenResourceError: if the task has already exited. + """ + if inspect.getcoroutinestate(task.coro) == inspect.CORO_CLOSED: + raise _core._exceptions.BrokenResourceError( + "Attempted to add already exited task as lot breaker.", + ) + if task not in GLOBAL_PARKING_LOT_BREAKER: + GLOBAL_PARKING_LOT_BREAKER[task] = [lot] + else: + GLOBAL_PARKING_LOT_BREAKER[task].append(lot) + + +def remove_parking_lot_breaker(task: Task, lot: ParkingLot) -> None: + """Deregister a task as a breaker for a lot. See :meth:`ParkingLot.break_lot`""" + try: + GLOBAL_PARKING_LOT_BREAKER[task].remove(lot) + except (KeyError, ValueError): + raise RuntimeError( + "Attempted to remove task as breaker for a lot it is not registered for", + ) from None + if not GLOBAL_PARKING_LOT_BREAKER[task]: + del GLOBAL_PARKING_LOT_BREAKER[task] + + +@attrs.frozen +class ParkingLotStatistics: + """An object containing debugging information for a ParkingLot. + + Currently, the following fields are defined: + + * ``tasks_waiting`` (int): The number of tasks blocked on this lot's + :meth:`trio.lowlevel.ParkingLot.park` method. + + """ + + tasks_waiting: int + + +@final +@attrs.define(eq=False) +class ParkingLot: + """A fair wait queue with cancellation and requeuing. + + This class encapsulates the tricky parts of implementing a wait + queue. It's useful for implementing higher-level synchronization + primitives like queues and locks. + + In addition to the methods below, you can use ``len(parking_lot)`` to get + the number of parked tasks, and ``if parking_lot: ...`` to check whether + there are any parked tasks. + + """ + + # {task: None}, we just want a deque where we can quickly delete random + # items + _parked: OrderedDict[Task, None] = attrs.field(factory=OrderedDict, init=False) + broken_by: list[Task] = attrs.field(factory=list, init=False) + + def __len__(self) -> int: + """Returns the number of parked tasks.""" + return len(self._parked) + + def __bool__(self) -> bool: + """True if there are parked tasks, False otherwise.""" + return bool(self._parked) + + # XX this currently returns None + # if we ever add the ability to repark while one's resuming place in + # line (for false wakeups), then we could have it return a ticket that + # abstracts the "place in line" concept. + @_core.enable_ki_protection + async def park(self) -> None: + """Park the current task until woken by a call to :meth:`unpark` or + :meth:`unpark_all`. + + Raises: + BrokenResourceError: if attempting to park in a broken lot, or the lot + breaks before we get to unpark. + + """ + if self.broken_by: + raise _core.BrokenResourceError( + f"Attempted to park in parking lot broken by {self.broken_by}", + ) + task = _core.current_task() + self._parked[task] = None + task.custom_sleep_data = self + + def abort_fn(_: _core.RaiseCancelT) -> _core.Abort: + del task.custom_sleep_data._parked[task] + return _core.Abort.SUCCEEDED + + await _core.wait_task_rescheduled(abort_fn) + + def _pop_several(self, count: int | float) -> Iterator[Task]: # noqa: PYI041 + if isinstance(count, float): + if math.isinf(count): + count = len(self._parked) + else: + raise ValueError("Cannot pop a non-integer number of tasks.") + else: + count = min(count, len(self._parked)) + for _ in range(count): + task, _ = self._parked.popitem(last=False) + yield task + + @_core.enable_ki_protection + def unpark(self, *, count: int | float = 1) -> list[Task]: # noqa: PYI041 + """Unpark one or more tasks. + + This wakes up ``count`` tasks that are blocked in :meth:`park`. If + there are fewer than ``count`` tasks parked, then wakes as many tasks + are available and then returns successfully. + + Args: + count (int | math.inf): the number of tasks to unpark. + + """ + tasks = list(self._pop_several(count)) + for task in tasks: + _core.reschedule(task) + return tasks + + def unpark_all(self) -> list[Task]: + """Unpark all parked tasks.""" + return self.unpark(count=len(self)) + + @_core.enable_ki_protection + def repark( + self, + new_lot: ParkingLot, + *, + count: int | float = 1, # noqa: PYI041 + ) -> None: + """Move parked tasks from one :class:`ParkingLot` object to another. + + This dequeues ``count`` tasks from one lot, and requeues them on + another, preserving order. For example:: + + async def parker(lot): + print("sleeping") + await lot.park() + print("woken") + + async def main(): + lot1 = trio.lowlevel.ParkingLot() + lot2 = trio.lowlevel.ParkingLot() + async with trio.open_nursery() as nursery: + nursery.start_soon(parker, lot1) + await trio.testing.wait_all_tasks_blocked() + assert len(lot1) == 1 + assert len(lot2) == 0 + lot1.repark(lot2) + assert len(lot1) == 0 + assert len(lot2) == 1 + # This wakes up the task that was originally parked in lot1 + lot2.unpark() + + If there are fewer than ``count`` tasks parked, then reparks as many + tasks as are available and then returns successfully. + + Args: + new_lot (ParkingLot): the parking lot to move tasks to. + count (int|math.inf): the number of tasks to move. + + """ + if not isinstance(new_lot, ParkingLot): + raise TypeError("new_lot must be a ParkingLot") + for task in self._pop_several(count): + new_lot._parked[task] = None + task.custom_sleep_data = new_lot + + def repark_all(self, new_lot: ParkingLot) -> None: + """Move all parked tasks from one :class:`ParkingLot` object to + another. + + See :meth:`repark` for details. + + """ + return self.repark(new_lot, count=len(self)) + + def break_lot(self, task: Task | None = None) -> None: + """Break this lot, with ``task`` noted as the task that broke it. + + This causes all parked tasks to raise an error, and any + future tasks attempting to park to error. Unpark & repark become no-ops as the + parking lot is empty. + + The error raised contains a reference to the task sent as a parameter. The task + is also saved in the parking lot in the ``broken_by`` attribute. + """ + if task is None: + task = _core.current_task() + + # if lot is already broken, just mark this as another breaker and return + if self.broken_by: + self.broken_by.append(task) + return + + self.broken_by.append(task) + + for parked_task in self._parked: + _core.reschedule( + parked_task, + outcome.Error( + _core.BrokenResourceError(f"Parking lot broken by {task}"), + ), + ) + self._parked.clear() + + def statistics(self) -> ParkingLotStatistics: + """Return an object containing debugging information. + + Currently the following fields are defined: + + * ``tasks_waiting``: The number of tasks blocked on this lot's + :meth:`park` method. + + """ + return ParkingLotStatistics(tasks_waiting=len(self._parked)) diff --git a/contrib/python/trio/trio/_core/_run.py b/contrib/python/trio/trio/_core/_run.py new file mode 100644 index 000000000000..5303dfe75d4d --- /dev/null +++ b/contrib/python/trio/trio/_core/_run.py @@ -0,0 +1,3139 @@ +from __future__ import annotations + +import enum +import functools +import gc +import itertools +import random +import select +import sys +import warnings +from collections import deque +from contextlib import AbstractAsyncContextManager, contextmanager, suppress +from contextvars import copy_context +from heapq import heapify, heappop, heappush +from math import inf, isnan +from time import perf_counter +from typing import ( + TYPE_CHECKING, + Any, + Final, + NoReturn, + Protocol, + cast, + overload, +) + +import attrs +from outcome import Error, Outcome, Value, capture +from sniffio import thread_local as sniffio_library +from sortedcontainers import SortedDict + +from .. import _core +from .._abc import Clock, Instrument +from .._deprecate import warn_deprecated +from .._util import NoPublicConstructor, coroutine_or_error, final +from ._asyncgens import AsyncGenerators +from ._concat_tb import concat_tb +from ._entry_queue import EntryQueue, TrioToken +from ._exceptions import ( + Cancelled, + CancelReasonLiteral, + RunFinishedError, + TrioInternalError, +) +from ._instrumentation import Instruments +from ._ki import KIManager, enable_ki_protection +from ._parking_lot import GLOBAL_PARKING_LOT_BREAKER +from ._run_context import GLOBAL_RUN_CONTEXT as GLOBAL_RUN_CONTEXT +from ._thread_cache import start_thread_soon +from ._traps import ( + Abort, + CancelShieldedCheckpoint, + PermanentlyDetachCoroutineObject, + WaitTaskRescheduled, + cancel_shielded_checkpoint, + wait_task_rescheduled, +) + +if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup + + +if TYPE_CHECKING: + import contextvars + import types + from collections.abc import ( + Awaitable, + Callable, + Generator, + Iterator, + Sequence, + ) + from types import TracebackType + + # for some strange reason Sphinx works with outcome.Outcome, but not Outcome, in + # start_guest_run. Same with types.FrameType in iter_await_frames + import outcome + from typing_extensions import Self, TypeVar, TypeVarTuple, Unpack + + PosArgT = TypeVarTuple("PosArgT") + StatusT = TypeVar("StatusT", default=None) + StatusT_contra = TypeVar("StatusT_contra", contravariant=True, default=None) + BaseExcT = TypeVar("BaseExcT", bound=BaseException) +else: + from typing import TypeVar + + StatusT = TypeVar("StatusT") + StatusT_contra = TypeVar("StatusT_contra", contravariant=True) + +RetT = TypeVar("RetT") + + +DEADLINE_HEAP_MIN_PRUNE_THRESHOLD: Final = 1000 + +# Passed as a sentinel +_NO_SEND: Final[Outcome[object]] = cast("Outcome[object]", object()) + +# Used to track if an exceptiongroup can be collapsed +NONSTRICT_EXCEPTIONGROUP_NOTE = 'This is a "loose" ExceptionGroup, and may be collapsed by Trio if it only contains one exception - typically after `Cancelled` has been stripped from it. Note this has consequences for exception handling, and strict_exception_groups=True is recommended.' + + +@final +class _NoStatus(metaclass=NoPublicConstructor): + """Sentinel for unset TaskStatus._value.""" + + +# Decorator to mark methods public. This does nothing by itself, but +# trio/_tools/gen_exports.py looks for it. +def _public(fn: RetT) -> RetT: + return fn + + +# When running under Hypothesis, we want examples to be reproducible and +# shrinkable. We therefore register `_hypothesis_plugin_setup()` as a +# plugin, so that importing *Hypothesis* will make Trio's task +# scheduling loop deterministic. We have a test for that, of course. +# Before Hypothesis supported entry-point plugins this integration was +# handled by pytest-trio, but we want it to work in e.g. unittest too. +_ALLOW_DETERMINISTIC_SCHEDULING: Final = False +_r = random.Random() + + +# no cover because we don't check the hypothesis plugin works with hypothesis +def _hypothesis_plugin_setup() -> None: # pragma: no cover + from hypothesis import register_random + + global _ALLOW_DETERMINISTIC_SCHEDULING + _ALLOW_DETERMINISTIC_SCHEDULING = True # type: ignore + register_random(_r) + + # monkeypatch repr_callable to make repr's way better + # requires importing hypothesis (in the test file or in conftest.py) + try: + from hypothesis.internal.reflection import get_pretty_function_description + + import trio.testing._raises_group + + def repr_callable(fun: Callable[[BaseExcT], bool]) -> str: + # add quotes around the signature + return repr(get_pretty_function_description(fun)) + + trio.testing._raises_group.repr_callable = repr_callable + except ImportError: + pass + + +def _count_context_run_tb_frames() -> int: + """Count implementation dependent traceback frames from Context.run() + + On CPython, Context.run() is implemented in C and doesn't show up in + tracebacks. On PyPy, it is implemented in Python and adds 1 frame to + tracebacks. + + Returns: + int: Traceback frame count + + """ + + def function_with_unique_name_xyzzy() -> NoReturn: + try: + 1 / 0 # noqa: B018 # We need a ZeroDivisionError to fire + except ZeroDivisionError: + raise + else: # pragma: no cover + raise TrioInternalError( + "A ZeroDivisionError should have been raised, but it wasn't.", + ) + + ctx = copy_context() + try: + ctx.run(function_with_unique_name_xyzzy) + except ZeroDivisionError as exc: + tb = exc.__traceback__ + # Skip the frame where we caught it + tb = tb.tb_next # type: ignore[union-attr] + count = 0 + while tb.tb_frame.f_code.co_name != "function_with_unique_name_xyzzy": # type: ignore[union-attr] + tb = tb.tb_next # type: ignore[union-attr] + count += 1 + return count + else: # pragma: no cover + raise TrioInternalError( + f"The purpose of {function_with_unique_name_xyzzy.__name__} is " + "to raise a ZeroDivisionError, but it didn't.", + ) + + +CONTEXT_RUN_TB_FRAMES: Final = _count_context_run_tb_frames() + + +@attrs.frozen +class SystemClock(Clock): + # Add a large random offset to our clock to ensure that if people + # accidentally call time.perf_counter() directly or start comparing clocks + # between different runs, then they'll notice the bug quickly: + offset: float = attrs.Factory(lambda: _r.uniform(10000, 200000)) + + def start_clock(self) -> None: + pass + + # In cPython 3, on every platform except Windows, perf_counter is + # exactly the same as time.monotonic; and on Windows, it uses + # QueryPerformanceCounter instead of GetTickCount64. + def current_time(self) -> float: + return self.offset + perf_counter() + + def deadline_to_sleep_time(self, deadline: float) -> float: + return deadline - self.current_time() + + +class IdlePrimedTypes(enum.Enum): + WAITING_FOR_IDLE = 1 + AUTOJUMP_CLOCK = 2 + + +################################################################ +# CancelScope and friends +################################################################ + + +def collapse_exception_group( + excgroup: BaseExceptionGroup[BaseException], +) -> BaseException: + """Recursively collapse any single-exception groups into that single contained + exception. + + """ + exceptions = list(excgroup.exceptions) + modified = False + for i, exc in enumerate(exceptions): + if isinstance(exc, BaseExceptionGroup): + new_exc = collapse_exception_group(exc) + if new_exc is not exc: + modified = True + exceptions[i] = new_exc + + if ( + len(exceptions) == 1 + and isinstance(excgroup, BaseExceptionGroup) + and NONSTRICT_EXCEPTIONGROUP_NOTE in getattr(excgroup, "__notes__", ()) + ): + exceptions[0].__traceback__ = concat_tb( + excgroup.__traceback__, + exceptions[0].__traceback__, + ) + return exceptions[0] + elif modified: + return excgroup.derive(exceptions) + else: + return excgroup + + +@attrs.define(eq=False) +class Deadlines: + """A container of deadlined cancel scopes. + + Only contains scopes with non-infinite deadlines that are currently + attached to at least one task. + + """ + + # Heap of (deadline, id(CancelScope), CancelScope) + _heap: list[tuple[float, int, CancelScope]] = attrs.Factory(list) + # Count of active deadlines (those that haven't been changed) + _active: int = 0 + + def add(self, deadline: float, cancel_scope: CancelScope) -> None: + heappush(self._heap, (deadline, id(cancel_scope), cancel_scope)) + self._active += 1 + + def remove(self, deadline: float, cancel_scope: CancelScope) -> None: + self._active -= 1 + + def next_deadline(self) -> float: + while self._heap: + deadline, _, cancel_scope = self._heap[0] + if deadline == cancel_scope._registered_deadline: + return deadline + else: + # This entry is stale; discard it and try again + heappop(self._heap) + return inf + + def _prune(self) -> None: + # In principle, it's possible for a cancel scope to toggle back and + # forth repeatedly between the same two deadlines, and end up with + # lots of stale entries that *look* like they're still active, because + # their deadline is correct, but in fact are redundant. So when + # pruning we have to eliminate entries with the wrong deadline, *and* + # eliminate duplicates. + seen = set() + pruned_heap = [] + for deadline, tiebreaker, cancel_scope in self._heap: + if deadline == cancel_scope._registered_deadline: + if cancel_scope in seen: + continue + seen.add(cancel_scope) + pruned_heap.append((deadline, tiebreaker, cancel_scope)) + # See test_cancel_scope_deadline_duplicates for a test that exercises + # this assert: + assert len(pruned_heap) == self._active + heapify(pruned_heap) + self._heap = pruned_heap + + def expire(self, now: float) -> bool: + did_something = False + while self._heap and self._heap[0][0] <= now: + deadline, _, cancel_scope = heappop(self._heap) + if deadline == cancel_scope._registered_deadline: + did_something = True + # This implicitly calls self.remove(), so we don't need to + # decrement _active here + cancel_scope._cancel(CancelReason(source="deadline")) + # If we've accumulated too many stale entries, then prune the heap to + # keep it under control. (We only do this occasionally in a batch, to + # keep the amortized cost down) + if len(self._heap) > self._active * 2 + DEADLINE_HEAP_MIN_PRUNE_THRESHOLD: + self._prune() + return did_something + + +@attrs.define +class CancelReason: + """Attached to a :class:`CancelScope` upon cancellation with details of the source of the + cancellation, which is then used to construct the string in a :exc:`Cancelled`. + Users can pass a ``reason`` str to :meth:`CancelScope.cancel` to set it. + + Not publicly exported or documented. + """ + + source: CancelReasonLiteral + source_task: str | None = None + reason: str | None = None + + +@attrs.define(eq=False) +class CancelStatus: + """Tracks the cancellation status for a contiguous extent + of code that will become cancelled, or not, as a unit. + + Each task has at all times a single "active" CancelStatus whose + cancellation state determines whether checkpoints executed in that + task raise Cancelled. Each 'with CancelScope(...)' context is + associated with a particular CancelStatus. When a task enters + such a context, a CancelStatus is created which becomes the active + CancelStatus for that task; when the 'with' block is exited, the + active CancelStatus for that task goes back to whatever it was + before. + + CancelStatus objects are arranged in a tree whose structure + mirrors the lexical nesting of the cancel scope contexts. When a + CancelStatus becomes cancelled, it notifies all of its direct + children, who become cancelled in turn (and continue propagating + the cancellation down the tree) unless they are shielded. (There + will be at most one such child except in the case of a + CancelStatus that immediately encloses a nursery.) At the leaves + of this tree are the tasks themselves, which get woken up to deliver + an abort when their direct parent CancelStatus becomes cancelled. + + You can think of CancelStatus as being responsible for the + "plumbing" of cancellations as oppposed to CancelScope which is + responsible for the origination of them. + + """ + + # Our associated cancel scope. Can be any object with attributes + # `deadline`, `shield`, and `cancel_called`, but in current usage + # is always a CancelScope object. Must not be None. + _scope: CancelScope = attrs.field(alias="scope") + + # True iff the tasks in self._tasks should receive cancellations + # when they checkpoint. Always True when scope.cancel_called is True; + # may also be True due to a cancellation propagated from our + # parent. Unlike scope.cancel_called, this does not necessarily stay + # true once it becomes true. For example, we might become + # effectively cancelled due to the cancel scope two levels out + # becoming cancelled, but then the cancel scope one level out + # becomes shielded so we're not effectively cancelled anymore. + effectively_cancelled: bool = False + + # The CancelStatus whose cancellations can propagate to us; we + # become effectively cancelled when they do, unless scope.shield + # is True. May be None (for the outermost CancelStatus in a call + # to trio.run(), briefly during TaskStatus.started(), or during + # recovery from misnesting of cancel scopes). + _parent: CancelStatus | None = attrs.field(default=None, repr=False, alias="parent") + + # All of the CancelStatuses that have this CancelStatus as their parent. + _children: set[CancelStatus] = attrs.field(factory=set, init=False, repr=False) + + # Tasks whose cancellation state is currently tied directly to + # the cancellation state of this CancelStatus object. Don't modify + # this directly; instead, use Task._activate_cancel_status(). + # Invariant: all(task._cancel_status is self for task in self._tasks) + _tasks: set[Task] = attrs.field(factory=set, init=False, repr=False) + + # Set to True on still-active cancel statuses that are children + # of a cancel status that's been closed. This is used to permit + # recovery from misnested cancel scopes (well, at least enough + # recovery to show a useful traceback). + abandoned_by_misnesting: bool = attrs.field(default=False, init=False, repr=False) + + def __attrs_post_init__(self) -> None: + if self._parent is not None: + self._parent._children.add(self) + self.recalculate() + + # parent/children/tasks accessors are used by TaskStatus.started() + + @property + def parent(self) -> CancelStatus | None: + return self._parent + + @parent.setter + def parent(self, parent: CancelStatus | None) -> None: + if self._parent is not None: + self._parent._children.remove(self) + self._parent = parent + if self._parent is not None: + self._parent._children.add(self) + self.recalculate() + + @property + def children(self) -> frozenset[CancelStatus]: + return frozenset(self._children) + + @property + def tasks(self) -> frozenset[Task]: + return frozenset(self._tasks) + + def encloses(self, other: CancelStatus | None) -> bool: + """Returns true if this cancel status is a direct or indirect + parent of cancel status *other*, or if *other* is *self*. + """ + while other is not None: + if other is self: + return True + other = other.parent + return False + + def close(self) -> None: + self.parent = None # now we're not a child of self.parent anymore + if self._tasks or self._children: + # Cancel scopes weren't exited in opposite order of being + # entered. CancelScope._close() deals with raising an error + # if appropriate; our job is to leave things in a reasonable + # state for unwinding our dangling children. We choose to leave + # this part of the CancelStatus tree unlinked from everyone + # else, cancelled, and marked so that exiting a CancelScope + # within the abandoned subtree doesn't affect the active + # CancelStatus. Note that it's possible for us to get here + # without CancelScope._close() raising an error, if a + # nursery's cancel scope is closed within the nursery's + # nested child and no other cancel scopes are involved, + # but in that case task_exited() will deal with raising + # the error. + self._mark_abandoned() + + # Since our CancelScope is about to forget about us, and we + # have no parent anymore, there's nothing left to call + # recalculate(). So, we can stay cancelled by setting + # effectively_cancelled and updating our children. + self.effectively_cancelled = True + for task in self._tasks: + task._attempt_delivery_of_any_pending_cancel() + for child in self._children: + child.recalculate() + + @property + def parent_cancellation_is_visible_to_us(self) -> bool: + return ( + self._parent is not None + and not self._scope.shield + and self._parent.effectively_cancelled + ) + + def recalculate(self) -> None: + # This does a depth-first traversal over this and descendent cancel + # statuses, to ensure their state is up-to-date. It's basically a + # recursive algorithm, but we use an explicit stack to avoid any + # issues with stack overflow. + todo = [self] + while todo: + current = todo.pop() + new_state = ( + current._scope.cancel_called + or current.parent_cancellation_is_visible_to_us + ) + if new_state != current.effectively_cancelled: + if ( + current._scope._cancel_reason is None + and current.parent_cancellation_is_visible_to_us + ): + assert current._parent is not None + current._scope._cancel_reason = ( + current._parent._scope._cancel_reason + ) + current.effectively_cancelled = new_state + if new_state: + for task in current._tasks: + task._attempt_delivery_of_any_pending_cancel() + todo.extend(current._children) + + def _mark_abandoned(self) -> None: + self.abandoned_by_misnesting = True + for child in self._children: + child._mark_abandoned() + + def effective_deadline(self) -> float: + if self.effectively_cancelled: + return -inf + if self._parent is None or self._scope.shield: + return self._scope.deadline + return min(self._scope.deadline, self._parent.effective_deadline()) + + +MISNESTING_ADVICE = """ +This is probably a bug in your code, that has caused Trio's internal state to +become corrupted. We'll do our best to recover, but from now on there are +no guarantees. + +Typically this is caused by one of the following: + - yielding within a generator or async generator that's opened a cancel + scope or nursery (unless the generator is a @contextmanager or + @asynccontextmanager); see https://github.com/python-trio/trio/issues/638 + - manually calling __enter__ or __exit__ on a trio.CancelScope, or + __aenter__ or __aexit__ on the object returned by trio.open_nursery(); + doing so correctly is difficult and you should use @[async]contextmanager + instead, or maybe [Async]ExitStack + - using [Async]ExitStack to interleave the entries/exits of cancel scopes + and/or nurseries in a way that couldn't be achieved by some nesting of + 'with' and 'async with' blocks + - using the low-level coroutine object protocol to execute some parts of + an async function in a different cancel scope/nursery context than + other parts +If you don't believe you're doing any of these things, please file a bug: +https://github.com/python-trio/trio/issues/new +""" + + +@final +@attrs.define(eq=False, repr=False) +class CancelScope: + """A *cancellation scope*: the link between a unit of cancellable + work and Trio's cancellation system. + + A :class:`CancelScope` becomes associated with some cancellable work + when it is used as a context manager surrounding that work:: + + cancel_scope = trio.CancelScope() + ... + with cancel_scope: + await long_running_operation() + + Inside the ``with`` block, a cancellation of ``cancel_scope`` (via + a call to its :meth:`cancel` method or via the expiry of its + :attr:`deadline`) will immediately interrupt the + ``long_running_operation()`` by raising :exc:`Cancelled` at its + next :ref:`checkpoint `. + + The context manager ``__enter__`` returns the :class:`CancelScope` + object itself, so you can also write ``with trio.CancelScope() as + cancel_scope:``. + + If a cancel scope becomes cancelled before entering its ``with`` block, + the :exc:`Cancelled` exception will be raised at the first + checkpoint inside the ``with`` block. This allows a + :class:`CancelScope` to be created in one :ref:`task ` and + passed to another, so that the first task can later cancel some work + inside the second. + + Cancel scopes are not reusable or reentrant; that is, each cancel + scope can be used for at most one ``with`` block. (You'll get a + :exc:`RuntimeError` if you violate this rule.) + + The :class:`CancelScope` constructor takes initial values for the + cancel scope's :attr:`deadline` and :attr:`shield` attributes; these + may be freely modified after construction, whether or not the scope + has been entered yet, and changes take immediate effect. + """ + + _cancel_status: CancelStatus | None = attrs.field(default=None, init=False) + _has_been_entered: bool = attrs.field(default=False, init=False) + _registered_deadline: float = attrs.field(default=inf, init=False) + _cancel_called: bool = attrs.field(default=False, init=False) + cancelled_caught: bool = attrs.field(default=False, init=False) + + _cancel_reason: CancelReason | None = attrs.field(default=None, init=False) + + # Constructor arguments: + _relative_deadline: float = attrs.field( + default=inf, + kw_only=True, + alias="relative_deadline", + ) + _deadline: float = attrs.field(default=inf, kw_only=True, alias="deadline") + _shield: bool = attrs.field(default=False, kw_only=True, alias="shield") + + def __attrs_post_init__(self) -> None: + if isnan(self._deadline): + raise ValueError("deadline must not be NaN") + if isnan(self._relative_deadline): + raise ValueError("relative deadline must not be NaN") + if self._relative_deadline < 0: + raise ValueError("timeout must be non-negative") + if self._relative_deadline != inf and self._deadline != inf: + raise ValueError( + "Cannot specify both a deadline and a relative deadline", + ) + + @enable_ki_protection + def __enter__(self) -> Self: + task = _core.current_task() + if self._has_been_entered: + raise RuntimeError( + "Each CancelScope may only be used for a single 'with' block", + ) + self._has_been_entered = True + + if self._relative_deadline != inf: + assert self._deadline == inf + self._deadline = current_time() + self._relative_deadline + self._relative_deadline = inf + + if current_time() >= self._deadline: + self._cancel(CancelReason(source="deadline")) + with self._might_change_registered_deadline(): + self._cancel_status = CancelStatus(scope=self, parent=task._cancel_status) + task._activate_cancel_status(self._cancel_status) + return self + + def _close(self, exc: BaseException | None) -> BaseException | None: + if self._cancel_status is None: + new_exc = RuntimeError( + f"Cancel scope stack corrupted: attempted to exit {self!r} " + "which had already been exited", + ) + new_exc.__context__ = exc + return new_exc + scope_task = current_task() + if scope_task._cancel_status is not self._cancel_status: + # Cancel scope misnesting: this cancel scope isn't the most + # recently opened by this task (that's still open). That is, + # our assumptions about context managers forming a stack + # have been violated. Try and make the best of it. + if self._cancel_status.abandoned_by_misnesting: + # We are an inner cancel scope that was still active when + # some outer scope was closed. The closure of that outer + # scope threw an error, so we don't need to throw another + # one; it would just confuse the traceback. + pass + elif not self._cancel_status.encloses(scope_task._cancel_status): + # This task isn't even indirectly contained within the + # cancel scope it's trying to close. Raise an error + # without changing any state. + new_exc = RuntimeError( + f"Cancel scope stack corrupted: attempted to exit {self!r} " + f"from unrelated {scope_task!r}\n{MISNESTING_ADVICE}", + ) + new_exc.__context__ = exc + return new_exc + else: + # Otherwise, there's some inner cancel scope(s) that + # we're abandoning by closing this outer one. + # CancelStatus.close() will take care of the plumbing; + # we just need to make sure we don't let the error + # pass silently. + new_exc = RuntimeError( + f"Cancel scope stack corrupted: attempted to exit {self!r} " + f"in {scope_task!r} that's still within its child {scope_task._cancel_status._scope!r}\n{MISNESTING_ADVICE}", + ) + new_exc.__context__ = exc + exc = new_exc + scope_task._activate_cancel_status(self._cancel_status.parent) + else: + scope_task._activate_cancel_status(self._cancel_status.parent) + if ( + exc is not None + and self._cancel_status.effectively_cancelled + and not self._cancel_status.parent_cancellation_is_visible_to_us + ) or ( + scope_task._cancel_status is not self._cancel_status + and self._cancel_status.abandoned_by_misnesting + ): + if isinstance(exc, Cancelled): + self.cancelled_caught = True + exc = None + elif isinstance(exc, BaseExceptionGroup): + matched, exc = exc.split(Cancelled) + if matched: + self.cancelled_caught = True + + if exc: + exc = collapse_exception_group(exc) + + self._cancel_status.close() + with self._might_change_registered_deadline(): + self._cancel_status = None + return exc + + @enable_ki_protection + def __exit__( + self, + etype: type[BaseException] | None, + exc: BaseException | None, + tb: TracebackType | None, + ) -> bool: + # NB: NurseryManager calls _close() directly rather than __exit__(), + # so __exit__() must be just _close() plus this logic for adapting + # the exception-filtering result to the context manager API. + + # Tracebacks show the 'raise' line below out of context, so let's give + # this variable a name that makes sense out of context. + remaining_error_after_cancel_scope = self._close(exc) + if remaining_error_after_cancel_scope is None: + return True + elif remaining_error_after_cancel_scope is exc: + return False + else: + # Copied verbatim from the old MultiErrorCatcher. Python doesn't + # allow us to encapsulate this __context__ fixup. + old_context = remaining_error_after_cancel_scope.__context__ + try: + raise remaining_error_after_cancel_scope + finally: + _, value, _ = sys.exc_info() + assert value is remaining_error_after_cancel_scope + value.__context__ = old_context + # delete references from locals to avoid creating cycles + # see test_cancel_scope_exit_doesnt_create_cyclic_garbage + # Note: still relevant + del remaining_error_after_cancel_scope, value, _, exc + + def __repr__(self) -> str: + if self._cancel_status is not None: + binding = "active" + elif self._has_been_entered: + binding = "exited" + else: + binding = "unbound" + + if self._cancel_called: + state = ", cancelled" + elif self._deadline == inf: + state = "" + else: + try: + now = current_time() + except RuntimeError: # must be called from async context + state = "" + else: + state = ", deadline is {:.2f} seconds {}".format( + abs(self._deadline - now), + "from now" if self._deadline >= now else "ago", + ) + + return f"" + + @contextmanager + @enable_ki_protection + def _might_change_registered_deadline(self) -> Iterator[None]: + try: + yield + finally: + old = self._registered_deadline + if self._cancel_status is None or self._cancel_called: + new = inf + else: + new = self._deadline + if old != new: + self._registered_deadline = new + runner = GLOBAL_RUN_CONTEXT.runner + if runner.is_guest: + old_next_deadline = runner.deadlines.next_deadline() + if old != inf: + runner.deadlines.remove(old, self) + if new != inf: + runner.deadlines.add(new, self) + if runner.is_guest: + new_next_deadline = runner.deadlines.next_deadline() + if old_next_deadline != new_next_deadline: + runner.force_guest_tick_asap() + + @property + def deadline(self) -> float: + """Read-write, :class:`float`. An absolute time on the current + run's clock at which this scope will automatically become + cancelled. You can adjust the deadline by modifying this + attribute, e.g.:: + + # I need a little more time! + cancel_scope.deadline += 30 + + Note that for efficiency, the core run loop only checks for + expired deadlines every once in a while. This means that in + certain cases there may be a short delay between when the clock + says the deadline should have expired, and when checkpoints + start raising :exc:`~trio.Cancelled`. This is a very obscure + corner case that you're unlikely to notice, but we document it + for completeness. (If this *does* cause problems for you, of + course, then `we want to know! + `__) + + Defaults to :data:`math.inf`, which means "no deadline", though + this can be overridden by the ``deadline=`` argument to + the :class:`~trio.CancelScope` constructor. + """ + if self._relative_deadline != inf: + assert self._deadline == inf + warnings.warn( + DeprecationWarning( + "unentered relative cancel scope does not have an absolute deadline. Use `.relative_deadline`", + ), + stacklevel=2, + ) + return current_time() + self._relative_deadline + return self._deadline + + @deadline.setter + def deadline(self, new_deadline: float) -> None: + if isnan(new_deadline): + raise ValueError("deadline must not be NaN") + if self._relative_deadline != inf: + assert self._deadline == inf + warnings.warn( + DeprecationWarning( + "unentered relative cancel scope does not have an absolute deadline. Transforming into an absolute cancel scope. First set `.relative_deadline = math.inf` if you do want an absolute cancel scope.", + ), + stacklevel=2, + ) + self._relative_deadline = inf + with self._might_change_registered_deadline(): + self._deadline = float(new_deadline) + + @property + def relative_deadline(self) -> float: + """Read-write, :class:`float`. The number of seconds remaining until this + scope's deadline, relative to the current time. + + Defaults to :data:`math.inf` ("no deadline"). Must be non-negative. + + When modified + Before entering: sets the deadline relative to when the scope enters. + After entering: sets a new deadline relative to the current time. + + Raises: + RuntimeError: if trying to read or modify an unentered scope with an absolute deadline, i.e. when :attr:`is_relative` is ``False``. + """ + if self._has_been_entered: + return self._deadline - current_time() + elif self._deadline != inf: + assert self._relative_deadline == inf + raise RuntimeError( + "unentered non-relative cancel scope does not have a relative deadline", + ) + return self._relative_deadline + + @relative_deadline.setter + def relative_deadline(self, new_relative_deadline: float) -> None: + if isnan(new_relative_deadline): + raise ValueError("relative deadline must not be NaN") + if new_relative_deadline < 0: + raise ValueError("relative deadline must be non-negative") + if self._has_been_entered: + with self._might_change_registered_deadline(): + self._deadline = current_time() + float(new_relative_deadline) + elif self._deadline != inf: + assert self._relative_deadline == inf + raise RuntimeError( + "unentered non-relative cancel scope does not have a relative deadline", + ) + else: + self._relative_deadline = new_relative_deadline + + @property + def is_relative(self) -> bool | None: + """Returns None after entering. Returns False if both deadline and + relative_deadline are inf.""" + assert not (self._deadline != inf and self._relative_deadline != inf) + if self._has_been_entered: + return None + return self._relative_deadline != inf + + @property + def shield(self) -> bool: + """Read-write, :class:`bool`, default :data:`False`. So long as + this is set to :data:`True`, then the code inside this scope + will not receive :exc:`~trio.Cancelled` exceptions from scopes + that are outside this scope. They can still receive + :exc:`~trio.Cancelled` exceptions from (1) this scope, or (2) + scopes inside this scope. You can modify this attribute:: + + with trio.CancelScope() as cancel_scope: + cancel_scope.shield = True + # This cannot be interrupted by any means short of + # killing the process: + await sleep(10) + + cancel_scope.shield = False + # Now this can be cancelled normally: + await sleep(10) + + Defaults to :data:`False`, though this can be overridden by the + ``shield=`` argument to the :class:`~trio.CancelScope` constructor. + """ + return self._shield + + @shield.setter + @enable_ki_protection + def shield(self, new_value: bool) -> None: + if not isinstance(new_value, bool): + raise TypeError("shield must be a bool") + self._shield = new_value + if self._cancel_status is not None: + self._cancel_status.recalculate() + + @enable_ki_protection + def _cancel(self, cancel_reason: CancelReason | None) -> None: + """Internal sources of cancellation should use this instead of :meth:`cancel` + in order to set a more detailed :class:`CancelReason` + Helper or high-level functions can use `cancel`. + """ + if self._cancel_called: + return + + if self._cancel_reason is None: + self._cancel_reason = cancel_reason + + with self._might_change_registered_deadline(): + self._cancel_called = True + + if self._cancel_status is not None: + self._cancel_status.recalculate() + + @enable_ki_protection + def cancel(self, reason: str | None = None) -> None: + """Cancels this scope immediately. + + The optional ``reason`` argument accepts a string, which will be attached to + any resulting :exc:`Cancelled` exception to help you understand where that + cancellation is coming from and why it happened. + + This method is idempotent, i.e., if the scope was already + cancelled then this method silently does nothing. + """ + try: + current_task = repr(_core.current_task()) + except RuntimeError: + current_task = None + self._cancel( + CancelReason(reason=reason, source="explicit", source_task=current_task) + ) + + @property + def cancel_called(self) -> bool: + """Readonly :class:`bool`. Records whether cancellation has been + requested for this scope, either by an explicit call to + :meth:`cancel` or by the deadline expiring. + + This attribute being True does *not* necessarily mean that the + code within the scope has been, or will be, affected by the + cancellation. For example, if :meth:`cancel` was called after + the last checkpoint in the ``with`` block, when it's too late to + deliver a :exc:`~trio.Cancelled` exception, then this attribute + will still be True. + + This attribute is mostly useful for debugging and introspection. + If you want to know whether or not a chunk of code was actually + cancelled, then :attr:`cancelled_caught` is usually more + appropriate. + """ + if ( # noqa: SIM102 # collapsible-if but this way is nicer + self._cancel_status is not None or not self._has_been_entered + ): + # Scope is active or not yet entered: make sure cancel_called + # is true if the deadline has passed. This shouldn't + # be able to actually change behavior, since we check for + # deadline expiry on scope entry and at every checkpoint, + # but it makes the value returned by cancel_called more + # closely match expectations. + if not self._cancel_called and current_time() >= self._deadline: + self._cancel(CancelReason(source="deadline")) + return self._cancel_called + + +################################################################ +# Nursery and friends +################################################################ + + +class TaskStatus(Protocol[StatusT_contra]): + """The interface provided by :meth:`Nursery.start()` to the spawned task. + + This is provided via the ``task_status`` keyword-only parameter. + """ + + @overload + def started(self: TaskStatus[None]) -> None: ... + + @overload + def started(self, value: StatusT_contra) -> None: ... + + def started(self, value: StatusT_contra | None = None) -> None: + """Tasks call this method to indicate that they have initialized. + + See `nursery.start() ` for more information. + """ + + +# This code needs to be read alongside the code from Nursery.start to make +# sense. +@attrs.define(eq=False, repr=False, slots=False) +class _TaskStatus(TaskStatus[StatusT]): + _old_nursery: Nursery + _new_nursery: Nursery + # NoStatus is a sentinel. + _value: StatusT | type[_NoStatus] = _NoStatus + + def __repr__(self) -> str: + return f"" + + @overload + def started(self: _TaskStatus[None]) -> None: ... + + @overload + def started(self: _TaskStatus[StatusT], value: StatusT) -> None: ... + + def started(self, value: StatusT | None = None) -> None: + if self._value is not _NoStatus: + raise RuntimeError("called 'started' twice on the same task status") + self._value = cast("StatusT", value) # If None, StatusT == None + + # If the old nursery is cancelled, then quietly quit now; the child + # will eventually exit on its own, and we don't want to risk moving + # children that might have propagating Cancelled exceptions into + # a place with no cancelled cancel scopes to catch them. + assert self._old_nursery._cancel_status is not None + if self._old_nursery._cancel_status.effectively_cancelled: + return + + # Can't be closed, b/c we checked in start() and then _pending_starts + # should keep it open. + assert not self._new_nursery._closed + + # Move tasks from the old nursery to the new + tasks = self._old_nursery._children + self._old_nursery._children = set() + for task in tasks: + task._parent_nursery = self._new_nursery + task._eventual_parent_nursery = None + self._new_nursery._children.add(task) + + # Move all children of the old nursery's cancel status object + # to be underneath the new nursery instead. This includes both + # tasks and child cancel status objects. + # NB: If the new nursery is cancelled, reparenting a cancel + # status to be underneath it can invoke an abort_fn, which might + # do something evil like cancel the old nursery. We thus break + # everything off from the old nursery before we start attaching + # anything to the new. + cancel_status_children = self._old_nursery._cancel_status.children + cancel_status_tasks = set(self._old_nursery._cancel_status.tasks) + cancel_status_tasks.discard(self._old_nursery._parent_task) + for cancel_status in cancel_status_children: + cancel_status.parent = None + for task in cancel_status_tasks: + task._activate_cancel_status(None) + for cancel_status in cancel_status_children: + cancel_status.parent = self._new_nursery._cancel_status + for task in cancel_status_tasks: + task._activate_cancel_status(self._new_nursery._cancel_status) + + # That should have removed all the children from the old nursery + assert not self._old_nursery._children + + # And finally, poke the old nursery so it notices that all its + # children have disappeared and can exit. + self._old_nursery._check_nursery_closed() + + +@attrs.define(slots=False) +class NurseryManager: + """Nursery context manager. + + Note we explicitly avoid @asynccontextmanager and @async_generator + since they add a lot of extraneous stack frames to exceptions, as + well as cause problematic behavior with handling of StopIteration + and StopAsyncIteration. + + """ + + strict_exception_groups: bool = True + + @enable_ki_protection + async def __aenter__(self) -> Nursery: + self._scope = CancelScope() + self._scope.__enter__() + self._nursery = Nursery._create( + current_task(), + self._scope, + self.strict_exception_groups, + ) + return self._nursery + + @enable_ki_protection + async def __aexit__( + self, + etype: type[BaseException] | None, + exc: BaseException | None, + tb: TracebackType | None, + ) -> bool: + new_exc = await self._nursery._nested_child_finished(exc) + # Tracebacks show the 'raise' line below out of context, so let's give + # this variable a name that makes sense out of context. + combined_error_from_nursery = self._scope._close(new_exc) + if combined_error_from_nursery is None: + return True + elif combined_error_from_nursery is exc: + return False + else: + # Copied verbatim from the old MultiErrorCatcher. Python doesn't + # allow us to encapsulate this __context__ fixup. + old_context = combined_error_from_nursery.__context__ + try: + raise combined_error_from_nursery + finally: + _, value, _ = sys.exc_info() + assert value is combined_error_from_nursery + value.__context__ = old_context + # delete references from locals to avoid creating cycles + # see test_cancel_scope_exit_doesnt_create_cyclic_garbage + del _, combined_error_from_nursery, value, new_exc + + # make sure these raise errors in static analysis if called + if not TYPE_CHECKING: + + def __enter__(self) -> NoReturn: + raise RuntimeError( + "use 'async with open_nursery(...)', not 'with open_nursery(...)'", + ) + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> NoReturn: # pragma: no cover + raise AssertionError("Never called, but should be defined") + + +def open_nursery( + strict_exception_groups: bool | None = None, +) -> AbstractAsyncContextManager[Nursery]: + """Returns an async context manager which must be used to create a + new `Nursery`. + + It does not block on entry; on exit it blocks until all child tasks + have exited. If no child tasks are running on exit, it will insert a + schedule point (but no cancellation point) - equivalent to + :func:`trio.lowlevel.cancel_shielded_checkpoint`. This means a nursery + is never the source of a cancellation exception, it only propagates it + from sub-tasks. + + Args: + strict_exception_groups (bool): Unless set to False, even a single raised exception + will be wrapped in an exception group. If not specified, uses the value passed + to :func:`run`, which defaults to true. Setting it to False will be deprecated + and ultimately removed in a future version of Trio. + + """ + # only warn if explicitly set to falsy, not if we get it from the global context. + if strict_exception_groups is not None and not strict_exception_groups: + warn_deprecated( + "open_nursery(strict_exception_groups=False)", + version="0.25.0", + issue=2929, + instead=( + "the default value of True and rewrite exception handlers to handle ExceptionGroups. " + "See https://trio.readthedocs.io/en/stable/reference-core.html#designing-for-multiple-errors" + ), + use_triodeprecationwarning=True, + ) + + if strict_exception_groups is None: + strict_exception_groups = GLOBAL_RUN_CONTEXT.runner.strict_exception_groups + + return NurseryManager(strict_exception_groups=strict_exception_groups) + + +@final +class Nursery(metaclass=NoPublicConstructor): + """A context which may be used to spawn (or cancel) child tasks. + + Not constructed directly, use `open_nursery` instead. + + The nursery will remain open until all child tasks have completed, + or until it is cancelled, at which point it will cancel all its + remaining child tasks and close. + + Nurseries ensure the absence of orphaned Tasks, since all running + tasks will belong to an open Nursery. + + Attributes: + cancel_scope: + Creating a nursery also implicitly creates a cancellation scope, + which is exposed as the :attr:`cancel_scope` attribute. This is + used internally to implement the logic where if an error occurs + then ``__aexit__`` cancels all children, but you can use it for + other things, e.g. if you want to explicitly cancel all children + in response to some external event. + """ + + def __init__( + self, + parent_task: Task, + cancel_scope: CancelScope, + strict_exception_groups: bool, + ) -> None: + self._parent_task = parent_task + self._strict_exception_groups = strict_exception_groups + parent_task._child_nurseries.append(self) + # the cancel status that children inherit - we take a snapshot, so it + # won't be affected by any changes in the parent. + self._cancel_status = parent_task._cancel_status + # the cancel scope that directly surrounds us; used for cancelling all + # children. + self.cancel_scope = cancel_scope + assert self.cancel_scope._cancel_status is self._cancel_status + self._children: set[Task] = set() + self._pending_excs: list[BaseException] = [] + # The "nested child" is how this code refers to the contents of the + # nursery's 'async with' block, which acts like a child Task in all + # the ways we can make it. + self._nested_child_running = True + self._parent_waiting_in_aexit = False + self._pending_starts = 0 + self._closed = False + + @property + def child_tasks(self) -> frozenset[Task]: + """(`frozenset`): Contains all the child :class:`~trio.lowlevel.Task` + objects which are still running.""" + return frozenset(self._children) + + @property + def parent_task(self) -> Task: + "(`~trio.lowlevel.Task`): The Task that opened this nursery." + return self._parent_task + + def _add_exc(self, exc: BaseException, reason: CancelReason | None) -> None: + self._pending_excs.append(exc) + self.cancel_scope._cancel(reason) + + def _check_nursery_closed(self) -> None: + if not any([self._nested_child_running, self._children, self._pending_starts]): + self._closed = True + if self._parent_waiting_in_aexit: + self._parent_waiting_in_aexit = False + GLOBAL_RUN_CONTEXT.runner.reschedule(self._parent_task) + + def _child_finished( + self, + task: Task, + outcome: Outcome[object], + ) -> None: + self._children.remove(task) + if self._closed and not hasattr(self, "_pending_excs"): + # We're abandoned by misnested nurseries, the result of the task is lost. + return + if isinstance(outcome, Error): + self._add_exc( + outcome.error, + CancelReason( + source="nursery", + source_task=repr(task), + reason=f"child task raised exception {outcome.error!r}", + ), + ) + self._check_nursery_closed() + + async def _nested_child_finished( + self, + nested_child_exc: BaseException | None, + ) -> BaseException | None: + # Returns ExceptionGroup instance (or any exception if the nursery is in loose mode + # and there is just one contained exception) if there are pending exceptions + if nested_child_exc is not None: + self._add_exc( + nested_child_exc, + reason=CancelReason( + source="nursery", + source_task=repr(self._parent_task), + reason=f"Code block inside nursery contextmanager raised exception {nested_child_exc!r}", + ), + ) + self._nested_child_running = False + self._check_nursery_closed() + + if not self._closed: + # If we have a KeyboardInterrupt injected, we want to save it in + # the nursery's final exceptions list. But if it's just a + # Cancelled, then we don't -- see gh-1457. + def aborted(raise_cancel: _core.RaiseCancelT) -> Abort: + exn = capture(raise_cancel).error + if not isinstance(exn, Cancelled): + self._add_exc( + exn, + CancelReason( + source="KeyboardInterrupt", + source_task=repr(self._parent_task), + ), + ) + # see test_cancel_scope_exit_doesnt_create_cyclic_garbage + del exn # prevent cyclic garbage creation + return Abort.FAILED + + self._parent_waiting_in_aexit = True + await wait_task_rescheduled(aborted) + else: + # Nothing to wait for, so execute a schedule point, but don't + # allow us to be cancelled, just like the other branch. We + # still need to catch and store non-Cancelled exceptions. + try: + await cancel_shielded_checkpoint() + except BaseException as exc: + # there's no children to cancel, so don't need to supply cancel reason + self._add_exc(exc, reason=None) + + popped = self._parent_task._child_nurseries.pop() + assert popped is self, "Nursery misnesting detected!" + if self._pending_excs: + try: + if not self._strict_exception_groups and len(self._pending_excs) == 1: + return self._pending_excs[0] + exception = BaseExceptionGroup( + "Exceptions from Trio nursery", + self._pending_excs, + ) + if not self._strict_exception_groups: + exception.add_note(NONSTRICT_EXCEPTIONGROUP_NOTE) + return exception + finally: + # avoid a garbage cycle + # (see test_locals_destroyed_promptly_on_cancel) + del self._pending_excs + return None + + def start_soon( + self, + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + *args: Unpack[PosArgT], + name: object = None, + ) -> None: + """Creates a child task, scheduling ``await async_fn(*args)``. + + If you want to run a function and immediately wait for its result, + then you don't need a nursery; just use ``await async_fn(*args)``. + If you want to wait for the task to initialize itself before + continuing, see :meth:`start`, the other fundamental method for + creating concurrent tasks in Trio. + + Note that this is *not* an async function and you don't use await + when calling it. It sets up the new task, but then returns + immediately, *before* the new task has a chance to do anything. + New tasks may start running in any order, and at any checkpoint the + scheduler chooses - at latest when the nursery is waiting to exit. + + It's possible to pass a nursery object into another task, which + allows that task to start new child tasks in the first task's + nursery. + + The child task inherits its parent nursery's cancel scopes. + + Args: + async_fn: An async callable. + args: Positional arguments for ``async_fn``. If you want + to pass keyword arguments, use + :func:`functools.partial`. + name: The name for this task. Only used for + debugging/introspection + (e.g. ``repr(task_obj)``). If this isn't a string, + :meth:`start_soon` will try to make it one. A + common use case is if you're wrapping a function + before spawning a new task, you might pass the + original function as the ``name=`` to make + debugging easier. + + Raises: + RuntimeError: If this nursery is no longer open + (i.e. its ``async with`` block has + exited). + """ + GLOBAL_RUN_CONTEXT.runner.spawn_impl(async_fn, args, self, name) + + # Typing changes blocked by https://github.com/python/mypy/pull/17512 + async def start( # type: ignore[explicit-any] + self, + async_fn: Callable[..., Awaitable[object]], + *args: object, + name: object = None, + ) -> Any: + r"""Creates and initializes a child task. + + Like :meth:`start_soon`, but blocks until the new task has + finished initializing itself, and optionally returns some + information from it. + + The ``async_fn`` must accept a ``task_status`` keyword argument, + and it must make sure that it (or someone) eventually calls + :meth:`task_status.started() `. + + The conventional way to define ``async_fn`` is like:: + + async def async_fn(arg1, arg2, *, task_status=trio.TASK_STATUS_IGNORED): + ... # Caller is blocked waiting for this code to run + task_status.started() + ... # This async code can be interleaved with the caller + + :attr:`trio.TASK_STATUS_IGNORED` is a special global object with + a do-nothing ``started`` method. This way your function supports + being called either like ``await nursery.start(async_fn, arg1, + arg2)`` or directly like ``await async_fn(arg1, arg2)``, and + either way it can call :meth:`task_status.started() ` + without worrying about which mode it's in. Defining your function like + this will make it obvious to readers that it supports being used + in both modes. + + Before the child calls :meth:`task_status.started() `, + it's effectively run underneath the call to :meth:`start`: if it + raises an exception then that exception is reported by + :meth:`start`, and does *not* propagate out of the nursery. If + :meth:`start` is cancelled, then the child task is also + cancelled. + + When the child calls :meth:`task_status.started() `, + it's moved out from underneath :meth:`start` and into the given nursery. + + If the child task passes a value to :meth:`task_status.started(value) `, + then :meth:`start` returns this value. Otherwise, it returns ``None``. + """ + if self._closed: + raise RuntimeError("Nursery is closed to new arrivals") + try: + self._pending_starts += 1 + # wrap internal nursery in try-except to unroll any exceptiongroups + # to avoid wrapping pre-started() exceptions in an extra ExceptionGroup. + # See #2611. + try: + # set strict_exception_groups = True to make sure we always unwrap + # *this* nursery's exceptiongroup + async with open_nursery(strict_exception_groups=True) as old_nursery: + task_status: _TaskStatus[object | None] = _TaskStatus( + old_nursery, + self, + ) + thunk = functools.partial(async_fn, task_status=task_status) + task = GLOBAL_RUN_CONTEXT.runner.spawn_impl( + thunk, + args, + old_nursery, + name, + ) + task._eventual_parent_nursery = self + # Wait for either TaskStatus.started or an exception to + # cancel this nursery: + except BaseExceptionGroup as exc: + if len(exc.exceptions) == 1: + raise exc.exceptions[0] from None + raise TrioInternalError( + "Internal nursery should not have multiple tasks. This can be " + 'caused by the user managing to access the "old" nursery in ' + "`task_status` and spawning tasks in it.", + ) from exc + + # If we get here, then the child either got reparented or exited + # normally. The complicated logic is all in TaskStatus.started(). + # (Any exceptions propagate directly out of the above.) + if task_status._value is _NoStatus: + raise RuntimeError("child exited without calling task_status.started()") + return task_status._value + finally: + self._pending_starts -= 1 + self._check_nursery_closed() + + def __del__(self) -> None: + assert not self._children + + +################################################################ +# Task and friends +################################################################ + + +@final +@attrs.define(eq=False, repr=False) +class Task(metaclass=NoPublicConstructor): # type: ignore[explicit-any] + _parent_nursery: Nursery | None + coro: types.CoroutineType[Any, Outcome[object], Any] # type: ignore[explicit-any] + _runner: Runner + name: str + context: contextvars.Context + _counter: int = attrs.field(init=False, factory=itertools.count().__next__) + _ki_protected: bool + + # Invariant: + # - for unscheduled tasks, _next_send_fn and _next_send are both None + # - for scheduled tasks, _next_send_fn(_next_send) resumes the task; + # usually _next_send_fn is self.coro.send and _next_send is an + # Outcome. When recovering from a foreign await, _next_send_fn is + # self.coro.throw and _next_send is an exception. _next_send_fn + # will effectively be at the top of every task's call stack, so + # it should be written in C if you don't want to pollute Trio + # tracebacks with extraneous frames. + # - for scheduled tasks, custom_sleep_data is None + # Tasks start out unscheduled. + _next_send_fn: Callable[[Any], object] | None = None # type: ignore[explicit-any] + _next_send: Outcome[Any] | BaseException | None = None # type: ignore[explicit-any] + _abort_func: Callable[[_core.RaiseCancelT], Abort] | None = None + custom_sleep_data: Any = None # type: ignore[explicit-any] + + # For introspection and nursery.start() + _child_nurseries: list[Nursery] = attrs.Factory(list) + _eventual_parent_nursery: Nursery | None = None + + # these are counts of how many cancel/schedule points this task has + # executed, for assert{_no,}_checkpoints + # XX maybe these should be exposed as part of a statistics() method? + _cancel_points: int = 0 + _schedule_points: int = 0 + + def __repr__(self) -> str: + return f"" + + @property + def parent_nursery(self) -> Nursery | None: + """The nursery this task is inside (or None if this is the "init" + task). + + Example use case: drawing a visualization of the task tree in a + debugger. + + """ + return self._parent_nursery + + @property + def eventual_parent_nursery(self) -> Nursery | None: + """The nursery this task will be inside after it calls + ``task_status.started()``. + + If this task has already called ``started()``, or if it was not + spawned using `nursery.start() `, then + its `eventual_parent_nursery` is ``None``. + + """ + return self._eventual_parent_nursery + + @property + def child_nurseries(self) -> list[Nursery]: + """The nurseries this task contains. + + This is a list, with outer nurseries before inner nurseries. + + """ + return list(self._child_nurseries) + + def iter_await_frames(self) -> Iterator[tuple[types.FrameType, int]]: + """Iterates recursively over the coroutine-like objects this + task is waiting on, yielding the frame and line number at each + frame. + + This is similar to `traceback.walk_stack` in a synchronous + context. Note that `traceback.walk_stack` returns frames from + the bottom of the call stack to the top, while this function + starts from `Task.coro ` and works it + way down. + + Example usage: extracting a stack trace:: + + import traceback + + def print_stack_for_task(task): + ss = traceback.StackSummary.extract(task.iter_await_frames()) + print("".join(ss.format())) + + """ + # Ignore static typing as we're doing lots of dynamic introspection + coro: Any = self.coro # type: ignore[explicit-any] + while coro is not None: + if hasattr(coro, "cr_frame"): + # A real coroutine + yield coro.cr_frame, coro.cr_frame.f_lineno + coro = coro.cr_await + elif hasattr(coro, "gi_frame"): + # A generator decorated with @types.coroutine + yield coro.gi_frame, coro.gi_frame.f_lineno + coro = coro.gi_yieldfrom + elif coro.__class__.__name__ in [ + "async_generator_athrow", + "async_generator_asend", + ]: + # cannot extract the generator directly, see https://github.com/python/cpython/issues/76991 + # we can however use the gc to look through the object + for referent in gc.get_referents(coro): + if hasattr(referent, "ag_frame"): # pragma: no branch + yield referent.ag_frame, referent.ag_frame.f_lineno + coro = referent.ag_await + break + else: # pragma: no cover + # either cpython changed or we are running on an alternative python implementation + return + else: # pragma: no cover + return + + ################ + # Cancellation + ################ + + # The CancelStatus object that is currently active for this task. + # Don't change this directly; instead, use _activate_cancel_status(). + # This can be None, but only in the init task. + _cancel_status: CancelStatus = attrs.field(default=None, repr=False) + + def _activate_cancel_status(self, cancel_status: CancelStatus | None) -> None: + if self._cancel_status is not None: + self._cancel_status._tasks.remove(self) + self._cancel_status = cancel_status # type: ignore[assignment] + if self._cancel_status is not None: + self._cancel_status._tasks.add(self) + if self._cancel_status.effectively_cancelled: + self._attempt_delivery_of_any_pending_cancel() + + def _attempt_abort(self, raise_cancel: _core.RaiseCancelT) -> None: + # Either the abort succeeds, in which case we will reschedule the + # task, or else it fails, in which case it will worry about + # rescheduling itself (hopefully eventually calling reraise to raise + # the given exception, but not necessarily). + + # This is only called by the functions immediately below, which both check + # `self.abort_func is not None`. + assert self._abort_func is not None, "FATAL INTERNAL ERROR" + + success = self._abort_func(raise_cancel) + if type(success) is not Abort: + raise TrioInternalError("abort function must return Abort enum") + # We only attempt to abort once per blocking call, regardless of + # whether we succeeded or failed. + self._abort_func = None + if success is Abort.SUCCEEDED: + self._runner.reschedule(self, capture(raise_cancel)) + + def _attempt_delivery_of_any_pending_cancel(self) -> None: + if self._abort_func is None: + return + if not self._cancel_status.effectively_cancelled: + return + + reason = self._cancel_status._scope._cancel_reason + + def raise_cancel() -> NoReturn: + if reason is None: + raise Cancelled._create(source="unknown", reason="misnesting") + else: + raise Cancelled._create( + source=reason.source, + reason=reason.reason, + source_task=reason.source_task, + ) + + self._attempt_abort(raise_cancel) + + def _attempt_delivery_of_pending_ki(self) -> None: + assert self._runner.ki_pending + if self._abort_func is None: + return + + def raise_cancel() -> NoReturn: + self._runner.ki_pending = False + raise KeyboardInterrupt + + self._attempt_abort(raise_cancel) + + +################################################################ +# The central Runner object +################################################################ + + +@attrs.frozen +class RunStatistics: + """An object containing run-loop-level debugging information. + + Currently, the following fields are defined: + + * ``tasks_living`` (int): The number of tasks that have been spawned + and not yet exited. + * ``tasks_runnable`` (int): The number of tasks that are currently + queued on the run queue (as opposed to blocked waiting for something + to happen). + * ``seconds_to_next_deadline`` (float): The time until the next + pending cancel scope deadline. May be negative if the deadline has + expired but we haven't yet processed cancellations. May be + :data:`~math.inf` if there are no pending deadlines. + * ``run_sync_soon_queue_size`` (int): The number of + unprocessed callbacks queued via + :meth:`trio.lowlevel.TrioToken.run_sync_soon`. + * ``io_statistics`` (object): Some statistics from Trio's I/O + backend. This always has an attribute ``backend`` which is a string + naming which operating-system-specific I/O backend is in use; the + other attributes vary between backends. + """ + + tasks_living: int + tasks_runnable: int + seconds_to_next_deadline: float + io_statistics: IOStatistics + run_sync_soon_queue_size: int + + +# This holds all the state that gets trampolined back and forth between +# callbacks when we're running in guest mode. +# +# It has to be a separate object from Runner, and Runner *cannot* hold +# references to it (directly or indirectly)! +# +# The idea is that we want a chance to detect if our host loop quits and stops +# driving us forward. We detect that by unrolled_run_gen being garbage +# collected, and hitting its 'except GeneratorExit:' block. So this only +# happens if unrolled_run_gen is GCed. +# +# The Runner state is referenced from the global GLOBAL_RUN_CONTEXT. The only +# way it gets *un*referenced is by unrolled_run_gen completing, e.g. by being +# GCed. But if Runner has a direct or indirect reference to it, and the host +# loop has abandoned it, then this will never happen! +# +# So this object can reference Runner, but Runner can't reference it. The only +# references to it are the "in flight" callback chain on the host loop / +# worker thread. + + +@attrs.define(eq=False) +class GuestState: # type: ignore[explicit-any] + runner: Runner + run_sync_soon_threadsafe: Callable[[Callable[[], object]], object] + run_sync_soon_not_threadsafe: Callable[[Callable[[], object]], object] + done_callback: Callable[[Outcome[Any]], object] # type: ignore[explicit-any] + unrolled_run_gen: Generator[float, EventResult, None] + unrolled_run_next_send: Outcome[Any] = attrs.Factory(lambda: Value(None)) # type: ignore[explicit-any] + + def guest_tick(self) -> None: + prev_library, sniffio_library.name = sniffio_library.name, "trio" + try: + timeout = self.unrolled_run_next_send.send(self.unrolled_run_gen) + except StopIteration: + assert self.runner.main_task_outcome is not None + self.done_callback(self.runner.main_task_outcome) + return + except TrioInternalError as exc: + self.done_callback(Error(exc)) + return + finally: + sniffio_library.name = prev_library + + # Optimization: try to skip going into the thread if we can avoid it + events_outcome: Value[EventResult] | Error = capture( + self.runner.io_manager.get_events, + 0, + ) + if timeout <= 0 or isinstance(events_outcome, Error) or events_outcome.value: + # No need to go into the thread + self.unrolled_run_next_send = events_outcome + self.runner.guest_tick_scheduled = True + self.run_sync_soon_not_threadsafe(self.guest_tick) + else: + # Need to go into the thread and call get_events() there + self.runner.guest_tick_scheduled = False + + def get_events() -> EventResult: + return self.runner.io_manager.get_events(timeout) + + def deliver(events_outcome: Outcome[EventResult]) -> None: + def in_main_thread() -> None: + self.unrolled_run_next_send = events_outcome + self.runner.guest_tick_scheduled = True + self.guest_tick() + + self.run_sync_soon_threadsafe(in_main_thread) + + start_thread_soon(get_events, deliver) + + +@attrs.define(eq=False) +class Runner: # type: ignore[explicit-any] + clock: Clock + instruments: Instruments + io_manager: TheIOManager + ki_manager: KIManager + strict_exception_groups: bool + + # Run-local values, see _local.py + _locals: dict[_core.RunVar[Any], object] = attrs.Factory(dict) # type: ignore[explicit-any] + + runq: deque[Task] = attrs.Factory(deque) + tasks: set[Task] = attrs.Factory(set) + + deadlines: Deadlines = attrs.Factory(Deadlines) + + init_task: Task | None = None + system_nursery: Nursery | None = None + system_context: contextvars.Context = attrs.field(kw_only=True) + main_task: Task | None = None + main_task_outcome: Outcome[object] | None = None + + entry_queue: EntryQueue = attrs.Factory(EntryQueue) + trio_token: TrioToken | None = None + asyncgens: AsyncGenerators = attrs.Factory(AsyncGenerators) + + # If everything goes idle for this long, we call clock._autojump() + clock_autojump_threshold: float = inf + + # Guest mode stuff + is_guest: bool = False + guest_tick_scheduled: bool = False + + def force_guest_tick_asap(self) -> None: + if self.guest_tick_scheduled: + return + self.guest_tick_scheduled = True + self.io_manager.force_wakeup() + + def close(self) -> None: + self.io_manager.close() + self.entry_queue.close() + self.asyncgens.close() + if "after_run" in self.instruments: + self.instruments.call("after_run") + # This is where KI protection gets disabled, so we do it last + self.ki_manager.close() + + @_public + def current_statistics(self) -> RunStatistics: + """Returns ``RunStatistics``, which contains run-loop-level debugging information. + + Currently, the following fields are defined: + + * ``tasks_living`` (int): The number of tasks that have been spawned + and not yet exited. + * ``tasks_runnable`` (int): The number of tasks that are currently + queued on the run queue (as opposed to blocked waiting for something + to happen). + * ``seconds_to_next_deadline`` (float): The time until the next + pending cancel scope deadline. May be negative if the deadline has + expired but we haven't yet processed cancellations. May be + :data:`~math.inf` if there are no pending deadlines. + * ``run_sync_soon_queue_size`` (int): The number of + unprocessed callbacks queued via + :meth:`trio.lowlevel.TrioToken.run_sync_soon`. + * ``io_statistics`` (object): Some statistics from Trio's I/O + backend. This always has an attribute ``backend`` which is a string + naming which operating-system-specific I/O backend is in use; the + other attributes vary between backends. + + """ + seconds_to_next_deadline = self.deadlines.next_deadline() - self.current_time() + return RunStatistics( + tasks_living=len(self.tasks), + tasks_runnable=len(self.runq), + seconds_to_next_deadline=seconds_to_next_deadline, + io_statistics=self.io_manager.statistics(), + run_sync_soon_queue_size=self.entry_queue.size(), + ) + + @_public + def current_time(self) -> float: + """Returns the current time according to Trio's internal clock. + + Returns: + float: The current time. + + Raises: + RuntimeError: if not inside a call to :func:`trio.run`. + + """ + return self.clock.current_time() + + @_public + def current_clock(self) -> Clock: + """Returns the current :class:`~trio.abc.Clock`.""" + return self.clock + + @_public + def current_root_task(self) -> Task | None: + """Returns the current root :class:`Task`. + + This is the task that is the ultimate parent of all other tasks. + + """ + return self.init_task + + ################ + # Core task handling primitives + ################ + + @_public + def reschedule(self, task: Task, next_send: Outcome[object] = _NO_SEND) -> None: + """Reschedule the given task with the given + :class:`outcome.Outcome`. + + See :func:`wait_task_rescheduled` for the gory details. + + There must be exactly one call to :func:`reschedule` for every call to + :func:`wait_task_rescheduled`. (And when counting, keep in mind that + returning :data:`Abort.SUCCEEDED` from an abort callback is equivalent + to calling :func:`reschedule` once.) + + Args: + task (trio.lowlevel.Task): the task to be rescheduled. Must be blocked + in a call to :func:`wait_task_rescheduled`. + next_send (outcome.Outcome): the value (or error) to return (or + raise) from :func:`wait_task_rescheduled`. + + """ + if next_send is _NO_SEND: + next_send = Value(None) + + assert task._runner is self + assert task._next_send_fn is None + task._next_send_fn = task.coro.send + task._next_send = next_send + task._abort_func = None + task.custom_sleep_data = None + if not self.runq and self.is_guest: + self.force_guest_tick_asap() + self.runq.append(task) + if "task_scheduled" in self.instruments: + self.instruments.call("task_scheduled", task) + + def spawn_impl( + self, + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + args: tuple[Unpack[PosArgT]], + nursery: Nursery | None, + name: object, + *, + system_task: bool = False, + context: contextvars.Context | None = None, + ) -> Task: + ###### + # Make sure the nursery is in working order + ###### + + # This sorta feels like it should be a method on nursery, except it + # has to handle nursery=None for init. And it touches the internals of + # all kinds of objects. + if nursery is not None and nursery._closed: + raise RuntimeError("Nursery is closed to new arrivals") + if nursery is None: + assert self.init_task is None + + ###### + # Propagate contextvars + ###### + if context is None: + context = self.system_context.copy() if system_task else copy_context() + + ###### + # Call the function and get the coroutine object, while giving helpful + # errors for common mistakes. + ###### + # TypeVarTuple passed into ParamSpec function confuses Mypy. + coro = context.run(coroutine_or_error, async_fn, *args) # type: ignore[arg-type] + + if name is None: + name = async_fn + if isinstance(name, functools.partial): + name = name.func + if not isinstance(name, str): + try: + name = f"{name.__module__}.{name.__qualname__}" # type: ignore[attr-defined] + except AttributeError: + name = repr(name) + + # very old Cython versions (<0.29.24) has the attribute, but with a value of None + if getattr(coro, "cr_frame", None) is None: + # This async function is implemented in C or Cython + async def python_wrapper(orig_coro: Awaitable[RetT]) -> RetT: + return await orig_coro + + coro = python_wrapper(coro) + assert coro.cr_frame is not None, "Coroutine frame should exist" # type: ignore[attr-defined] + + ###### + # Set up the Task object + ###### + task = Task._create( + coro=coro, + parent_nursery=nursery, + runner=self, + name=name, + context=context, + ki_protected=system_task, + ) + + self.tasks.add(task) + if nursery is not None: + nursery._children.add(task) + task._activate_cancel_status(nursery._cancel_status) + + if "task_spawned" in self.instruments: + self.instruments.call("task_spawned", task) + # Special case: normally next_send should be an Outcome, but for the + # very first send we have to send a literal unboxed None. + self.reschedule(task, None) # type: ignore[arg-type] + return task + + def task_exited(self, task: Task, outcome: Outcome[object]) -> None: + if task._child_nurseries: + for nursery in task._child_nurseries: + nursery.cancel_scope._cancel( + CancelReason( + source="nursery", + reason="Parent Task exited prematurely, abandoning this nursery without exiting it properly.", + source_task=repr(task), + ) + ) + nursery._closed = True + + # break parking lots associated with the exiting task + if task in GLOBAL_PARKING_LOT_BREAKER: + for lot in GLOBAL_PARKING_LOT_BREAKER[task]: + lot.break_lot(task) + del GLOBAL_PARKING_LOT_BREAKER[task] + + if ( + task._cancel_status is not None + and task._cancel_status.abandoned_by_misnesting + and task._cancel_status.parent is None + ) or task._child_nurseries: + reason = "Nursery" if task._child_nurseries else "Cancel scope" + # The cancel scope surrounding this task's nursery was closed + # before the task exited. Force the task to exit with an error, + # since the error might not have been caught elsewhere. See the + # comments in CancelStatus.close(). + try: + # Raise this, rather than just constructing it, to get a + # traceback frame included + raise RuntimeError( + f"{reason} stack corrupted: {reason} surrounding " + f"{task!r} was closed before the task exited\n{MISNESTING_ADVICE}", + ) + except RuntimeError as new_exc: + if isinstance(outcome, Error): + new_exc.__context__ = outcome.error + outcome = Error(new_exc) + + task._activate_cancel_status(None) + self.tasks.remove(task) + if task is self.init_task: + # If the init task crashed, then something is very wrong and we + # let the error propagate. (It'll eventually be wrapped in a + # TrioInternalError.) + outcome.unwrap() + # the init task should be the last task to exit. If not, then + # something is very wrong. + if self.tasks: # pragma: no cover + raise TrioInternalError + else: + if task is self.main_task: + self.main_task_outcome = outcome + outcome = Value(None) + assert task._parent_nursery is not None, task + task._parent_nursery._child_finished(task, outcome) + + if "task_exited" in self.instruments: + self.instruments.call("task_exited", task) + + ################ + # System tasks and init + ################ + + @_public + def spawn_system_task( + self, + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + *args: Unpack[PosArgT], + name: object = None, + context: contextvars.Context | None = None, + ) -> Task: + """Spawn a "system" task. + + System tasks have a few differences from regular tasks: + + * They don't need an explicit nursery; instead they go into the + internal "system nursery". + + * If a system task raises an exception, then it's converted into a + :exc:`~trio.TrioInternalError` and *all* tasks are cancelled. If you + write a system task, you should be careful to make sure it doesn't + crash. + + * System tasks are automatically cancelled when the main task exits. + + * By default, system tasks have :exc:`KeyboardInterrupt` protection + *enabled*. If you want your task to be interruptible by control-C, + then you need to use :func:`disable_ki_protection` explicitly (and + come up with some plan for what to do with a + :exc:`KeyboardInterrupt`, given that system tasks aren't allowed to + raise exceptions). + + * System tasks do not inherit context variables from their creator. + + Towards the end of a call to :meth:`trio.run`, after the main + task and all system tasks have exited, the system nursery + becomes closed. At this point, new calls to + :func:`spawn_system_task` will raise ``RuntimeError("Nursery + is closed to new arrivals")`` instead of creating a system + task. It's possible to encounter this state either in + a ``finally`` block in an async generator, or in a callback + passed to :meth:`TrioToken.run_sync_soon` at the right moment. + + Args: + async_fn: An async callable. + args: Positional arguments for ``async_fn``. If you want to pass + keyword arguments, use :func:`functools.partial`. + name: The name for this task. Only used for debugging/introspection + (e.g. ``repr(task_obj)``). If this isn't a string, + :func:`spawn_system_task` will try to make it one. A common use + case is if you're wrapping a function before spawning a new + task, you might pass the original function as the ``name=`` to + make debugging easier. + context: An optional ``contextvars.Context`` object with context variables + to use for this task. You would normally get a copy of the current + context with ``context = contextvars.copy_context()`` and then you would + pass that ``context`` object here. + + Returns: + Task: the newly spawned task + + """ + return self.spawn_impl( + async_fn, + args, + self.system_nursery, + name, + system_task=True, + context=context, + ) + + async def init( + self, + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + args: tuple[Unpack[PosArgT]], + ) -> None: + # run_sync_soon task runs here: + async with open_nursery() as run_sync_soon_nursery: + # All other system tasks run here: + async with open_nursery() as self.system_nursery: + # Only the main task runs here: + async with open_nursery() as main_task_nursery: + try: + self.main_task = self.spawn_impl( + async_fn, + args, + main_task_nursery, + None, + ) + except BaseException as exc: + self.main_task_outcome = Error(exc) + return + self.spawn_impl( + self.entry_queue.task, + (), + run_sync_soon_nursery, + "", + system_task=True, + ) + + # Main task is done; start shutting down system tasks + self.system_nursery.cancel_scope._cancel( + CancelReason( + source="shutdown", + reason="main task done, shutting down system tasks", + source_task=repr(self.init_task), + ) + ) + + # System nursery is closed; finalize remaining async generators + await self.asyncgens.finalize_remaining(self) + + # There are no more asyncgens, which means no more user-provided + # code except possibly run_sync_soon callbacks. It's finally safe + # to stop the run_sync_soon task and exit run(). + run_sync_soon_nursery.cancel_scope._cancel( + CancelReason( + source="shutdown", + reason="main task done, shutting down run_sync_soon callbacks", + source_task=repr(self.init_task), + ) + ) + + ################ + # Outside context problems + ################ + + @_public + def current_trio_token(self) -> TrioToken: + """Retrieve the :class:`TrioToken` for the current call to + :func:`trio.run`. + + """ + if self.trio_token is None: + self.trio_token = TrioToken._create(self.entry_queue) + return self.trio_token + + ################ + # KI handling + ################ + + ki_pending: bool = False + + # deliver_ki is broke. Maybe move all the actual logic and state into + # RunToken, and we'll only have one instance per runner? But then we can't + # have a public constructor. Eh, but current_run_token() returning a + # unique object per run feels pretty nice. Maybe let's just go for it. And + # keep the class public so people can isinstance() it if they want. + + # This gets called from signal context + def deliver_ki(self) -> None: + self.ki_pending = True + with suppress(RunFinishedError): + self.entry_queue.run_sync_soon(self._deliver_ki_cb) + + def _deliver_ki_cb(self) -> None: + if not self.ki_pending: + return + # Can't happen because main_task and run_sync_soon_task are created at + # the same time -- so even if KI arrives before main_task is created, + # we won't get here until afterwards. + assert self.main_task is not None + if self.main_task_outcome is not None: + # We're already in the process of exiting -- leave ki_pending set + # and we'll check it again on our way out of run(). + return + self.main_task._attempt_delivery_of_pending_ki() + + ################ + # Quiescing + ################ + + # sortedcontainers doesn't have types, and is reportedly very hard to type: + # https://github.com/grantjenks/python-sortedcontainers/issues/68 + waiting_for_idle: Any = attrs.Factory(SortedDict) # type: ignore[explicit-any] + + @_public + async def wait_all_tasks_blocked(self, cushion: float = 0.0) -> None: + """Block until there are no runnable tasks. + + This is useful in testing code when you want to give other tasks a + chance to "settle down". The calling task is blocked, and doesn't wake + up until all other tasks are also blocked for at least ``cushion`` + seconds. (Setting a non-zero ``cushion`` is intended to handle cases + like two tasks talking to each other over a local socket, where we + want to ignore the potential brief moment between a send and receive + when all tasks are blocked.) + + Note that ``cushion`` is measured in *real* time, not the Trio clock + time. + + If there are multiple tasks blocked in :func:`wait_all_tasks_blocked`, + then the one with the shortest ``cushion`` is the one woken (and + this task becoming unblocked resets the timers for the remaining + tasks). If there are multiple tasks that have exactly the same + ``cushion``, then all are woken. + + You should also consider :class:`trio.testing.Sequencer`, which + provides a more explicit way to control execution ordering within a + test, and will often produce more readable tests. + + Example: + Here's an example of one way to test that Trio's locks are fair: we + take the lock in the parent, start a child, wait for the child to be + blocked waiting for the lock (!), and then check that we can't + release and immediately re-acquire the lock:: + + async def lock_taker(lock): + await lock.acquire() + lock.release() + + async def test_lock_fairness(): + lock = trio.Lock() + await lock.acquire() + async with trio.open_nursery() as nursery: + nursery.start_soon(lock_taker, lock) + # child hasn't run yet, we have the lock + assert lock.locked() + assert lock._owner is trio.lowlevel.current_task() + await trio.testing.wait_all_tasks_blocked() + # now the child has run and is blocked on lock.acquire(), we + # still have the lock + assert lock.locked() + assert lock._owner is trio.lowlevel.current_task() + lock.release() + try: + # The child has a prior claim, so we can't have it + lock.acquire_nowait() + except trio.WouldBlock: + assert lock._owner is not trio.lowlevel.current_task() + print("PASS") + else: + print("FAIL") + + """ + task = current_task() + key = (cushion, id(task)) + self.waiting_for_idle[key] = task + + def abort(_: _core.RaiseCancelT) -> Abort: + del self.waiting_for_idle[key] + return Abort.SUCCEEDED + + await wait_task_rescheduled(abort) + + +################################################################ +# run +################################################################ +# +# Trio's core task scheduler and coroutine runner is in 'unrolled_run'. It's +# called that because it has an unusual feature: it's actually a generator. +# Whenever it needs to fetch IO events from the OS, it yields, and waits for +# its caller to send the IO events back in. So the loop is "unrolled" into a +# sequence of generator send() calls. +# +# The reason for this unusual design is to support two different modes of +# operation, where the IO is handled differently. +# +# In normal mode using trio.run, the scheduler and IO run in the same thread: +# +# Main thread: +# +# +---------------------------+ +# | Run tasks | +# | (unrolled_run) | +# +---------------------------+ +# | Block waiting for I/O | +# | (io_manager.get_events) | +# +---------------------------+ +# | Run tasks | +# | (unrolled_run) | +# +---------------------------+ +# | Block waiting for I/O | +# | (io_manager.get_events) | +# +---------------------------+ +# : +# +# +# In guest mode using trio.lowlevel.start_guest_run, the scheduler runs on the +# main thread as a host loop callback, but blocking for IO gets pushed into a +# worker thread: +# +# Main thread executing host loop: Trio I/O thread: +# +# +---------------------------+ +# | Run Trio tasks | +# | (unrolled_run) | +# +---------------------------+ --------------+ +# v +# +---------------------------+ +----------------------------+ +# | Host loop does whatever | | Block waiting for Trio I/O | +# | it wants | | (io_manager.get_events) | +# +---------------------------+ +----------------------------+ +# | +# +---------------------------+ <-------------+ +# | Run Trio tasks | +# | (unrolled_run) | +# +---------------------------+ --------------+ +# v +# +---------------------------+ +----------------------------+ +# | Host loop does whatever | | Block waiting for Trio I/O | +# | it wants | | (io_manager.get_events) | +# +---------------------------+ +----------------------------+ +# : : +# +# Most of Trio's internals don't need to care about this difference. The main +# complication it creates is that in guest mode, we might need to wake up not +# just due to OS-reported IO events, but also because of code running on the +# host loop calling reschedule() or changing task deadlines. Search for +# 'is_guest' to see the special cases we need to handle this. + + +def setup_runner( + clock: Clock | None, + instruments: Sequence[Instrument], + restrict_keyboard_interrupt_to_checkpoints: bool, + strict_exception_groups: bool, +) -> Runner: + """Create a Runner object and install it as the GLOBAL_RUN_CONTEXT.""" + # It wouldn't be *hard* to support nested calls to run(), but I can't + # think of a single good reason for it, so let's be conservative for + # now: + if in_trio_run(): + raise RuntimeError("Attempted to call run() from inside a run()") + + if clock is None: + clock = SystemClock() + instrument_group = Instruments(instruments) + io_manager = TheIOManager() + system_context = copy_context() + ki_manager = KIManager() + + runner = Runner( + clock=clock, + instruments=instrument_group, + io_manager=io_manager, + system_context=system_context, + ki_manager=ki_manager, + strict_exception_groups=strict_exception_groups, + ) + runner.asyncgens.install_hooks(runner) + + # This is where KI protection gets enabled, so we want to do it early - in + # particular before we start modifying global state like GLOBAL_RUN_CONTEXT + ki_manager.install(runner.deliver_ki, restrict_keyboard_interrupt_to_checkpoints) + + GLOBAL_RUN_CONTEXT.runner = runner + return runner + + +def run( + async_fn: Callable[[Unpack[PosArgT]], Awaitable[RetT]], + *args: Unpack[PosArgT], + clock: Clock | None = None, + instruments: Sequence[Instrument] = (), + restrict_keyboard_interrupt_to_checkpoints: bool = False, + strict_exception_groups: bool = True, +) -> RetT: + """Run a Trio-flavored async function, and return the result. + + Calling:: + + run(async_fn, *args) + + is the equivalent of:: + + await async_fn(*args) + + except that :func:`run` can (and must) be called from a synchronous + context. + + This is Trio's main entry point. Almost every other function in Trio + requires that you be inside a call to :func:`run`. + + Args: + async_fn: An async function. + + args: Positional arguments to be passed to *async_fn*. If you need to + pass keyword arguments, then use :func:`functools.partial`. + + clock: ``None`` to use the default system-specific monotonic clock; + otherwise, an object implementing the :class:`trio.abc.Clock` + interface, like (for example) a :class:`trio.testing.MockClock` + instance. + + instruments (list of :class:`trio.abc.Instrument` objects): Any + instrumentation you want to apply to this run. This can also be + modified during the run; see :ref:`instrumentation`. + + restrict_keyboard_interrupt_to_checkpoints (bool): What happens if the + user hits control-C while :func:`run` is running? If this argument + is False (the default), then you get the standard Python behavior: a + :exc:`KeyboardInterrupt` exception will immediately interrupt + whatever task is running (or if no task is running, then Trio will + wake up a task to be interrupted). Alternatively, if you set this + argument to True, then :exc:`KeyboardInterrupt` delivery will be + delayed: it will be *only* be raised at :ref:`checkpoints + `, like a :exc:`Cancelled` exception. + + The default behavior is nice because it means that even if you + accidentally write an infinite loop that never executes any + checkpoints, then you can still break out of it using control-C. + The alternative behavior is nice if you're paranoid about a + :exc:`KeyboardInterrupt` at just the wrong place leaving your + program in an inconsistent state, because it means that you only + have to worry about :exc:`KeyboardInterrupt` at the exact same + places where you already have to worry about :exc:`Cancelled`. + + This setting has no effect if your program has registered a custom + SIGINT handler, or if :func:`run` is called from anywhere but the + main thread (this is a Python limitation), or if you use + :func:`open_signal_receiver` to catch SIGINT. + + strict_exception_groups (bool): Unless set to False, nurseries will always wrap + even a single raised exception in an exception group. This can be overridden + on the level of individual nurseries. Setting it to False will be deprecated + and ultimately removed in a future version of Trio. + + Returns: + Whatever ``async_fn`` returns. + + Raises: + TrioInternalError: if an unexpected error is encountered inside Trio's + internal machinery. This is a bug and you should `let us know + `__. + + Anything else: if ``async_fn`` raises an exception, then :func:`run` + propagates it. + + """ + if strict_exception_groups is not None and not strict_exception_groups: + warn_deprecated( + "trio.run(..., strict_exception_groups=False)", + version="0.25.0", + issue=2929, + instead=( + "the default value of True and rewrite exception handlers to handle ExceptionGroups. " + "See https://trio.readthedocs.io/en/stable/reference-core.html#designing-for-multiple-errors" + ), + use_triodeprecationwarning=True, + ) + + __tracebackhide__ = True + + runner = setup_runner( + clock, + instruments, + restrict_keyboard_interrupt_to_checkpoints, + strict_exception_groups, + ) + + prev_library, sniffio_library.name = sniffio_library.name, "trio" + try: + gen = unrolled_run(runner, async_fn, args) + # Need to send None in the first time. + next_send: EventResult = None # type: ignore[assignment] + while True: + try: + timeout = gen.send(next_send) + except StopIteration: + break + next_send = runner.io_manager.get_events(timeout) + finally: + sniffio_library.name = prev_library + # Inlined copy of runner.main_task_outcome.unwrap() to avoid + # cluttering every single Trio traceback with an extra frame. + if isinstance(runner.main_task_outcome, Value): + return cast("RetT", runner.main_task_outcome.value) + elif isinstance(runner.main_task_outcome, Error): + raise runner.main_task_outcome.error + else: # pragma: no cover + raise AssertionError(runner.main_task_outcome) + + +def start_guest_run( # type: ignore[explicit-any] + async_fn: Callable[..., Awaitable[RetT]], + *args: object, + run_sync_soon_threadsafe: Callable[[Callable[[], object]], object], + done_callback: Callable[[outcome.Outcome[RetT]], object], + run_sync_soon_not_threadsafe: ( + Callable[[Callable[[], object]], object] | None + ) = None, + host_uses_signal_set_wakeup_fd: bool = False, + clock: Clock | None = None, + instruments: Sequence[Instrument] = (), + restrict_keyboard_interrupt_to_checkpoints: bool = False, + strict_exception_groups: bool = True, +) -> None: + """Start a "guest" run of Trio on top of some other "host" event loop. + + Each host loop can only have one guest run at a time. + + You should always let the Trio run finish before stopping the host loop; + if not, it may leave Trio's internal data structures in an inconsistent + state. You might be able to get away with it if you immediately exit the + program, but it's safest not to go there in the first place. + + Generally, the best way to do this is wrap this in a function that starts + the host loop and then immediately starts the guest run, and then shuts + down the host when the guest run completes. + + Once :func:`start_guest_run` returns successfully, the guest run + has been set up enough that you can invoke sync-colored Trio + functions such as :func:`~trio.current_time`, :func:`spawn_system_task`, + and :func:`current_trio_token`. If a `~trio.TrioInternalError` occurs + during this early setup of the guest run, it will be raised out of + :func:`start_guest_run`. All other errors, including all errors + raised by the *async_fn*, will be delivered to your + *done_callback* at some point after :func:`start_guest_run` returns + successfully. + + Args: + + run_sync_soon_threadsafe: An arbitrary callable, which will be passed a + function as its sole argument:: + + def my_run_sync_soon_threadsafe(fn): + ... + + This callable should schedule ``fn()`` to be run by the host on its + next pass through its loop. **Must support being called from + arbitrary threads.** + + done_callback: An arbitrary callable:: + + def my_done_callback(run_outcome): + ... + + When the Trio run has finished, Trio will invoke this callback to let + you know. The argument is an `outcome.Outcome`, reporting what would + have been returned or raised by `trio.run`. This function can do + anything you want, but commonly you'll want it to shut down the + host loop, unwrap the outcome, etc. + + run_sync_soon_not_threadsafe: Like ``run_sync_soon_threadsafe``, but + will only be called from inside the host loop's main thread. + Optional, but if your host loop allows you to implement this more + efficiently than ``run_sync_soon_threadsafe`` then passing it will + make things a bit faster. + + host_uses_signal_set_wakeup_fd (bool): Pass `True` if your host loop + uses `signal.set_wakeup_fd`, and `False` otherwise. For more details, + see :ref:`guest-run-implementation`. + + For the meaning of other arguments, see `trio.run`. + + """ + if strict_exception_groups is not None and not strict_exception_groups: + warn_deprecated( + "trio.start_guest_run(..., strict_exception_groups=False)", + version="0.25.0", + issue=2929, + instead=( + "the default value of True and rewrite exception handlers to handle ExceptionGroups. " + "See https://trio.readthedocs.io/en/stable/reference-core.html#designing-for-multiple-errors" + ), + use_triodeprecationwarning=True, + ) + + runner = setup_runner( + clock, + instruments, + restrict_keyboard_interrupt_to_checkpoints, + strict_exception_groups, + ) + runner.is_guest = True + runner.guest_tick_scheduled = True + + if run_sync_soon_not_threadsafe is None: + run_sync_soon_not_threadsafe = run_sync_soon_threadsafe + + guest_state = GuestState( + runner=runner, + run_sync_soon_threadsafe=run_sync_soon_threadsafe, + run_sync_soon_not_threadsafe=run_sync_soon_not_threadsafe, + done_callback=done_callback, + unrolled_run_gen=unrolled_run( + runner, + async_fn, + args, + host_uses_signal_set_wakeup_fd=host_uses_signal_set_wakeup_fd, + ), + ) + + # Run a few ticks of the guest run synchronously, so that by the + # time we return, the system nursery exists and callers can use + # spawn_system_task. We don't actually run any user code during + # this time, so it shouldn't be possible to get an exception here, + # except for a TrioInternalError. + next_send = cast( + "EventResult", + None, + ) # First iteration must be `None`, every iteration after that is EventResult + for _tick in range(5): # expected need is 2 iterations + leave some wiggle room + if runner.system_nursery is not None: + # We're initialized enough to switch to async guest ticks + break + try: + timeout = guest_state.unrolled_run_gen.send(next_send) + except StopIteration: # pragma: no cover + raise TrioInternalError( + "Guest runner exited before system nursery was initialized", + ) from None + if timeout != 0: # pragma: no cover + guest_state.unrolled_run_gen.throw( + TrioInternalError( + "Guest runner blocked before system nursery was initialized", + ), + ) + # next_send should be the return value of + # IOManager.get_events() if no I/O was waiting, which is + # platform-dependent. We don't actually check for I/O during + # this init phase because no one should be expecting any yet. + if sys.platform == "win32": + next_send = 0 + else: + next_send = [] + else: # pragma: no cover + guest_state.unrolled_run_gen.throw( + TrioInternalError( + "Guest runner yielded too many times before " + "system nursery was initialized", + ), + ) + + guest_state.unrolled_run_next_send = Value(next_send) + run_sync_soon_not_threadsafe(guest_state.guest_tick) + + +# 24 hours is arbitrary, but it avoids issues like people setting timeouts of +# 10**20 and then getting integer overflows in the underlying system calls. +_MAX_TIMEOUT: Final = 24 * 60 * 60 + + +# Weird quirk: this is written as a generator in order to support "guest +# mode", where our core event loop gets unrolled into a series of callbacks on +# the host loop. If you're doing a regular trio.run then this gets run +# straight through. +@enable_ki_protection +def unrolled_run( + runner: Runner, + async_fn: Callable[[Unpack[PosArgT]], Awaitable[object]], + args: tuple[Unpack[PosArgT]], + host_uses_signal_set_wakeup_fd: bool = False, +) -> Generator[float, EventResult, None]: + __tracebackhide__ = True + + try: + if not host_uses_signal_set_wakeup_fd: + runner.entry_queue.wakeup.wakeup_on_signals() + + if "before_run" in runner.instruments: + runner.instruments.call("before_run") + runner.clock.start_clock() + runner.init_task = runner.spawn_impl( + runner.init, + (async_fn, args), + None, + "", + system_task=True, + ) + + # You know how people talk about "event loops"? This 'while' loop right + # here is our event loop: + while runner.tasks: + if runner.runq: + timeout: float = 0 + else: + deadline = runner.deadlines.next_deadline() + timeout = runner.clock.deadline_to_sleep_time(deadline) + timeout = min(max(0, timeout), _MAX_TIMEOUT) + + idle_primed = None + if runner.waiting_for_idle: + cushion, _ = runner.waiting_for_idle.keys()[0] + if cushion < timeout: + timeout = cushion + idle_primed = IdlePrimedTypes.WAITING_FOR_IDLE + # We use 'elif' here because if there are tasks in + # wait_all_tasks_blocked, then those tasks will wake up without + # jumping the clock, so we don't need to autojump. + elif runner.clock_autojump_threshold < timeout: + timeout = runner.clock_autojump_threshold + idle_primed = IdlePrimedTypes.AUTOJUMP_CLOCK + + if "before_io_wait" in runner.instruments: + runner.instruments.call("before_io_wait", timeout) + + # Driver will call io_manager.get_events(timeout) and pass it back + # in through the yield + events = yield timeout + runner.io_manager.process_events(events) + + if "after_io_wait" in runner.instruments: + runner.instruments.call("after_io_wait", timeout) + + # Process cancellations due to deadline expiry + now = runner.clock.current_time() + if runner.deadlines.expire(now): + idle_primed = None + + # idle_primed != None means: if the IO wait hit the timeout, and + # still nothing is happening, then we should start waking up + # wait_all_tasks_blocked tasks or autojump the clock. But there + # are some subtleties in defining "nothing is happening". + # + # 'not runner.runq' means that no tasks are currently runnable. + # 'not events' means that the last IO wait call hit its full + # timeout. These are very similar, and if idle_primed != None and + # we're running in regular mode then they always go together. But, + # in *guest* mode, they can happen independently, even when + # idle_primed=True: + # + # - runner.runq=empty and events=True: the host loop adjusted a + # deadline and that forced an IO wakeup before the timeout expired, + # even though no actual tasks were scheduled. + # + # - runner.runq=nonempty and events=False: the IO wait hit its + # timeout, but then some code in the host thread rescheduled a task + # before we got here. + # + # So we need to check both. + if idle_primed is not None and not runner.runq and not events: + if idle_primed is IdlePrimedTypes.WAITING_FOR_IDLE: + while runner.waiting_for_idle: + key, task = runner.waiting_for_idle.peekitem(0) + if key[0] == cushion: + del runner.waiting_for_idle[key] + runner.reschedule(task) + else: + break + else: + assert idle_primed is IdlePrimedTypes.AUTOJUMP_CLOCK + assert isinstance(runner.clock, _core.MockClock) + runner.clock._autojump() + + # Process all runnable tasks, but only the ones that are already + # runnable now. Anything that becomes runnable during this cycle + # needs to wait until the next pass. This avoids various + # starvation issues by ensuring that there's never an unbounded + # delay between successive checks for I/O. + # + # Also, we randomize the order of each batch to avoid assumptions + # about scheduling order sneaking in. In the long run, I suspect + # we'll either (a) use strict FIFO ordering and document that for + # predictability/determinism, or (b) implement a more + # sophisticated scheduler (e.g. some variant of fair queueing), + # for better behavior under load. For now, this is the worst of + # both worlds - but it keeps our options open. (If we do decide to + # go all in on deterministic scheduling, then there are other + # things that will probably need to change too, like the deadlines + # tie-breaker and the non-deterministic ordering of + # task._notify_queues.) + batch = list(runner.runq) + runner.runq.clear() + if _ALLOW_DETERMINISTIC_SCHEDULING: + # We're running under Hypothesis, and pytest-trio has patched + # this in to make the scheduler deterministic and avoid flaky + # tests. It's not worth the (small) performance cost in normal + # operation, since we'll shuffle the list and _r is only + # seeded for tests. + batch.sort(key=lambda t: t._counter) + _r.shuffle(batch) + else: + # 50% chance of reversing the batch, this way each task + # can appear before/after any other task. + if _r.random() < 0.5: + batch.reverse() + while batch: + task = batch.pop() + GLOBAL_RUN_CONTEXT.task = task + + if "before_task_step" in runner.instruments: + runner.instruments.call("before_task_step", task) + + next_send_fn = task._next_send_fn + next_send = task._next_send + task._next_send_fn = task._next_send = None + final_outcome: Outcome[object] | None = None + + assert next_send_fn is not None + + try: + # We used to unwrap the Outcome object here and send/throw + # its contents in directly, but it turns out that .throw() + # is buggy on CPython (all versions at time of writing): + # https://bugs.python.org/issue29587 + # https://bugs.python.org/issue29590 + # https://bugs.python.org/issue40694 + # https://github.com/python/cpython/issues/108668 + # So now we send in the Outcome object and unwrap it on the + # other side. + msg = task.context.run(next_send_fn, next_send) + except StopIteration as stop_iteration: + final_outcome = Value(stop_iteration.value) + except BaseException as task_exc: + # Store for later, removing uninteresting top frames: 1 + # frame we always remove, because it's this function + # catching it, and then in addition we remove however many + # more Context.run adds. + tb = task_exc.__traceback__ + for _ in range(1 + CONTEXT_RUN_TB_FRAMES): + if tb is not None: # pragma: no branch + tb = tb.tb_next + final_outcome = Error(task_exc.with_traceback(tb)) + # Remove local refs so that e.g. cancelled coroutine locals + # are not kept alive by this frame until another exception + # comes along. + del tb + + if final_outcome is not None: + # We can't call this directly inside the except: blocks + # above, because then the exceptions end up attaching + # themselves to other exceptions as __context__ in + # unwanted ways. + runner.task_exited(task, final_outcome) + # final_outcome may contain a traceback ref. It's not as + # crucial compared to the above, but this will allow more + # prompt release of resources in coroutine locals. + final_outcome = None + else: + task._schedule_points += 1 + if msg is CancelShieldedCheckpoint: + runner.reschedule(task) + elif type(msg) is WaitTaskRescheduled: + task._cancel_points += 1 + task._abort_func = msg.abort_func + # KI is "outside" all cancel scopes, so check for it + # before checking for regular cancellation: + if runner.ki_pending and task is runner.main_task: + task._attempt_delivery_of_pending_ki() + task._attempt_delivery_of_any_pending_cancel() + elif type(msg) is PermanentlyDetachCoroutineObject: + # Pretend the task just exited with the given outcome + runner.task_exited(task, msg.final_outcome) + else: + exc = TypeError( + f"trio.run received unrecognized yield message {msg!r}. " + "Are you trying to use a library written for some " + "other framework like asyncio? That won't work " + "without some kind of compatibility shim.", + ) + # The foreign library probably doesn't adhere to our + # protocol of unwrapping whatever outcome gets sent in. + # Instead, we'll arrange to throw `exc` in directly, + # which works for at least asyncio and curio. + runner.reschedule(task, exc) # type: ignore[arg-type] + task._next_send_fn = task.coro.throw + # prevent long-lived reference + # TODO: develop test for this deletion + del msg + + if "after_task_step" in runner.instruments: + runner.instruments.call("after_task_step", task) + del GLOBAL_RUN_CONTEXT.task + # prevent long-lived references + # TODO: develop test for this deletion + del task, next_send, next_send_fn + + except GeneratorExit: + # The run-loop generator has been garbage collected without finishing + warnings.warn( + RuntimeWarning( + "Trio guest run got abandoned without properly finishing... " + "weird stuff might happen", + ), + stacklevel=1, + ) + except TrioInternalError: + raise + except BaseException as exc: + raise TrioInternalError("internal error in Trio - please file a bug!") from exc + finally: + runner.close() + GLOBAL_RUN_CONTEXT.__dict__.clear() + + # Have to do this after runner.close() has disabled KI protection, + # because otherwise there's a race where ki_pending could get set + # after we check it. + if runner.ki_pending: + ki = KeyboardInterrupt() + if isinstance(runner.main_task_outcome, Error): + ki.__context__ = runner.main_task_outcome.error + runner.main_task_outcome = Error(ki) + + +################################################################ +# Other public API functions +################################################################ + + +class _TaskStatusIgnored(TaskStatus[object]): + def __repr__(self) -> str: + return "TASK_STATUS_IGNORED" + + def started(self, value: object = None) -> None: + pass + + +TASK_STATUS_IGNORED: Final[TaskStatus[object]] = _TaskStatusIgnored() + + +def current_task() -> Task: + """Return the :class:`Task` object representing the current task. + + Returns: + Task: the :class:`Task` that called :func:`current_task`. + + """ + + try: + return GLOBAL_RUN_CONTEXT.task + except AttributeError: + raise RuntimeError("must be called from async context") from None + + +def current_effective_deadline() -> float: + """Returns the current effective deadline for the current task. + + This function examines all the cancellation scopes that are currently in + effect (taking into account shielding), and returns the deadline that will + expire first. + + One example of where this might be is useful is if your code is trying to + decide whether to begin an expensive operation like an RPC call, but wants + to skip it if it knows that it can't possibly complete in the available + time. Another example would be if you're using a protocol like gRPC that + `propagates timeout information to the remote peer + `__; this function + gives a way to fetch that information so you can send it along. + + If this is called in a context where a cancellation is currently active + (i.e., a blocking call will immediately raise :exc:`Cancelled`), then + returned deadline is ``-inf``. If it is called in a context where no + scopes have a deadline set, it returns ``inf``. + + Returns: + float: the effective deadline, as an absolute time. + + """ + return current_task()._cancel_status.effective_deadline() + + +async def checkpoint() -> None: + """A pure :ref:`checkpoint `. + + This checks for cancellation and allows other tasks to be scheduled, + without otherwise blocking. + + Note that the scheduler has the option of ignoring this and continuing to + run the current task if it decides this is appropriate (e.g. for increased + efficiency). + + Equivalent to ``await trio.sleep(0)`` (which is implemented by calling + :func:`checkpoint`.) + + """ + # The scheduler is what checks timeouts and converts them into + # cancellations. So by doing the schedule point first, we ensure that the + # cancel point has the most up-to-date info. + await cancel_shielded_checkpoint() + task = current_task() + task._cancel_points += 1 + if task._cancel_status.effectively_cancelled or ( + task is task._runner.main_task and task._runner.ki_pending + ): + cs = CancelScope(deadline=-inf) + if ( + task._cancel_status._scope._cancel_reason is None + and task is task._runner.main_task + and task._runner.ki_pending + ): + task._cancel_status._scope._cancel_reason = CancelReason( + source="KeyboardInterrupt" + ) + assert task._cancel_status._scope._cancel_reason is not None + cs._cancel_reason = task._cancel_status._scope._cancel_reason + with cs: + await _core.wait_task_rescheduled(lambda _: _core.Abort.SUCCEEDED) + + +async def checkpoint_if_cancelled() -> None: + """Issue a :ref:`checkpoint ` if the calling context has been + cancelled. + + Equivalent to (but potentially more efficient than):: + + if trio.current_effective_deadline() == -inf: + await trio.lowlevel.checkpoint() + + This is either a no-op, or else it allow other tasks to be scheduled and + then raises :exc:`trio.Cancelled`. + + Typically used together with :func:`cancel_shielded_checkpoint`. + + """ + task = current_task() + if task._cancel_status.effectively_cancelled or ( + task is task._runner.main_task and task._runner.ki_pending + ): + await _core.checkpoint() + raise AssertionError("this should never happen") # pragma: no cover + task._cancel_points += 1 + + +def in_trio_run() -> bool: + """Check whether we are in a Trio run. + This returns `True` if and only if :func:`~trio.current_time` will succeed. + + See also the discussion of differing ways of :ref:`detecting Trio `. + """ + return hasattr(GLOBAL_RUN_CONTEXT, "runner") + + +def in_trio_task() -> bool: + """Check whether we are in a Trio task. + This returns `True` if and only if :func:`~trio.lowlevel.current_task` will succeed. + + See also the discussion of differing ways of :ref:`detecting Trio `. + """ + return hasattr(GLOBAL_RUN_CONTEXT, "task") + + +# export everything for the documentation +if "sphinx.ext.autodoc" in sys.modules: + from ._generated_io_epoll import * + from ._generated_io_kqueue import * + from ._generated_io_windows import * + +if sys.platform == "win32": + from ._generated_io_windows import * + from ._io_windows import ( + EventResult as EventResult, + WindowsIOManager as TheIOManager, + _WindowsStatistics as IOStatistics, + ) +elif sys.platform == "linux" or (not TYPE_CHECKING and hasattr(select, "epoll")): + from ._generated_io_epoll import * + from ._io_epoll import ( + EpollIOManager as TheIOManager, + EventResult as EventResult, + _EpollStatistics as IOStatistics, + ) +elif TYPE_CHECKING or hasattr(select, "kqueue"): + from ._generated_io_kqueue import * + from ._io_kqueue import ( + EventResult as EventResult, + KqueueIOManager as TheIOManager, + _KqueueStatistics as IOStatistics, + ) +else: # pragma: no cover + _patchers = sorted({"eventlet", "gevent"}.intersection(sys.modules)) + if _patchers: + raise NotImplementedError( + "unsupported platform or primitives Trio depends on are monkey-patched out by " + + ", ".join(_patchers), + ) + + raise NotImplementedError("unsupported platform") + +from ._generated_instrumentation import * +from ._generated_run import * diff --git a/contrib/python/trio/trio/_core/_run_context.py b/contrib/python/trio/trio/_core/_run_context.py new file mode 100644 index 000000000000..085bff9a345c --- /dev/null +++ b/contrib/python/trio/trio/_core/_run_context.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +import threading +from typing import TYPE_CHECKING, Final + +if TYPE_CHECKING: + from ._run import Runner, Task + + +class RunContext(threading.local): + runner: Runner + task: Task + + +GLOBAL_RUN_CONTEXT: Final = RunContext() diff --git a/contrib/python/trio/trio/_core/_thread_cache.py b/contrib/python/trio/trio/_core/_thread_cache.py new file mode 100644 index 000000000000..44820e7711fa --- /dev/null +++ b/contrib/python/trio/trio/_core/_thread_cache.py @@ -0,0 +1,315 @@ +from __future__ import annotations + +import ctypes +import ctypes.util +import os +import sys +import traceback +from functools import partial +from itertools import count +from threading import Lock, Thread +from typing import TYPE_CHECKING, Any, Generic, TypeVar + +import outcome + +if TYPE_CHECKING: + from collections.abc import Callable + +RetT = TypeVar("RetT") + + +def _to_os_thread_name(name: str) -> bytes: + # ctypes handles the trailing \00 + return name.encode("ascii", errors="replace")[:15] + + +# used to construct the method used to set os thread name, or None, depending on platform. +# called once on import +def get_os_thread_name_func() -> Callable[[int | None, str], None] | None: + def namefunc( + setname: Callable[[int, bytes], int], + ident: int | None, + name: str, + ) -> None: + # Thread.ident is None "if it has not been started". Unclear if that can happen + # with current usage. + if ident is not None: # pragma: no cover + setname(ident, _to_os_thread_name(name)) + + # namefunc on Mac also takes an ident, even if pthread_setname_np doesn't/can't use it + # so the caller don't need to care about platform. + def darwin_namefunc( + setname: Callable[[bytes], int], + ident: int | None, + name: str, + ) -> None: + # I don't know if Mac can rename threads that hasn't been started, but default + # to no to be on the safe side. + if ident is not None: # pragma: no cover + setname(_to_os_thread_name(name)) + + # find the pthread library + # this will fail on windows and musl + libpthread_path = ctypes.util.find_library("pthread") + if not libpthread_path: + # musl includes pthread functions directly in libc.so + # (but note that find_library("c") does not work on musl, + # see: https://github.com/python/cpython/issues/65821) + # so try that library instead + # if it doesn't exist, CDLL() will fail below + libpthread_path = "libc.so" + + # Sometimes windows can find the path, but gives a permission error when + # accessing it. Catching a wider exception in case of more esoteric errors. + # https://github.com/python-trio/trio/issues/2688 + try: + libpthread = ctypes.CDLL(libpthread_path) + except Exception: # pragma: no cover + return None + + # get the setname method from it + # afaik this should never fail + pthread_setname_np = getattr(libpthread, "pthread_setname_np", None) + if pthread_setname_np is None: # pragma: no cover + return None + + # specify function prototype + pthread_setname_np.restype = ctypes.c_int + + # on mac OSX pthread_setname_np does not take a thread id, + # it only lets threads name themselves, which is not a problem for us. + # Just need to make sure to call it correctly + if sys.platform == "darwin": + pthread_setname_np.argtypes = [ctypes.c_char_p] + return partial(darwin_namefunc, pthread_setname_np) + + # otherwise assume linux parameter conventions. Should also work on *BSD + pthread_setname_np.argtypes = [ctypes.c_void_p, ctypes.c_char_p] + return partial(namefunc, pthread_setname_np) + + +# construct os thread name method +set_os_thread_name = get_os_thread_name_func() + +# The "thread cache" is a simple unbounded thread pool, i.e., it automatically +# spawns as many threads as needed to handle all the requests its given. Its +# only purpose is to cache worker threads so that they don't have to be +# started from scratch every time we want to delegate some work to a thread. +# It's expected that some higher-level code will track how many threads are in +# use to avoid overwhelming the system (e.g. the limiter= argument to +# trio.to_thread.run_sync). +# +# To maximize sharing, there's only one thread cache per process, even if you +# have multiple calls to trio.run. +# +# Guarantees: +# +# It's safe to call start_thread_soon simultaneously from +# multiple threads. +# +# Idle threads are chosen in LIFO order, i.e. we *don't* spread work evenly +# over all threads. Instead we try to let some threads do most of the work +# while others sit idle as much as possible. Compared to FIFO, this has better +# memory cache behavior, and it makes it easier to detect when we have too +# many threads, so idle ones can exit. +# +# This code assumes that 'dict' has the following properties: +# +# - __setitem__, __delitem__, and popitem are all thread-safe and atomic with +# respect to each other. This is guaranteed by the GIL. +# +# - popitem returns the most-recently-added item (i.e., __setitem__ + popitem +# give you a LIFO queue). This relies on dicts being insertion-ordered, like +# they are in py36+. + +# How long a thread will idle waiting for new work before gives up and exits. +# This value is pretty arbitrary; I don't think it matters too much. +IDLE_TIMEOUT = 10 # seconds + +name_counter = count() + + +class WorkerThread(Generic[RetT]): + __slots__ = ("_default_name", "_job", "_thread", "_thread_cache", "_worker_lock") + + def __init__(self, thread_cache: ThreadCache) -> None: + self._job: ( + tuple[ + Callable[[], RetT], + Callable[[outcome.Outcome[RetT]], object], + str | None, + ] + | None + ) = None + self._thread_cache = thread_cache + # This Lock is used in an unconventional way. + # + # "Unlocked" means we have a pending job that's been assigned to us; + # "locked" means that we don't. + # + # Initially we have no job, so it starts out in locked state. + self._worker_lock = Lock() + self._worker_lock.acquire() + self._default_name = f"Trio thread {next(name_counter)}" + + self._thread = Thread(target=self._work, name=self._default_name, daemon=True) + + if set_os_thread_name: + set_os_thread_name(self._thread.ident, self._default_name) + self._thread.start() + + def _handle_job(self) -> None: + # Handle job in a separate method to ensure user-created + # objects are cleaned up in a consistent manner. + assert self._job is not None + fn, deliver, name = self._job + self._job = None + + # set name + if name is not None: + self._thread.name = name + if set_os_thread_name: + set_os_thread_name(self._thread.ident, name) + result = outcome.capture(fn) + + # reset name if it was changed + if name is not None: + self._thread.name = self._default_name + if set_os_thread_name: + set_os_thread_name(self._thread.ident, self._default_name) + + # Tell the cache that we're available to be assigned a new + # job. We do this *before* calling 'deliver', so that if + # 'deliver' triggers a new job, it can be assigned to us + # instead of spawning a new thread. + self._thread_cache._idle_workers[self] = None + try: + deliver(result) + except BaseException as e: + print("Exception while delivering result of thread", file=sys.stderr) + traceback.print_exception(type(e), e, e.__traceback__) + + def _work(self) -> None: + while True: + if self._worker_lock.acquire(timeout=IDLE_TIMEOUT): + # We got a job + self._handle_job() + else: + # Timeout acquiring lock, so we can probably exit. But, + # there's a race condition: we might be assigned a job *just* + # as we're about to exit. So we have to check. + try: + del self._thread_cache._idle_workers[self] + except KeyError: + # Someone else removed us from the idle worker queue, so + # they must be in the process of assigning us a job - loop + # around and wait for it. + continue + else: + # We successfully removed ourselves from the idle + # worker queue, so no more jobs are incoming; it's safe to + # exit. + return + + +class ThreadCache: + __slots__ = ("_idle_workers",) + + def __init__(self) -> None: + self._idle_workers: dict[WorkerThread[Any], None] = {} # type: ignore[explicit-any] + + def start_thread_soon( + self, + fn: Callable[[], RetT], + deliver: Callable[[outcome.Outcome[RetT]], object], + name: str | None = None, + ) -> None: + worker: WorkerThread[RetT] + try: + worker, _ = self._idle_workers.popitem() + except KeyError: + worker = WorkerThread(self) + worker._job = (fn, deliver, name) + worker._worker_lock.release() + + +THREAD_CACHE = ThreadCache() + + +def start_thread_soon( + fn: Callable[[], RetT], + deliver: Callable[[outcome.Outcome[RetT]], object], + name: str | None = None, +) -> None: + """Runs ``deliver(outcome.capture(fn))`` in a worker thread. + + Generally ``fn`` does some blocking work, and ``deliver`` delivers the + result back to whoever is interested. + + This is a low-level, no-frills interface, very similar to using + `threading.Thread` to spawn a thread directly. The main difference is + that this function tries to reuse threads when possible, so it can be + a bit faster than `threading.Thread`. + + Worker threads have the `~threading.Thread.daemon` flag set, which means + that if your main thread exits, worker threads will automatically be + killed. If you want to make sure that your ``fn`` runs to completion, then + you should make sure that the main thread remains alive until ``deliver`` + is called. + + It is safe to call this function simultaneously from multiple threads. + + Args: + + fn (sync function): Performs arbitrary blocking work. + + deliver (sync function): Takes the `outcome.Outcome` of ``fn``, and + delivers it. *Must not block.* + + Because worker threads are cached and reused for multiple calls, neither + function should mutate thread-level state, like `threading.local` objects + – or if they do, they should be careful to revert their changes before + returning. + + Note: + + The split between ``fn`` and ``deliver`` serves two purposes. First, + it's convenient, since most callers need something like this anyway. + + Second, it avoids a small race condition that could cause too many + threads to be spawned. Consider a program that wants to run several + jobs sequentially on a thread, so the main thread submits a job, waits + for it to finish, submits another job, etc. In theory, this program + should only need one worker thread. But what could happen is: + + 1. Worker thread: First job finishes, and calls ``deliver``. + + 2. Main thread: receives notification that the job finished, and calls + ``start_thread_soon``. + + 3. Main thread: sees that no worker threads are marked idle, so spawns + a second worker thread. + + 4. Original worker thread: marks itself as idle. + + To avoid this, threads mark themselves as idle *before* calling + ``deliver``. + + Is this potential extra thread a major problem? Maybe not, but it's + easy enough to avoid, and we figure that if the user is trying to + limit how many threads they're using then it's polite to respect that. + + """ + THREAD_CACHE.start_thread_soon(fn, deliver, name) + + +def clear_worker_threads() -> None: + # This is OK because the child process does not actually have any + # worker threads. Additionally, while WorkerThread keeps a strong + # reference and so would get affected, the only place those are + # stored is here. + THREAD_CACHE._idle_workers.clear() + + +if hasattr(os, "register_at_fork"): + os.register_at_fork(after_in_child=clear_worker_threads) diff --git a/contrib/python/trio/trio/_core/_traps.py b/contrib/python/trio/trio/_core/_traps.py new file mode 100644 index 000000000000..60f72d1295af --- /dev/null +++ b/contrib/python/trio/trio/_core/_traps.py @@ -0,0 +1,310 @@ +"""These are the only functions that ever yield back to the task runner.""" + +from __future__ import annotations + +import enum +import types + +# Jedi gets mad in test_static_tool_sees_class_members if we use collections Callable +from typing import TYPE_CHECKING, Any, Callable, NoReturn, Union, cast + +import attrs +import outcome + +from . import _run + +if TYPE_CHECKING: + from collections.abc import Awaitable, Generator + + from typing_extensions import TypeAlias + + from ._run import Task + +RaiseCancelT: TypeAlias = Callable[[], NoReturn] + + +# This class object is used as a singleton. +# Not exported in the trio._core namespace, but imported directly by _run. +class CancelShieldedCheckpoint: + __slots__ = () + + +# Not exported in the trio._core namespace, but imported directly by _run. +@attrs.frozen(slots=False) +class WaitTaskRescheduled: + abort_func: Callable[[RaiseCancelT], Abort] + + +# Not exported in the trio._core namespace, but imported directly by _run. +@attrs.frozen(slots=False) +class PermanentlyDetachCoroutineObject: + final_outcome: outcome.Outcome[object] + + +MessageType: TypeAlias = Union[ + type[CancelShieldedCheckpoint], + WaitTaskRescheduled, + PermanentlyDetachCoroutineObject, + object, +] + + +# Helper for the bottommost 'yield'. You can't use 'yield' inside an async +# function, but you can inside a generator, and if you decorate your generator +# with @types.coroutine, then it's even awaitable. However, it's still not a +# real async function: in particular, it isn't recognized by +# inspect.iscoroutinefunction, and it doesn't trigger the unawaited coroutine +# tracking machinery. Since our traps are public APIs, we make them real async +# functions, and then this helper takes care of the actual yield: +@types.coroutine +def _real_async_yield( + obj: MessageType, +) -> Generator[MessageType, None, None]: + return (yield obj) + + +# Real yield value is from trio's main loop, but type checkers can't +# understand that, so we cast it to make type checkers understand. +_async_yield = cast( + "Callable[[MessageType], Awaitable[outcome.Outcome[object]]]", + _real_async_yield, +) + + +async def cancel_shielded_checkpoint() -> None: + """Introduce a schedule point, but not a cancel point. + + This is *not* a :ref:`checkpoint `, but it is half of a + checkpoint, and when combined with :func:`checkpoint_if_cancelled` it can + make a full checkpoint. + + Equivalent to (but potentially more efficient than):: + + with trio.CancelScope(shield=True): + await trio.lowlevel.checkpoint() + + """ + (await _async_yield(CancelShieldedCheckpoint)).unwrap() + + +# Return values for abort functions +class Abort(enum.Enum): + """:class:`enum.Enum` used as the return value from abort functions. + + See :func:`wait_task_rescheduled` for details. + + .. data:: SUCCEEDED + FAILED + + """ + + SUCCEEDED = 1 + FAILED = 2 + + +# Should always return the type a Task "expects", unless you willfully reschedule it +# with a bad value. +async def wait_task_rescheduled( # type: ignore[explicit-any] + abort_func: Callable[[RaiseCancelT], Abort], +) -> Any: + """Put the current task to sleep, with cancellation support. + + This is the lowest-level API for blocking in Trio. Every time a + :class:`~trio.lowlevel.Task` blocks, it does so by calling this function + (usually indirectly via some higher-level API). + + This is a tricky interface with no guard rails. If you can use + :class:`ParkingLot` or the built-in I/O wait functions instead, then you + should. + + Generally the way it works is that before calling this function, you make + arrangements for "someone" to call :func:`reschedule` on the current task + at some later point. + + Then you call :func:`wait_task_rescheduled`, passing in ``abort_func``, an + "abort callback". + + (Terminology: in Trio, "aborting" is the process of attempting to + interrupt a blocked task to deliver a cancellation.) + + There are two possibilities for what happens next: + + 1. "Someone" calls :func:`reschedule` on the current task, and + :func:`wait_task_rescheduled` returns or raises whatever value or error + was passed to :func:`reschedule`. + + 2. The call's context transitions to a cancelled state (e.g. due to a + timeout expiring). When this happens, the ``abort_func`` is called. Its + interface looks like:: + + def abort_func(raise_cancel): + ... + return trio.lowlevel.Abort.SUCCEEDED # or FAILED + + It should attempt to clean up any state associated with this call, and + in particular, arrange that :func:`reschedule` will *not* be called + later. If (and only if!) it is successful, then it should return + :data:`Abort.SUCCEEDED`, in which case the task will automatically be + rescheduled with an appropriate :exc:`~trio.Cancelled` error. + + Otherwise, it should return :data:`Abort.FAILED`. This means that the + task can't be cancelled at this time, and still has to make sure that + "someone" eventually calls :func:`reschedule`. + + At that point there are again two possibilities. You can simply ignore + the cancellation altogether: wait for the operation to complete and + then reschedule and continue as normal. (For example, this is what + :func:`trio.to_thread.run_sync` does if cancellation is disabled.) + The other possibility is that the ``abort_func`` does succeed in + cancelling the operation, but for some reason isn't able to report that + right away. (Example: on Windows, it's possible to request that an + async ("overlapped") I/O operation be cancelled, but this request is + *also* asynchronous – you don't find out until later whether the + operation was actually cancelled or not.) To report a delayed + cancellation, then you should reschedule the task yourself, and call + the ``raise_cancel`` callback passed to ``abort_func`` to raise a + :exc:`~trio.Cancelled` (or possibly :exc:`KeyboardInterrupt`) exception + into this task. Either of the approaches sketched below can work:: + + # Option 1: + # Catch the exception from raise_cancel and inject it into the task. + # (This is what Trio does automatically for you if you return + # Abort.SUCCEEDED.) + trio.lowlevel.reschedule(task, outcome.capture(raise_cancel)) + + # Option 2: + # wait to be woken by "someone", and then decide whether to raise + # the error from inside the task. + outer_raise_cancel = None + def abort(inner_raise_cancel): + nonlocal outer_raise_cancel + outer_raise_cancel = inner_raise_cancel + TRY_TO_CANCEL_OPERATION() + return trio.lowlevel.Abort.FAILED + await wait_task_rescheduled(abort) + if OPERATION_WAS_SUCCESSFULLY_CANCELLED: + # raises the error + outer_raise_cancel() + + In any case it's guaranteed that we only call the ``abort_func`` at most + once per call to :func:`wait_task_rescheduled`. + + Sometimes, it's useful to be able to share some mutable sleep-related data + between the sleeping task, the abort function, and the waking task. You + can use the sleeping task's :data:`~Task.custom_sleep_data` attribute to + store this data, and Trio won't touch it, except to make sure that it gets + cleared when the task is rescheduled. + + .. warning:: + + If your ``abort_func`` raises an error, or returns any value other than + :data:`Abort.SUCCEEDED` or :data:`Abort.FAILED`, then Trio will crash + violently. Be careful! Similarly, it is entirely possible to deadlock a + Trio program by failing to reschedule a blocked task, or cause havoc by + calling :func:`reschedule` too many times. Remember what we said up + above about how you should use a higher-level API if at all possible? + + """ + return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap() + + +async def permanently_detach_coroutine_object( + final_outcome: outcome.Outcome[object], +) -> object: + """Permanently detach the current task from the Trio scheduler. + + Normally, a Trio task doesn't exit until its coroutine object exits. When + you call this function, Trio acts like the coroutine object just exited + and the task terminates with the given outcome. This is useful if you want + to permanently switch the coroutine object over to a different coroutine + runner. + + When the calling coroutine enters this function it's running under Trio, + and when the function returns it's running under the foreign coroutine + runner. + + You should make sure that the coroutine object has released any + Trio-specific resources it has acquired (e.g. nurseries). + + Args: + final_outcome (outcome.Outcome): Trio acts as if the current task exited + with the given return value or exception. + + Returns or raises whatever value or exception the new coroutine runner + uses to resume the coroutine. + + """ + if _run.current_task().child_nurseries: + raise RuntimeError( + "can't permanently detach a coroutine object with open nurseries", + ) + return await _async_yield(PermanentlyDetachCoroutineObject(final_outcome)) + + +async def temporarily_detach_coroutine_object( + abort_func: Callable[[RaiseCancelT], Abort], +) -> object: + """Temporarily detach the current coroutine object from the Trio + scheduler. + + When the calling coroutine enters this function it's running under Trio, + and when the function returns it's running under the foreign coroutine + runner. + + The Trio :class:`Task` will continue to exist, but will be suspended until + you use :func:`reattach_detached_coroutine_object` to resume it. In the + mean time, you can use another coroutine runner to schedule the coroutine + object. In fact, you have to – the function doesn't return until the + coroutine is advanced from outside. + + Note that you'll need to save the current :class:`Task` object to later + resume; you can retrieve it with :func:`current_task`. You can also use + this :class:`Task` object to retrieve the coroutine object – see + :data:`Task.coro`. + + Args: + abort_func: Same as for :func:`wait_task_rescheduled`, except that it + must return :data:`Abort.FAILED`. (If it returned + :data:`Abort.SUCCEEDED`, then Trio would attempt to reschedule the + detached task directly without going through + :func:`reattach_detached_coroutine_object`, which would be bad.) + Your ``abort_func`` should still arrange for whatever the coroutine + object is doing to be cancelled, and then reattach to Trio and call + the ``raise_cancel`` callback, if possible. + + Returns or raises whatever value or exception the new coroutine runner + uses to resume the coroutine. + + """ + return await _async_yield(WaitTaskRescheduled(abort_func)) + + +async def reattach_detached_coroutine_object(task: Task, yield_value: object) -> None: + """Reattach a coroutine object that was detached using + :func:`temporarily_detach_coroutine_object`. + + When the calling coroutine enters this function it's running under the + foreign coroutine runner, and when the function returns it's running under + Trio. + + This must be called from inside the coroutine being resumed, and yields + whatever value you pass in. (Presumably you'll pass a value that will + cause the current coroutine runner to stop scheduling this task.) Then the + coroutine is resumed by the Trio scheduler at the next opportunity. + + Args: + task (Task): The Trio task object that the current coroutine was + detached from. + yield_value (object): The object to yield to the current coroutine + runner. + + """ + # This is a kind of crude check – in particular, it can fail if the + # passed-in task is where the coroutine *runner* is running. But this is + # an experts-only interface, and there's no easy way to do a more accurate + # check, so I guess that's OK. + if not task.coro.cr_running: + raise RuntimeError("given task does not match calling coroutine") + _run.reschedule(task, outcome.Value("reattaching")) + value = await _async_yield(yield_value) + assert value == outcome.Value("reattaching") diff --git a/contrib/python/trio/trio/_core/_unbounded_queue.py b/contrib/python/trio/trio/_core/_unbounded_queue.py new file mode 100644 index 000000000000..b9e7974841c7 --- /dev/null +++ b/contrib/python/trio/trio/_core/_unbounded_queue.py @@ -0,0 +1,163 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Generic, TypeVar + +import attrs + +from .. import _core +from .._deprecate import deprecated +from .._util import final + +T = TypeVar("T") + +if TYPE_CHECKING: + from typing_extensions import Self + + +@attrs.frozen +class UnboundedQueueStatistics: + """An object containing debugging information. + + Currently, the following fields are defined: + + * ``qsize``: The number of items currently in the queue. + * ``tasks_waiting``: The number of tasks blocked on this queue's + :meth:`get_batch` method. + + """ + + qsize: int + tasks_waiting: int + + +@final +class UnboundedQueue(Generic[T]): + """An unbounded queue suitable for certain unusual forms of inter-task + communication. + + This class is designed for use as a queue in cases where the producer for + some reason cannot be subjected to back-pressure, i.e., :meth:`put_nowait` + has to always succeed. In order to prevent the queue backlog from actually + growing without bound, the consumer API is modified to dequeue items in + "batches". If a consumer task processes each batch without yielding, then + this helps achieve (but does not guarantee) an effective bound on the + queue's memory use, at the cost of potentially increasing system latencies + in general. You should generally prefer to use a memory channel + instead if you can. + + Currently each batch completely empties the queue, but `this may change in + the future `__. + + A :class:`UnboundedQueue` object can be used as an asynchronous iterator, + where each iteration returns a new batch of items. I.e., these two loops + are equivalent:: + + async for batch in queue: + ... + + while True: + obj = await queue.get_batch() + ... + + """ + + @deprecated( + "0.9.0", + issue=497, + thing="trio.lowlevel.UnboundedQueue", + instead="trio.open_memory_channel(math.inf)", + use_triodeprecationwarning=True, + ) + def __init__(self) -> None: + self._lot = _core.ParkingLot() + self._data: list[T] = [] + # used to allow handoff from put to the first task in the lot + self._can_get = False + + def __repr__(self) -> str: + return f"" + + def qsize(self) -> int: + """Returns the number of items currently in the queue.""" + return len(self._data) + + def empty(self) -> bool: + """Returns True if the queue is empty, False otherwise. + + There is some subtlety to interpreting this method's return value: see + `issue #63 `__. + + """ + return not self._data + + @_core.enable_ki_protection + def put_nowait(self, obj: T) -> None: + """Put an object into the queue, without blocking. + + This always succeeds, because the queue is unbounded. We don't provide + a blocking ``put`` method, because it would never need to block. + + Args: + obj (object): The object to enqueue. + + """ + if not self._data: + assert not self._can_get + if self._lot: + self._lot.unpark(count=1) + else: + self._can_get = True + self._data.append(obj) + + def _get_batch_protected(self) -> list[T]: + data = self._data.copy() + self._data.clear() + self._can_get = False + return data + + def get_batch_nowait(self) -> list[T]: + """Attempt to get the next batch from the queue, without blocking. + + Returns: + list: A list of dequeued items, in order. On a successful call this + list is always non-empty; if it would be empty we raise + :exc:`~trio.WouldBlock` instead. + + Raises: + ~trio.WouldBlock: if the queue is empty. + + """ + if not self._can_get: + raise _core.WouldBlock + return self._get_batch_protected() + + async def get_batch(self) -> list[T]: + """Get the next batch from the queue, blocking as necessary. + + Returns: + list: A list of dequeued items, in order. This list is always + non-empty. + + """ + await _core.checkpoint_if_cancelled() + if not self._can_get: + await self._lot.park() + return self._get_batch_protected() + else: + try: + return self._get_batch_protected() + finally: + await _core.cancel_shielded_checkpoint() + + def statistics(self) -> UnboundedQueueStatistics: + """Return an :class:`UnboundedQueueStatistics` object containing debugging information.""" + return UnboundedQueueStatistics( + qsize=len(self._data), + tasks_waiting=self._lot.statistics().tasks_waiting, + ) + + def __aiter__(self) -> Self: + return self + + async def __anext__(self) -> list[T]: + return await self.get_batch() diff --git a/contrib/python/trio/trio/_core/_wakeup_socketpair.py b/contrib/python/trio/trio/_core/_wakeup_socketpair.py new file mode 100644 index 000000000000..ea4567017f00 --- /dev/null +++ b/contrib/python/trio/trio/_core/_wakeup_socketpair.py @@ -0,0 +1,75 @@ +from __future__ import annotations + +import contextlib +import signal +import socket +import warnings + +from .. import _core +from .._util import is_main_thread + + +class WakeupSocketpair: + def __init__(self) -> None: + # explicitly typed to please `pyright --verifytypes` without `--ignoreexternal` + self.wakeup_sock: socket.socket + self.write_sock: socket.socket + + self.wakeup_sock, self.write_sock = socket.socketpair() + self.wakeup_sock.setblocking(False) + self.write_sock.setblocking(False) + # This somewhat reduces the amount of memory wasted queueing up data + # for wakeups. With these settings, maximum number of 1-byte sends + # before getting BlockingIOError: + # Linux 4.8: 6 + # macOS (darwin 15.5): 1 + # Windows 10: 525347 + # Windows you're weird. (And on Windows setting SNDBUF to 0 makes send + # blocking, even on non-blocking sockets, so don't do that.) + self.wakeup_sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1) + self.write_sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1) + # On Windows this is a TCP socket so this might matter. On other + # platforms this fails b/c AF_UNIX sockets aren't actually TCP. + with contextlib.suppress(OSError): + self.write_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + self.old_wakeup_fd: int | None = None + + def wakeup_thread_and_signal_safe(self) -> None: + with contextlib.suppress(BlockingIOError): + self.write_sock.send(b"\x00") + + async def wait_woken(self) -> None: + await _core.wait_readable(self.wakeup_sock) + self.drain() + + def drain(self) -> None: + try: + while True: + self.wakeup_sock.recv(2**16) + except BlockingIOError: + pass + + def wakeup_on_signals(self) -> None: + assert self.old_wakeup_fd is None + if not is_main_thread(): + return + fd = self.write_sock.fileno() + self.old_wakeup_fd = signal.set_wakeup_fd(fd, warn_on_full_buffer=False) + if self.old_wakeup_fd != -1: + warnings.warn( + RuntimeWarning( + "It looks like Trio's signal handling code might have " + "collided with another library you're using. If you're " + "running Trio in guest mode, then this might mean you " + "should set host_uses_signal_set_wakeup_fd=True. " + "Otherwise, file a bug on Trio and we'll help you figure " + "out what's going on.", + ), + stacklevel=1, + ) + + def close(self) -> None: + self.wakeup_sock.close() + self.write_sock.close() + if self.old_wakeup_fd is not None: + signal.set_wakeup_fd(self.old_wakeup_fd) diff --git a/contrib/python/trio/trio/_core/_windows_cffi.py b/contrib/python/trio/trio/_core/_windows_cffi.py new file mode 100644 index 000000000000..0e3c0b10b378 --- /dev/null +++ b/contrib/python/trio/trio/_core/_windows_cffi.py @@ -0,0 +1,314 @@ +from __future__ import annotations + +import enum +from typing import TYPE_CHECKING, NewType, NoReturn, Protocol, cast + +if TYPE_CHECKING: + import cffi + from typing_extensions import TypeAlias + + CData: TypeAlias = cffi.api.FFI.CData + CType: TypeAlias = cffi.api.FFI.CType + +from ._generated_windows_ffi import ffi + +################################################################ +# Functions and types +################################################################ + +if not TYPE_CHECKING: + CData: TypeAlias = ffi.CData + CType: TypeAlias = ffi.CType + +AlwaysNull: TypeAlias = CData # We currently always pass ffi.NULL here. +Handle = NewType("Handle", CData) +HandleArray = NewType("HandleArray", CData) + + +class _Kernel32(Protocol): + """Statically typed version of the kernel32.dll functions we use.""" + + def CreateIoCompletionPort( + self, + FileHandle: Handle, + ExistingCompletionPort: CData | AlwaysNull, + CompletionKey: int, + NumberOfConcurrentThreads: int, + /, + ) -> Handle: ... + + def CreateEventA( + self, + lpEventAttributes: AlwaysNull, + bManualReset: bool, + bInitialState: bool, + lpName: AlwaysNull, + /, + ) -> Handle: ... + + def SetFileCompletionNotificationModes( + self, + handle: Handle, + flags: CompletionModes, + /, + ) -> int: ... + + def PostQueuedCompletionStatus( + self, + CompletionPort: Handle, + dwNumberOfBytesTransferred: int, + dwCompletionKey: int, + lpOverlapped: CData | AlwaysNull, + /, + ) -> bool: ... + + def CancelIoEx( + self, + hFile: Handle, + lpOverlapped: CData | AlwaysNull, + /, + ) -> bool: ... + + def WriteFile( + self, + hFile: Handle, + # not sure about this type + lpBuffer: CData, + nNumberOfBytesToWrite: int, + lpNumberOfBytesWritten: AlwaysNull, + lpOverlapped: _Overlapped, + /, + ) -> bool: ... + + def ReadFile( + self, + hFile: Handle, + # not sure about this type + lpBuffer: CData, + nNumberOfBytesToRead: int, + lpNumberOfBytesRead: AlwaysNull, + lpOverlapped: _Overlapped, + /, + ) -> bool: ... + + def GetQueuedCompletionStatusEx( + self, + CompletionPort: Handle, + lpCompletionPortEntries: CData, + ulCount: int, + ulNumEntriesRemoved: CData, + dwMilliseconds: int, + fAlertable: bool | int, + /, + ) -> CData: ... + + def CreateFileW( + self, + lpFileName: CData, + dwDesiredAccess: FileFlags, + dwShareMode: FileFlags, + lpSecurityAttributes: AlwaysNull, + dwCreationDisposition: FileFlags, + dwFlagsAndAttributes: FileFlags, + hTemplateFile: AlwaysNull, + /, + ) -> Handle: ... + + def WaitForSingleObject(self, hHandle: Handle, dwMilliseconds: int, /) -> CData: ... + + def WaitForMultipleObjects( + self, + nCount: int, + lpHandles: HandleArray, + bWaitAll: bool, + dwMilliseconds: int, + /, + ) -> ErrorCodes: ... + + def SetEvent(self, handle: Handle, /) -> None: ... + + def CloseHandle(self, handle: Handle, /) -> bool: ... + + def DeviceIoControl( + self, + hDevice: Handle, + dwIoControlCode: int, + # this is wrong (it's not always null) + lpInBuffer: AlwaysNull, + nInBufferSize: int, + # this is also wrong + lpOutBuffer: AlwaysNull, + nOutBufferSize: int, + lpBytesReturned: AlwaysNull, + lpOverlapped: CData, + /, + ) -> bool: ... + + +class _Nt(Protocol): + """Statically typed version of the dtdll.dll functions we use.""" + + def RtlNtStatusToDosError(self, status: int, /) -> ErrorCodes: ... + + +class _Ws2(Protocol): + """Statically typed version of the ws2_32.dll functions we use.""" + + def WSAGetLastError(self) -> int: ... + + def WSAIoctl( + self, + socket: CData, + dwIoControlCode: WSAIoctls, + lpvInBuffer: AlwaysNull, + cbInBuffer: int, + lpvOutBuffer: CData, + cbOutBuffer: int, + lpcbBytesReturned: CData, # int* + lpOverlapped: AlwaysNull, + # actually LPWSAOVERLAPPED_COMPLETION_ROUTINE + lpCompletionRoutine: AlwaysNull, + /, + ) -> int: ... + + +class _DummyStruct(Protocol): + Offset: int + OffsetHigh: int + + +class _DummyUnion(Protocol): + DUMMYSTRUCTNAME: _DummyStruct + Pointer: object + + +class _Overlapped(Protocol): + Internal: int + InternalHigh: int + DUMMYUNIONNAME: _DummyUnion + hEvent: Handle + + +kernel32 = cast("_Kernel32", ffi.dlopen("kernel32.dll")) +ntdll = cast("_Nt", ffi.dlopen("ntdll.dll")) +ws2_32 = cast("_Ws2", ffi.dlopen("ws2_32.dll")) + +################################################################ +# Magic numbers +################################################################ + +# Here's a great resource for looking these up: +# https://www.magnumdb.com +# (Tip: check the box to see "Hex value") + +INVALID_HANDLE_VALUE = Handle(ffi.cast("HANDLE", -1)) + + +class ErrorCodes(enum.IntEnum): + STATUS_TIMEOUT = 0x102 + WAIT_TIMEOUT = 0x102 + WAIT_ABANDONED = 0x80 + WAIT_OBJECT_0 = 0x00 # object is signaled + WAIT_FAILED = 0xFFFFFFFF + ERROR_IO_PENDING = 997 + ERROR_OPERATION_ABORTED = 995 + ERROR_ABANDONED_WAIT_0 = 735 + ERROR_INVALID_HANDLE = 6 + ERROR_INVALID_PARAMETER = 87 + ERROR_NOT_FOUND = 1168 + ERROR_NOT_SOCKET = 10038 + + +class FileFlags(enum.IntFlag): + GENERIC_READ = 0x80000000 + SYNCHRONIZE = 0x00100000 + FILE_FLAG_OVERLAPPED = 0x40000000 + FILE_SHARE_READ = 1 + FILE_SHARE_WRITE = 2 + FILE_SHARE_DELETE = 4 + CREATE_NEW = 1 + CREATE_ALWAYS = 2 + OPEN_EXISTING = 3 + OPEN_ALWAYS = 4 + TRUNCATE_EXISTING = 5 + + +class AFDPollFlags(enum.IntFlag): + # These are drawn from a combination of: + # https://github.com/piscisaureus/wepoll/blob/master/src/afd.h + # https://github.com/reactos/reactos/blob/master/sdk/include/reactos/drivers/afd/shared.h + AFD_POLL_RECEIVE = 0x0001 + AFD_POLL_RECEIVE_EXPEDITED = 0x0002 # OOB/urgent data + AFD_POLL_SEND = 0x0004 + AFD_POLL_DISCONNECT = 0x0008 # received EOF (FIN) + AFD_POLL_ABORT = 0x0010 # received RST + AFD_POLL_LOCAL_CLOSE = 0x0020 # local socket object closed + AFD_POLL_CONNECT = 0x0040 # socket is successfully connected + AFD_POLL_ACCEPT = 0x0080 # you can call accept on this socket + AFD_POLL_CONNECT_FAIL = 0x0100 # connect() terminated unsuccessfully + # See WSAEventSelect docs for more details on these four: + AFD_POLL_QOS = 0x0200 + AFD_POLL_GROUP_QOS = 0x0400 + AFD_POLL_ROUTING_INTERFACE_CHANGE = 0x0800 + AFD_POLL_EVENT_ADDRESS_LIST_CHANGE = 0x1000 + + +class WSAIoctls(enum.IntEnum): + SIO_BASE_HANDLE = 0x48000022 + SIO_BSP_HANDLE_SELECT = 0x4800001C + SIO_BSP_HANDLE_POLL = 0x4800001D + + +class CompletionModes(enum.IntFlag): + FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 0x1 + FILE_SKIP_SET_EVENT_ON_HANDLE = 0x2 + + +class IoControlCodes(enum.IntEnum): + IOCTL_AFD_POLL = 0x00012024 + + +################################################################ +# Generic helpers +################################################################ + + +def _handle(obj: int | CData) -> Handle: + # For now, represent handles as either cffi HANDLEs or as ints. If you + # try to pass in a file descriptor instead, it's not going to work + # out. (For that msvcrt.get_osfhandle does the trick, but I don't know if + # we'll actually need that for anything...) For sockets this doesn't + # matter, Python never allocates an fd. So let's wait until we actually + # encounter the problem before worrying about it. + if isinstance(obj, int): + return Handle(ffi.cast("HANDLE", obj)) + return Handle(obj) + + +def handle_array(count: int) -> HandleArray: + """Make an array of handles.""" + return HandleArray(ffi.new(f"HANDLE[{count}]")) + + +def raise_winerror( + winerror: int | None = None, + *, + filename: str | None = None, + filename2: str | None = None, +) -> NoReturn: + # assert sys.platform == "win32" # TODO: make this work in MyPy + # ... in the meanwhile, ffi.getwinerror() is undefined on non-Windows, necessitating the type + # ignores. + + if winerror is None: + err = ffi.getwinerror() # type: ignore[attr-defined,unused-ignore] + if err is None: + raise RuntimeError("No error set?") + winerror, msg = err + else: + err = ffi.getwinerror(winerror) # type: ignore[attr-defined,unused-ignore] + if err is None: + raise RuntimeError("No error set?") + _, msg = err + # https://docs.python.org/3/library/exceptions.html#OSError + raise OSError(0, msg, filename, winerror, filename2) diff --git a/contrib/python/trio/trio/_deprecate.py b/contrib/python/trio/trio/_deprecate.py new file mode 100644 index 000000000000..5c827b4fda1b --- /dev/null +++ b/contrib/python/trio/trio/_deprecate.py @@ -0,0 +1,168 @@ +from __future__ import annotations + +import sys +import warnings +from functools import wraps +from typing import TYPE_CHECKING, ClassVar, TypeVar + +import attrs + +if TYPE_CHECKING: + from collections.abc import Callable + + from typing_extensions import ParamSpec + + ArgsT = ParamSpec("ArgsT") + +RetT = TypeVar("RetT") + + +# We want our warnings to be visible by default (at least for now), but we +# also want it to be possible to override that using the -W switch. AFAICT +# this means we cannot inherit from DeprecationWarning, because the only way +# to make it visible by default then would be to add our own filter at import +# time, but that would override -W switches... +class TrioDeprecationWarning(FutureWarning): + """Warning emitted if you use deprecated Trio functionality. + + While a relatively mature project, Trio remains committed to refining its + design and improving usability. As part of this, we occasionally deprecate + or remove functionality that proves suboptimal. If you use Trio, we + recommend `subscribing to issue #1 + `__ to get information about + upcoming deprecations and other backwards compatibility breaking changes. + + Despite the name, this class currently inherits from + :class:`FutureWarning`, not :class:`DeprecationWarning`, because until a + 1.0 release, we want these warnings to be visible by default. You can hide + them by installing a filter or with the ``-W`` switch: see the + :mod:`warnings` documentation for details. + """ + + +def _url_for_issue(issue: int) -> str: + return f"https://github.com/python-trio/trio/issues/{issue}" + + +def _stringify(thing: object) -> str: + if hasattr(thing, "__module__") and hasattr(thing, "__qualname__"): + return f"{thing.__module__}.{thing.__qualname__}" + return str(thing) + + +def warn_deprecated( + thing: object, + version: str, + *, + issue: int | None, + instead: object, + stacklevel: int = 2, + use_triodeprecationwarning: bool = False, +) -> None: + stacklevel += 1 + msg = f"{_stringify(thing)} is deprecated since Trio {version}" + if instead is None: + msg += " with no replacement" + else: + msg += f"; use {_stringify(instead)} instead" + if issue is not None: + msg += f" ({_url_for_issue(issue)})" + if use_triodeprecationwarning: + warning_class: type[Warning] = TrioDeprecationWarning + else: + warning_class = DeprecationWarning + warnings.warn(warning_class(msg), stacklevel=stacklevel) + + +# @deprecated("0.2.0", issue=..., instead=...) +# def ... +def deprecated( + version: str, + *, + thing: object = None, + issue: int | None, + instead: object, + use_triodeprecationwarning: bool = False, +) -> Callable[[Callable[ArgsT, RetT]], Callable[ArgsT, RetT]]: + def do_wrap(fn: Callable[ArgsT, RetT]) -> Callable[ArgsT, RetT]: + nonlocal thing + + @wraps(fn) + def wrapper(*args: ArgsT.args, **kwargs: ArgsT.kwargs) -> RetT: + warn_deprecated( + thing, + version, + instead=instead, + issue=issue, + use_triodeprecationwarning=use_triodeprecationwarning, + ) + return fn(*args, **kwargs) + + # If our __module__ or __qualname__ get modified, we want to pick up + # on that, so we read them off the wrapper object instead of the (now + # hidden) fn object + if thing is None: + thing = wrapper + + if wrapper.__doc__ is not None: + doc = wrapper.__doc__ + doc = doc.rstrip() + doc += "\n\n" + doc += f".. deprecated:: {version}\n" + if instead is not None: + doc += f" Use {_stringify(instead)} instead.\n" + if issue is not None: + doc += f" For details, see `issue #{issue} <{_url_for_issue(issue)}>`__.\n" + doc += "\n" + wrapper.__doc__ = doc + + return wrapper + + return do_wrap + + +def deprecated_alias( + old_qualname: str, + new_fn: Callable[ArgsT, RetT], + version: str, + *, + issue: int | None, +) -> Callable[ArgsT, RetT]: + @deprecated(version, issue=issue, instead=new_fn) + @wraps(new_fn, assigned=("__module__", "__annotations__")) + def wrapper(*args: ArgsT.args, **kwargs: ArgsT.kwargs) -> RetT: + """Deprecated alias.""" + return new_fn(*args, **kwargs) + + wrapper.__qualname__ = old_qualname + wrapper.__name__ = old_qualname.rpartition(".")[-1] + return wrapper + + +@attrs.frozen(slots=False) +class DeprecatedAttribute: + _not_set: ClassVar[object] = object() + + value: object + version: str + issue: int | None + instead: object = _not_set + + +def deprecate_attributes( + module_name: str, deprecated_attributes: dict[str, DeprecatedAttribute] +) -> None: + def __getattr__(name: str) -> object: + if name in deprecated_attributes: + info = deprecated_attributes[name] + instead = info.instead + if instead is DeprecatedAttribute._not_set: + instead = info.value + thing = f"{module_name}.{name}" + warn_deprecated(thing, info.version, issue=info.issue, instead=instead) + return info.value + + msg = "module '{}' has no attribute '{}'" + raise AttributeError(msg.format(module_name, name)) + + sys.modules[module_name].__getattr__ = __getattr__ # type: ignore[method-assign] diff --git a/contrib/python/trio/trio/_dtls.py b/contrib/python/trio/trio/_dtls.py new file mode 100644 index 000000000000..a7dff634d906 --- /dev/null +++ b/contrib/python/trio/trio/_dtls.py @@ -0,0 +1,1387 @@ +# Implementation of DTLS 1.2, using pyopenssl +# https://datatracker.ietf.org/doc/html/rfc6347 +# +# OpenSSL's APIs for DTLS are extremely awkward and limited, which forces us to jump +# through a *lot* of hoops and implement important chunks of the protocol ourselves. +# Hopefully they fix this before implementing DTLS 1.3, because it's a very different +# protocol, and it's probably impossible to pull tricks like we do here. + +from __future__ import annotations + +import contextlib +import enum +import errno +import hmac +import os +import struct +import warnings +import weakref +from itertools import count +from typing import ( + TYPE_CHECKING, + Generic, + TypeVar, + Union, +) +from weakref import ReferenceType, WeakValueDictionary + +import attrs + +import trio + +from ._util import NoPublicConstructor, final + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable, Iterable, Iterator + from types import TracebackType + + # See DTLSEndpoint.__init__ for why this is imported here + from OpenSSL import SSL # noqa: TC004 + from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack + + from trio._socket import AddressFormat + from trio.socket import SocketType + + PosArgsT = TypeVarTuple("PosArgsT") + +MAX_UDP_PACKET_SIZE = 65527 + + +def packet_header_overhead(sock: SocketType) -> int: + if sock.family == trio.socket.AF_INET: + return 28 + else: + return 48 + + +def worst_case_mtu(sock: SocketType) -> int: + if sock.family == trio.socket.AF_INET: + return 576 - packet_header_overhead(sock) + else: + return 1280 - packet_header_overhead(sock) # TODO: test this line + + +def best_guess_mtu(sock: SocketType) -> int: + return 1500 - packet_header_overhead(sock) + + +# There are a bunch of different RFCs that define these codes, so for a +# comprehensive collection look here: +# https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml +class ContentType(enum.IntEnum): + change_cipher_spec = 20 + alert = 21 + handshake = 22 + application_data = 23 + heartbeat = 24 + + +class HandshakeType(enum.IntEnum): + hello_request = 0 + client_hello = 1 + server_hello = 2 + hello_verify_request = 3 + new_session_ticket = 4 + end_of_early_data = 4 + encrypted_extensions = 8 + certificate = 11 + server_key_exchange = 12 + certificate_request = 13 + server_hello_done = 14 + certificate_verify = 15 + client_key_exchange = 16 + finished = 20 + certificate_url = 21 + certificate_status = 22 + supplemental_data = 23 + key_update = 24 + compressed_certificate = 25 + ekt_key = 26 + message_hash = 254 + + +class ProtocolVersion: + DTLS10 = bytes([254, 255]) + DTLS12 = bytes([254, 253]) + + +EPOCH_MASK = 0xFFFF << (6 * 8) + + +# Conventions: +# - All functions that handle network data end in _untrusted. +# - All functions end in _untrusted MUST make sure that bad data from the +# network cannot *only* cause BadPacket to be raised. No IndexError or +# struct.error or whatever. +class BadPacket(Exception): + pass + + +# This checks that the DTLS 'epoch' field is 0, which is true iff we're in the +# initial handshake. It doesn't check the ContentType, because not all +# handshake messages have ContentType==handshake -- for example, +# ChangeCipherSpec is used during the handshake but has its own ContentType. +# +# Cannot fail. +def part_of_handshake_untrusted(packet: bytes) -> bool: + # If the packet is too short, then slicing will successfully return a + # short string, which will necessarily fail to match. + return packet[3:5] == b"\x00\x00" + + +# Cannot fail +def is_client_hello_untrusted(packet: bytes) -> bool: + try: + return ( + packet[0] == ContentType.handshake + and packet[13] == HandshakeType.client_hello + ) + except IndexError: + # Invalid DTLS record + return False + + +# DTLS records are: +# - 1 byte content type +# - 2 bytes version +# - 8 bytes epoch+seqno +# Technically this is 2 bytes epoch then 6 bytes seqno, but we treat it as +# a single 8-byte integer, where epoch changes are represented as jumping +# forward by 2**(6*8). +# - 2 bytes payload length (unsigned big-endian) +# - payload +RECORD_HEADER = struct.Struct("!B2sQH") + + +def to_hex(data: bytes) -> str: # pragma: no cover + return data.hex() + + +@attrs.frozen +class Record: + content_type: int + version: bytes = attrs.field(repr=to_hex) + epoch_seqno: int + payload: bytes = attrs.field(repr=to_hex) + + +def records_untrusted(packet: bytes) -> Iterator[Record]: + i = 0 + while i < len(packet): + try: + ct, version, epoch_seqno, payload_len = RECORD_HEADER.unpack_from(packet, i) + # Marked as no-cover because at time of writing, this code is unreachable + # (records_untrusted only gets called on packets that are either trusted or that + # have passed is_client_hello_untrusted, which filters out short packets) + except struct.error as exc: # pragma: no cover + raise BadPacket("invalid record header") from exc + i += RECORD_HEADER.size + payload = packet[i : i + payload_len] + if len(payload) != payload_len: + raise BadPacket("short record") + i += payload_len + yield Record(ct, version, epoch_seqno, payload) + + +def encode_record(record: Record) -> bytes: + header = RECORD_HEADER.pack( + record.content_type, + record.version, + record.epoch_seqno, + len(record.payload), + ) + return header + record.payload + + +# Handshake messages are: +# - 1 byte message type +# - 3 bytes total message length +# - 2 bytes message sequence number +# - 3 bytes fragment offset +# - 3 bytes fragment length +HANDSHAKE_MESSAGE_HEADER = struct.Struct("!B3sH3s3s") + + +@attrs.frozen +class HandshakeFragment: + msg_type: int + msg_len: int + msg_seq: int + frag_offset: int + frag_len: int + frag: bytes = attrs.field(repr=to_hex) + + +def decode_handshake_fragment_untrusted(payload: bytes) -> HandshakeFragment: + # Raises BadPacket if decoding fails + try: + ( + msg_type, + msg_len_bytes, + msg_seq, + frag_offset_bytes, + frag_len_bytes, + ) = HANDSHAKE_MESSAGE_HEADER.unpack_from(payload) + except struct.error as exc: # TODO: test this line + raise BadPacket("bad handshake message header") from exc + # 'struct' doesn't have built-in support for 24-bit integers, so we + # have to do it by hand. These can't fail. + msg_len = int.from_bytes(msg_len_bytes, "big") + frag_offset = int.from_bytes(frag_offset_bytes, "big") + frag_len = int.from_bytes(frag_len_bytes, "big") + frag = payload[HANDSHAKE_MESSAGE_HEADER.size :] + if len(frag) != frag_len: + raise BadPacket("handshake fragment length doesn't match record length") + return HandshakeFragment( + msg_type, + msg_len, + msg_seq, + frag_offset, + frag_len, + frag, + ) + + +def encode_handshake_fragment(hsf: HandshakeFragment) -> bytes: + hs_header = HANDSHAKE_MESSAGE_HEADER.pack( + hsf.msg_type, + hsf.msg_len.to_bytes(3, "big"), + hsf.msg_seq, + hsf.frag_offset.to_bytes(3, "big"), + hsf.frag_len.to_bytes(3, "big"), + ) + return hs_header + hsf.frag + + +def decode_client_hello_untrusted(packet: bytes) -> tuple[int, bytes, bytes]: + # Raises BadPacket if parsing fails + # Returns (record epoch_seqno, cookie from the packet, data that should be + # hashed into cookie) + try: + # ClientHello has to be the first record in the packet + record = next(records_untrusted(packet)) + # no-cover because at time of writing, this is unreachable: + # decode_client_hello_untrusted is only called on packets that have passed + # is_client_hello_untrusted, which confirms the content type. + if record.content_type != ContentType.handshake: # pragma: no cover + raise BadPacket("not a handshake record") + fragment = decode_handshake_fragment_untrusted(record.payload) + if fragment.msg_type != HandshakeType.client_hello: + raise BadPacket("not a ClientHello") + # ClientHello can't be fragmented, because reassembly requires holding + # per-connection state, and we refuse to allocate per-connection state + # until after we get a valid ClientHello. + if fragment.frag_offset != 0: + raise BadPacket("fragmented ClientHello") + if fragment.frag_len != fragment.msg_len: + raise BadPacket("fragmented ClientHello") + + # As per RFC 6347: + # + # When responding to a HelloVerifyRequest, the client MUST use the + # same parameter values (version, random, session_id, cipher_suites, + # compression_method) as it did in the original ClientHello. The + # server SHOULD use those values to generate its cookie and verify that + # they are correct upon cookie receipt. + # + # However, the record-layer framing can and will change (e.g. the + # second ClientHello will have a new record-layer sequence number). So + # we need to pull out the handshake message alone, discarding the + # record-layer stuff, and then we're going to hash all of it *except* + # the cookie. + + body = fragment.frag + # ClientHello is: + # + # - 2 bytes client_version + # - 32 bytes random + # - 1 byte session_id length + # - session_id + # - 1 byte cookie length + # - cookie + # - everything else + # + # So to find the cookie, so we need to figure out how long the + # session_id is and skip past it. + session_id_len = body[2 + 32] + cookie_len_offset = 2 + 32 + 1 + session_id_len + cookie_len = body[cookie_len_offset] + + cookie_start = cookie_len_offset + 1 + cookie_end = cookie_start + cookie_len + + before_cookie = body[:cookie_len_offset] + cookie = body[cookie_start:cookie_end] + after_cookie = body[cookie_end:] + + if len(cookie) != cookie_len: + raise BadPacket("short cookie") + return (record.epoch_seqno, cookie, before_cookie + after_cookie) + + except (struct.error, IndexError) as exc: + raise BadPacket("bad ClientHello") from exc + + +@attrs.frozen +class HandshakeMessage: + record_version: bytes = attrs.field(repr=to_hex) + msg_type: HandshakeType + msg_seq: int + body: bytearray = attrs.field(repr=to_hex) + + +# ChangeCipherSpec is part of the handshake, but it's not a "handshake +# message" and can't be fragmented the same way. Sigh. +@attrs.frozen +class PseudoHandshakeMessage: + record_version: bytes = attrs.field(repr=to_hex) + content_type: int + payload: bytes = attrs.field(repr=to_hex) + + +# The final record in a handshake is Finished, which is encrypted, can't be fragmented +# (at least by us), and keeps its record number (because it's in a new epoch). So we +# just pass it through unchanged. (Fortunately, the payload is only a single hash value, +# so the largest it will ever be is 64 bytes for a 512-bit hash. Which is small enough +# that it never requires fragmenting to fit into a UDP packet. +@attrs.frozen +class OpaqueHandshakeMessage: + record: Record + + +_AnyHandshakeMessage: TypeAlias = Union[ + HandshakeMessage, + PseudoHandshakeMessage, + OpaqueHandshakeMessage, +] + + +# This takes a raw outgoing handshake volley that openssl generated, and +# reconstructs the handshake messages inside it, so that we can repack them +# into records while retransmitting. So the data ought to be well-behaved -- +# it's not coming from the network. +def decode_volley_trusted( + volley: bytes, +) -> list[_AnyHandshakeMessage]: + messages: list[_AnyHandshakeMessage] = [] + messages_by_seq = {} + for record in records_untrusted(volley): + # ChangeCipherSpec isn't a handshake message, so it can't be fragmented. + # Handshake messages with epoch > 0 are encrypted, so we can't fragment them + # either. Fortunately, ChangeCipherSpec has a 1 byte payload, and the only + # encrypted handshake message is Finished, whose payload is a single hash value + # -- so 32 bytes for SHA-256, 64 for SHA-512, etc. Neither is going to be so + # large that it has to be fragmented to fit into a single packet. + if record.epoch_seqno & EPOCH_MASK: + messages.append(OpaqueHandshakeMessage(record)) + elif record.content_type in (ContentType.change_cipher_spec, ContentType.alert): + messages.append( + PseudoHandshakeMessage( + record.version, + record.content_type, + record.payload, + ), + ) + else: + assert record.content_type == ContentType.handshake + fragment = decode_handshake_fragment_untrusted(record.payload) + msg_type = HandshakeType(fragment.msg_type) + if fragment.msg_seq not in messages_by_seq: + msg = HandshakeMessage( + record.version, + msg_type, + fragment.msg_seq, + bytearray(fragment.msg_len), + ) + messages.append(msg) + messages_by_seq[fragment.msg_seq] = msg + else: + msg = messages_by_seq[fragment.msg_seq] + assert msg.msg_type == fragment.msg_type + assert msg.msg_seq == fragment.msg_seq + assert len(msg.body) == fragment.msg_len + + msg.body[ + fragment.frag_offset : fragment.frag_offset + fragment.frag_len + ] = fragment.frag + + return messages + + +class RecordEncoder: + def __init__(self) -> None: + self._record_seq = count() + + def set_first_record_number(self, n: int) -> None: + self._record_seq = count(n) + + def encode_volley( + self, + messages: Iterable[_AnyHandshakeMessage], + mtu: int, + ) -> list[bytearray]: + packets = [] + packet = bytearray() + for message in messages: + if isinstance(message, OpaqueHandshakeMessage): + encoded = encode_record(message.record) + if mtu - len(packet) - len(encoded) <= 0: # TODO: test this line + packets.append(packet) + packet = bytearray() + packet += encoded + assert len(packet) <= mtu + elif isinstance(message, PseudoHandshakeMessage): + space = mtu - len(packet) - RECORD_HEADER.size - len(message.payload) + if space <= 0: # TODO: test this line + packets.append(packet) + packet = bytearray() + packet += RECORD_HEADER.pack( + message.content_type, + message.record_version, + next(self._record_seq), + len(message.payload), + ) + packet += message.payload + assert len(packet) <= mtu + else: + msg_len_bytes = len(message.body).to_bytes(3, "big") + frag_offset = 0 + frags_encoded = 0 + # If message.body is empty, then we still want to encode it in one + # fragment, not zero. + while frag_offset < len(message.body) or not frags_encoded: + space = ( + mtu + - len(packet) + - RECORD_HEADER.size + - HANDSHAKE_MESSAGE_HEADER.size + ) + if space <= 0: + packets.append(packet) + packet = bytearray() + continue + frag = message.body[frag_offset : frag_offset + space] + frag_offset_bytes = frag_offset.to_bytes(3, "big") + frag_len_bytes = len(frag).to_bytes(3, "big") + frag_offset += len(frag) + + packet += RECORD_HEADER.pack( + ContentType.handshake, + message.record_version, + next(self._record_seq), + HANDSHAKE_MESSAGE_HEADER.size + len(frag), + ) + + packet += HANDSHAKE_MESSAGE_HEADER.pack( + message.msg_type, + msg_len_bytes, + message.msg_seq, + frag_offset_bytes, + frag_len_bytes, + ) + + packet += frag + + frags_encoded += 1 + assert len(packet) <= mtu + + if packet: + packets.append(packet) + + return packets + + +# This bit requires implementing a bona fide cryptographic protocol, so even though it's +# a simple one let's take a moment to discuss the design. +# +# Our goal is to force new incoming handshakes that claim to be coming from a +# given ip:port to prove that they can also receive packets sent to that +# ip:port. (There's nothing in UDP to stop someone from forging the return +# address, and it's often used for stuff like DoS reflection attacks, where +# an attacker tries to trick us into sending data at some innocent victim.) +# For more details, see: +# +# https://datatracker.ietf.org/doc/html/rfc6347#section-4.2.1 +# +# To do this, when we receive an initial ClientHello, we calculate a magic +# cookie, and send it back as a HelloVerifyRequest. Then the client sends us a +# second ClientHello, this time with the magic cookie included, and after we +# check that this cookie is valid we go ahead and start the handshake proper. +# +# So the magic cookie needs the following properties: +# - No-one can forge it without knowing our secret key +# - It ensures that the ip, port, and ClientHello contents from the response +# match those in the challenge +# - It expires after a short-ish period (so that if an attacker manages to steal one, it +# won't be useful for long) +# - It doesn't require storing any peer-specific state on our side +# +# To do that, we take the ip/port/ClientHello data and compute an HMAC of them, using a +# secret key we generate on startup. We also include: +# +# - The current time (using Trio's clock), rounded to the nearest 30 seconds +# - A random salt +# +# Then the cookie is the salt and the HMAC digest concatenated together. +# +# When verifying a cookie, we use the salt + new ip/port/ClientHello data to recompute +# the HMAC digest, for both the current time and the current time minus 30 seconds, and +# if either of them match, we consider the cookie good. +# +# Including the rounded-off time like this means that each cookie is good for at least +# 30 seconds, and possibly as much as 60 seconds. +# +# The salt is probably not necessary -- I'm pretty sure that all it does is make it hard +# for an attacker to figure out when our clock ticks over a 30 second boundary. Which is +# probably pretty harmless? But it's easier to add the salt than to convince myself that +# it's *completely* harmless, so, salt it is. + +COOKIE_REFRESH_INTERVAL = 30 # seconds +KEY_BYTES = 32 +COOKIE_HASH = "sha256" +SALT_BYTES = 8 +# 32 bytes was the maximum cookie length in DTLS 1.0. DTLS 1.2 raised it to 255. I doubt +# there are any DTLS 1.0 implementations still in the wild, but really 32 bytes is +# plenty, and it also gets rid of a confusing warning in Wireshark output. +# +# We truncate the cookie to 32 bytes, of which 8 bytes is salt, so that leaves 24 bytes +# of truncated HMAC = 192 bit security, which is still massive overkill. (TCP uses 32 +# *bits* for this.) HMAC truncation is explicitly noted as safe in RFC 2104: +# https://datatracker.ietf.org/doc/html/rfc2104#section-5 +COOKIE_LENGTH = 32 + + +def _current_cookie_tick() -> int: + return int(trio.current_time() / COOKIE_REFRESH_INTERVAL) + + +# Simple deterministic and invertible serializer -- i.e., a useful tool for converting +# structured data into something we can cryptographically sign. +def _signable(*fields: bytes) -> bytes: + out: list[bytes] = [] + for field in fields: + out.extend((struct.pack("!Q", len(field)), field)) + return b"".join(out) + + +def _make_cookie( + key: bytes, + salt: bytes, + tick: int, + address: AddressFormat, + client_hello_bits: bytes, +) -> bytes: + assert len(salt) == SALT_BYTES + assert len(key) == KEY_BYTES + + signable_data = _signable( + salt, + struct.pack("!Q", tick), + # address is a mix of strings and ints, and variable length, so pack + # it into a single nested field + _signable(*(str(part).encode() for part in address)), + client_hello_bits, + ) + + return (salt + hmac.digest(key, signable_data, COOKIE_HASH))[:COOKIE_LENGTH] + + +def valid_cookie( + key: bytes, + cookie: bytes, + address: AddressFormat, + client_hello_bits: bytes, +) -> bool: + if len(cookie) > SALT_BYTES: + salt = cookie[:SALT_BYTES] + + tick = _current_cookie_tick() + + cur_cookie = _make_cookie(key, salt, tick, address, client_hello_bits) + old_cookie = _make_cookie( + key, + salt, + max(tick - 1, 0), + address, + client_hello_bits, + ) + + # I doubt using a short-circuiting 'or' here would leak any meaningful + # information, but why risk it when '|' is just as easy. + return hmac.compare_digest(cookie, cur_cookie) | hmac.compare_digest( + cookie, + old_cookie, + ) + else: + return False + + +def challenge_for( + key: bytes, + address: AddressFormat, + epoch_seqno: int, + client_hello_bits: bytes, +) -> bytes: + salt = os.urandom(SALT_BYTES) + tick = _current_cookie_tick() + cookie = _make_cookie(key, salt, tick, address, client_hello_bits) + + # HelloVerifyRequest body is: + # - 2 bytes version + # - length-prefixed cookie + # + # The DTLS 1.2 spec says that for this message specifically we should use + # the DTLS 1.0 version. + # + # (It also says the opposite of that, but that part is a mistake: + # https://www.rfc-editor.org/errata/eid4103 + # ). + # + # And I guess we use this for both the message-level and record-level + # ProtocolVersions, since we haven't negotiated anything else yet? + body = ProtocolVersion.DTLS10 + bytes([len(cookie)]) + cookie + + # RFC says have to copy the client's record number + # Errata says it should be handshake message number + # Openssl copies back record sequence number, and always sets message seq + # number 0. So I guess we'll follow openssl. + hs = HandshakeFragment( + msg_type=HandshakeType.hello_verify_request, + msg_len=len(body), + msg_seq=0, + frag_offset=0, + frag_len=len(body), + frag=body, + ) + payload = encode_handshake_fragment(hs) + + packet = encode_record( + Record(ContentType.handshake, ProtocolVersion.DTLS10, epoch_seqno, payload), + ) + return packet + + +_T = TypeVar("_T") + + +class _Queue(Generic[_T]): + def __init__(self, incoming_packets_buffer: int | float) -> None: # noqa: PYI041 + self.s, self.r = trio.open_memory_channel[_T](incoming_packets_buffer) + + +def _read_loop(read_fn: Callable[[int], bytes]) -> bytes: + chunks = [] + while True: + try: + chunk = read_fn(2**14) # max TLS record size + except SSL.WantReadError: + break + chunks.append(chunk) + return b"".join(chunks) + + +async def handle_client_hello_untrusted( + endpoint: DTLSEndpoint, + address: AddressFormat, + packet: bytes, +) -> None: + # it's trivial to write a simple function that directly calls this to + # get code coverage, but it should maybe: + # 1. be removed + # 2. be asserted + # 3. Write a complicated test case where this happens "organically" + if endpoint._listening_context is None: # pragma: no cover + return + + try: + epoch_seqno, cookie, bits = decode_client_hello_untrusted(packet) + except BadPacket: + return + + if endpoint._listening_key is None: + endpoint._listening_key = os.urandom(KEY_BYTES) + + if not valid_cookie(endpoint._listening_key, cookie, address, bits): + challenge_packet = challenge_for( + endpoint._listening_key, + address, + epoch_seqno, + bits, + ) + try: + async with endpoint._send_lock: + await endpoint.socket.sendto(challenge_packet, address) + except (OSError, trio.ClosedResourceError): + pass + else: + # We got a real, valid ClientHello! + stream = DTLSChannel._create(endpoint, address, endpoint._listening_context) + # Our HelloRetryRequest had some sequence number. We need our future sequence + # numbers to be larger than it, so our peer knows that our future records aren't + # stale/duplicates. But, we don't know what this sequence number was. What we do + # know is: + # - the HelloRetryRequest seqno was copied it from the initial ClientHello + # - the new ClientHello has a higher seqno than the initial ClientHello + # So, if we copy the new ClientHello's seqno into our first real handshake + # record and increment from there, that should work. + stream._record_encoder.set_first_record_number(epoch_seqno) + # Process the ClientHello + try: + stream._ssl.bio_write(packet) + stream._ssl.DTLSv1_listen() + except SSL.Error: # pragma: no cover + # ...OpenSSL didn't like it, so I guess we didn't have a valid ClientHello + # after all. + return + + # Check if we have an existing association + old_stream = endpoint._streams.get(address) + if old_stream is not None: + if old_stream._client_hello == (cookie, bits): + # ...This was just a duplicate of the last ClientHello, so never mind. + return + else: + # Ok, this *really is* a new handshake; the old stream should go away. + old_stream._set_replaced() + stream._client_hello = (cookie, bits) + endpoint._streams[address] = stream + endpoint._incoming_connections_q.s.send_nowait(stream) + + +async def dtls_receive_loop( + endpoint_ref: ReferenceType[DTLSEndpoint], + sock: SocketType, +) -> None: + try: + while True: + try: + packet, address = await sock.recvfrom(MAX_UDP_PACKET_SIZE) + except OSError as exc: + if exc.errno == errno.ECONNRESET: + # Windows only: "On a UDP-datagram socket [ECONNRESET] + # indicates a previous send operation resulted in an ICMP Port + # Unreachable message" -- https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom + # + # This is totally useless -- there's nothing we can do with this + # information. So we just ignore it and retry the recv. + continue + else: + raise + endpoint = endpoint_ref() + try: + if endpoint is None: + return + if is_client_hello_untrusted(packet): + await handle_client_hello_untrusted(endpoint, address, packet) + elif address in endpoint._streams: + stream = endpoint._streams[address] + if stream._did_handshake and part_of_handshake_untrusted(packet): + # The peer just sent us more handshake messages, that aren't a + # ClientHello, and we thought the handshake was done. Some of + # the packets that we sent to finish the handshake must have + # gotten lost. So re-send them. We do this directly here instead + # of just putting it into the queue and letting the receiver do + # it, because there's no guarantee that anyone is reading from + # the queue, because we think the handshake is done! + await stream._resend_final_volley() + else: + try: + stream._q.s.send_nowait(packet) + except trio.WouldBlock: + stream._packets_dropped_in_trio += 1 + else: + # Drop packet + pass + finally: + del endpoint + except trio.ClosedResourceError: + # socket was closed + return + except OSError as exc: + if exc.errno in (errno.EBADF, errno.ENOTSOCK): + # socket was closed + return + else: # pragma: no cover + # ??? shouldn't happen + raise + + +@attrs.frozen +class DTLSChannelStatistics: + """Currently this has only one attribute: + + - ``incoming_packets_dropped_in_trio`` (``int``): Gives a count of the number of + incoming packets from this peer that Trio successfully received from the + network, but then got dropped because the internal channel buffer was full. If + this is non-zero, then you might want to call ``receive`` more often, or use a + larger ``incoming_packets_buffer``, or just not worry about it because your + UDP-based protocol should be able to handle the occasional lost packet, right? + + """ + + incoming_packets_dropped_in_trio: int + + +@final +class DTLSChannel(trio.abc.Channel[bytes], metaclass=NoPublicConstructor): + """A DTLS connection. + + This class has no public constructor – you get instances by calling + `DTLSEndpoint.serve` or `~DTLSEndpoint.connect`. + + .. attribute:: endpoint + + The `DTLSEndpoint` that this connection is using. + + .. attribute:: peer_address + + The IP/port of the remote peer that this connection is associated with. + + """ + + def __init__( + self, + endpoint: DTLSEndpoint, + peer_address: AddressFormat, + ctx: SSL.Context, + ) -> None: + self.endpoint = endpoint + self.peer_address = peer_address + self._packets_dropped_in_trio = 0 + self._client_hello = None + self._did_handshake = False + self._ssl = SSL.Connection(ctx) + self._handshake_mtu = 0 + # This calls self._ssl.set_ciphertext_mtu, which is important, because if you + # don't call it then openssl doesn't work. + self.set_ciphertext_mtu(best_guess_mtu(self.endpoint.socket)) + self._replaced = False + self._closed = False + self._q = _Queue[bytes](endpoint.incoming_packets_buffer) + self._handshake_lock = trio.Lock() + self._record_encoder: RecordEncoder = RecordEncoder() + + self._final_volley: list[_AnyHandshakeMessage] = [] + + def _set_replaced(self) -> None: + self._replaced = True + # Any packets we already received could maybe possibly still be processed, but + # there are no more coming. So we close this on the sender side. + self._q.s.close() + + def _check_replaced(self) -> None: + if self._replaced: + raise trio.BrokenResourceError( + "peer tore down this connection to start a new one", + ) + + # XX on systems where we can (maybe just Linux?) take advantage of the kernel's PMTU + # estimate + + # XX should we send close-notify when closing? It seems particularly pointless for + # DTLS where packets are all independent and can be lost anyway. We do at least need + # to handle receiving it properly though, which might be easier if we send it... + + def close(self) -> None: + """Close this connection. + + `DTLSChannel`\\s don't actually own any OS-level resources – the + socket is owned by the `DTLSEndpoint`, not the individual connections. So + you don't really *have* to call this. But it will interrupt any other tasks + calling `receive` with a `ClosedResourceError`, and cause future attempts to use + this connection to fail. + + You can also use this object as a synchronous or asynchronous context manager. + + """ + if self._closed: + return + self._closed = True + if self.endpoint._streams.get(self.peer_address) is self: + del self.endpoint._streams[self.peer_address] + # Will wake any tasks waiting on self._q.get with a + # ClosedResourceError + self._q.r.close() + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + return self.close() + + async def aclose(self) -> None: + """Close this connection, but asynchronously. + + This is included to satisfy the `trio.abc.Channel` contract. It's + identical to `close`, but async. + + """ + self.close() + await trio.lowlevel.checkpoint() + + async def _send_volley(self, volley_messages: list[_AnyHandshakeMessage]) -> None: + packets = self._record_encoder.encode_volley( + volley_messages, + self._handshake_mtu, + ) + for packet in packets: + async with self.endpoint._send_lock: + await self.endpoint.socket.sendto(packet, self.peer_address) + + async def _resend_final_volley(self) -> None: + await self._send_volley(self._final_volley) + + async def do_handshake(self, *, initial_retransmit_timeout: float = 1.0) -> None: + """Perform the handshake. + + Calling this is optional – if you don't, then it will be automatically called + the first time you call `send` or `receive`. But calling it explicitly can be + useful in case you want to control the retransmit timeout, use a cancel scope to + place an overall timeout on the handshake, or catch errors from the handshake + specifically. + + It's safe to call this multiple times, or call it simultaneously from multiple + tasks – the first call will perform the handshake, and the rest will be no-ops. + + Args: + + initial_retransmit_timeout (float): Since UDP is an unreliable protocol, it's + possible that some of the packets we send during the handshake will get + lost. To handle this, DTLS uses a timer to automatically retransmit + handshake packets that don't receive a response. This lets you set the + timeout we use to detect packet loss. Ideally, it should be set to ~1.5 + times the round-trip time to your peer, but 1 second is a reasonable + default. There's `some useful guidance here + `__. + + This is the *initial* timeout, because if packets keep being lost then Trio + will automatically back off to longer values, to avoid overloading the + network. + + """ + async with self._handshake_lock: + if self._did_handshake: + return + + timeout = initial_retransmit_timeout + volley_messages: list[_AnyHandshakeMessage] = [] + volley_failed_sends = 0 + + def read_volley() -> list[_AnyHandshakeMessage]: + volley_bytes = _read_loop(self._ssl.bio_read) + new_volley_messages = decode_volley_trusted(volley_bytes) + if ( + new_volley_messages + and volley_messages + and isinstance(new_volley_messages[0], HandshakeMessage) + and isinstance(volley_messages[0], HandshakeMessage) + and new_volley_messages[0].msg_seq == volley_messages[0].msg_seq + ): + # openssl decided to retransmit; discard because we handle + # retransmits ourselves + return [] + else: + return new_volley_messages + + # If we're a client, we send the initial volley. If we're a server, then + # the initial ClientHello has already been inserted into self._ssl's + # read BIO. So either way, we start by generating a new volley. + with contextlib.suppress(SSL.WantReadError): + self._ssl.do_handshake() + volley_messages = read_volley() + # If we don't have messages to send in our initial volley, then something + # has gone very wrong. (I'm not sure this can actually happen without an + # error from OpenSSL, but we check just in case.) + if not volley_messages: # pragma: no cover + raise SSL.Error("something wrong with peer's ClientHello") + + while True: + # -- at this point, we need to either send or re-send a volley -- + assert volley_messages + self._check_replaced() + await self._send_volley(volley_messages) + # -- then this is where we wait for a reply -- + self.endpoint._ensure_receive_loop() + with trio.move_on_after(timeout) as cscope: + async for packet in self._q.r: + self._ssl.bio_write(packet) + try: + self._ssl.do_handshake() + # We ignore generic SSL.Error here, because you can get those + # from random invalid packets + except (SSL.WantReadError, SSL.Error): + pass + else: + # No exception -> the handshake is done, and we can + # switch into data transfer mode. + self._did_handshake = True + # Might be empty, but that's ok -- we'll just send no + # packets. + self._final_volley = read_volley() + await self._send_volley(self._final_volley) + return + maybe_volley = read_volley() + if maybe_volley: + if ( + isinstance(maybe_volley[0], PseudoHandshakeMessage) + and maybe_volley[0].content_type == ContentType.alert + ): # TODO: test this line + # we're sending an alert (e.g. due to a corrupted + # packet). We want to send it once, but don't save it to + # retransmit -- keep the last volley as the current + # volley. + await self._send_volley(maybe_volley) + else: + # We managed to get all of the peer's volley and + # generate a new one ourselves! break out of the 'for' + # loop and restart the timer. + volley_messages = maybe_volley + # "Implementations SHOULD retain the current timer value + # until a transmission without loss occurs, at which + # time the value may be reset to the initial value." + if volley_failed_sends == 0: + timeout = initial_retransmit_timeout + volley_failed_sends = 0 + break + else: + assert self._replaced + self._check_replaced() + if cscope.cancelled_caught: + # Timeout expired. Double timeout for backoff, with a limit of 60 + # seconds (this matches what openssl does, and also the + # recommendation in draft-ietf-tls-dtls13). + timeout = min(2 * timeout, 60.0) + volley_failed_sends += 1 + if volley_failed_sends == 2: + # We tried sending this twice and they both failed. Maybe our + # PMTU estimate is wrong? Let's try dropping it to the minimum + # and hope that helps. + self._handshake_mtu = min( + self._handshake_mtu, + worst_case_mtu(self.endpoint.socket), + ) + + async def send(self, data: bytes) -> None: + """Send a packet of data, securely.""" + + if self._closed: + raise trio.ClosedResourceError + if not data: + raise ValueError("openssl doesn't support sending empty DTLS packets") + if not self._did_handshake: + await self.do_handshake() + self._check_replaced() + self._ssl.write(data) + async with self.endpoint._send_lock: + await self.endpoint.socket.sendto( + _read_loop(self._ssl.bio_read), + self.peer_address, + ) + + async def receive(self) -> bytes: + """Fetch the next packet of data from this connection's peer, waiting if + necessary. + + This is safe to call from multiple tasks simultaneously, in case you have some + reason to do that. And more importantly, it's cancellation-safe, meaning that + cancelling a call to `receive` will never cause a packet to be lost or corrupt + the underlying connection. + + """ + if not self._did_handshake: + await self.do_handshake() + # If the packet isn't really valid, then openssl can decode it to the empty + # string (e.g. b/c it's a late-arriving handshake packet, or a duplicate copy of + # a data packet). Skip over these instead of returning them. + while True: + try: + packet = await self._q.r.receive() + except trio.EndOfChannel: + assert self._replaced + self._check_replaced() + self._ssl.bio_write(packet) + cleartext = _read_loop(self._ssl.read) + if cleartext: + return cleartext + + def set_ciphertext_mtu(self, new_mtu: int) -> None: + """Tells Trio the `largest amount of data that can be sent in a single packet to + this peer `__. + + Trio doesn't actually enforce this limit – if you pass a huge packet to `send`, + then we'll dutifully encrypt it and attempt to send it. But calling this method + does have two useful effects: + + - If called before the handshake is performed, then Trio will automatically + fragment handshake messages to fit within the given MTU. It also might + fragment them even smaller, if it detects signs of packet loss, so setting + this should never be necessary to make a successful connection. But, the + packet loss detection only happens after multiple timeouts have expired, so if + you have reason to believe that a smaller MTU is required, then you can set + this to skip those timeouts and establish the connection more quickly. + + - It changes the value returned from `get_cleartext_mtu`. So if you have some + kind of estimate of the network-level MTU, then you can use this to figure out + how much overhead DTLS will need for hashes/padding/etc., and how much space + you have left for your application data. + + The MTU here is measuring the largest UDP *payload* you think can be sent, the + amount of encrypted data that can be handed to the operating system in a single + call to `send`. It should *not* include IP/UDP headers. Note that OS estimates + of the MTU often are link-layer MTUs, so you have to subtract off 28 bytes on + IPv4 and 48 bytes on IPv6 to get the ciphertext MTU. + + By default, Trio assumes an MTU of 1472 bytes on IPv4, and 1452 bytes on IPv6, + which correspond to the common Ethernet MTU of 1500 bytes after accounting for + IP/UDP overhead. + + """ + self._handshake_mtu = new_mtu + self._ssl.set_ciphertext_mtu(new_mtu) + + def get_cleartext_mtu(self) -> int: + """Returns the largest number of bytes that you can pass in a single call to + `send` while still fitting within the network-level MTU. + + See `set_ciphertext_mtu` for more details. + + """ + if not self._did_handshake: + raise trio.NeedHandshakeError + return self._ssl.get_cleartext_mtu() # type: ignore[no-any-return] + + def statistics(self) -> DTLSChannelStatistics: + """Returns a `DTLSChannelStatistics` object with statistics about this connection.""" + return DTLSChannelStatistics(self._packets_dropped_in_trio) + + +@final +class DTLSEndpoint: + """A DTLS endpoint. + + A single UDP socket can handle arbitrarily many DTLS connections simultaneously, + acting as a client or server as needed. A `DTLSEndpoint` object holds a UDP socket + and manages these connections, which are represented as `DTLSChannel` objects. + + Args: + socket: (trio.socket.SocketType): A ``SOCK_DGRAM`` socket. If you want to accept + incoming connections in server mode, then you should probably bind the socket to + some known port. + incoming_packets_buffer (int): Each `DTLSChannel` using this socket has its own + buffer that holds incoming packets until you call `~DTLSChannel.receive` to read + them. This lets you adjust the size of this buffer. `~DTLSChannel.statistics` + lets you check if the buffer has overflowed. + + .. attribute:: socket + incoming_packets_buffer + + Both constructor arguments are also exposed as attributes, in case you need to + access them later. + + """ + + def __init__( + self, + socket: SocketType, + *, + incoming_packets_buffer: int = 10, + ) -> None: + # We do this lazily on first construction, so only people who actually use DTLS + # have to install PyOpenSSL. + global SSL + from OpenSSL import SSL + + # for __del__, in case the next line raises + self._initialized: bool = False + if socket.type != trio.socket.SOCK_DGRAM: + raise ValueError("DTLS requires a SOCK_DGRAM socket") + self._initialized = True + self.socket: SocketType = socket + + self.incoming_packets_buffer = incoming_packets_buffer + self._token = trio.lowlevel.current_trio_token() + # We don't need to track handshaking vs non-handshake connections + # separately. We only keep one connection per remote address; as soon + # as a peer provides a valid cookie, we can immediately tear down the + # old connection. + # {remote address: DTLSChannel} + self._streams: WeakValueDictionary[AddressFormat, DTLSChannel] = ( + WeakValueDictionary() + ) + self._listening_context: SSL.Context | None = None + self._listening_key: bytes | None = None + self._incoming_connections_q = _Queue[DTLSChannel](float("inf")) + self._send_lock = trio.Lock() + self._closed = False + self._receive_loop_spawned = False + + def _ensure_receive_loop(self) -> None: + # We have to spawn this lazily, because on Windows it will immediately error out + # if the socket isn't already bound -- which for clients might not happen until + # after we send our first packet. + if not self._receive_loop_spawned: + trio.lowlevel.spawn_system_task( + dtls_receive_loop, + weakref.ref(self), + self.socket, + ) + self._receive_loop_spawned = True + + def __del__(self) -> None: + # Do nothing if this object was never fully constructed + if not self._initialized: + return + # Close the socket in Trio context (if our Trio context still exists), so that + # the background task gets notified about the closure and can exit. + if not self._closed: + with contextlib.suppress(RuntimeError): + self._token.run_sync_soon(self.close) + # Do this last, because it might raise an exception + warnings.warn( + f"unclosed DTLS endpoint {self!r}", + ResourceWarning, + source=self, + stacklevel=1, + ) + + def close(self) -> None: + """Close this socket, and all associated DTLS connections. + + This object can also be used as a context manager. + + """ + self._closed = True + self.socket.close() + for stream in list(self._streams.values()): + stream.close() + self._incoming_connections_q.s.close() + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + return self.close() + + def _check_closed(self) -> None: + if self._closed: + raise trio.ClosedResourceError + + async def serve( + self, + ssl_context: SSL.Context, + async_fn: Callable[[DTLSChannel, Unpack[PosArgsT]], Awaitable[object]], + *args: Unpack[PosArgsT], + task_status: trio.TaskStatus[None] = trio.TASK_STATUS_IGNORED, + ) -> None: + """Listen for incoming connections, and spawn a handler for each using an + internal nursery. + + Similar to `~trio.serve_tcp`, this function never returns until cancelled, or + the `DTLSEndpoint` is closed and all handlers have exited. + + Usage commonly looks like:: + + async def handler(dtls_channel): + ... + + async with trio.open_nursery() as nursery: + await nursery.start(dtls_endpoint.serve, ssl_context, handler) + # ... do other things here ... + + The ``dtls_channel`` passed into the handler function has already performed the + "cookie exchange" part of the DTLS handshake, so the peer address is + trustworthy. But the actual cryptographic handshake doesn't happen until you + start using it, giving you a chance for any last minute configuration, and the + option to catch and handle handshake errors. + + Args: + ssl_context (OpenSSL.SSL.Context): The PyOpenSSL context object to use for + incoming connections. + async_fn: The handler function that will be invoked for each incoming + connection. + *args: Additional arguments to pass to the handler function. + + """ + self._check_closed() + if self._listening_context is not None: + raise trio.BusyResourceError("another task is already listening") + try: + self.socket.getsockname() + except OSError: # TODO: test this line + raise RuntimeError( + "DTLS socket must be bound before it can serve", + ) from None + self._ensure_receive_loop() + # We do cookie verification ourselves, so tell OpenSSL not to worry about it. + # (See also _inject_client_hello_untrusted.) + ssl_context.set_cookie_verify_callback(lambda *_: True) + set_ssl_context_options(ssl_context) + try: + self._listening_context = ssl_context + task_status.started() + + async def handler_wrapper(stream: DTLSChannel) -> None: + with stream: + await async_fn(stream, *args) + + async with trio.open_nursery() as nursery: + async for stream in self._incoming_connections_q.r: # pragma: no branch + nursery.start_soon(handler_wrapper, stream) + finally: + self._listening_context = None + + def connect( + self, + address: tuple[str, int], + ssl_context: SSL.Context, + ) -> DTLSChannel: + """Initiate an outgoing DTLS connection. + + Notice that this is a synchronous method. That's because it doesn't actually + initiate any I/O – it just sets up a `DTLSChannel` object. The actual handshake + doesn't occur until you start using the `DTLSChannel`. This gives you a chance + to do further configuration first, like setting MTU etc. + + Args: + address: The address to connect to. Usually a (host, port) tuple, like + ``("127.0.0.1", 12345)``. + ssl_context (OpenSSL.SSL.Context): The PyOpenSSL context object to use for + this connection. + + Returns: + DTLSChannel + + """ + # it would be nice if we could detect when 'address' is our own endpoint (a + # loopback connection), because that can't work + # but I don't see how to do it reliably + self._check_closed() + set_ssl_context_options(ssl_context) + channel = DTLSChannel._create(self, address, ssl_context) + channel._ssl.set_connect_state() + old_channel = self._streams.get(address) + if old_channel is not None: + old_channel._set_replaced() + self._streams[address] = channel + return channel + + +def set_ssl_context_options(ctx: SSL.Context) -> None: + # These are mandatory for all DTLS connections. OP_NO_QUERY_MTU is required to + # stop openssl from trying to query the memory BIO's MTU and then breaking, and + # OP_NO_RENEGOTIATION disables renegotiation, which is too complex for us to + # support and isn't useful anyway -- especially for DTLS where it's equivalent + # to just performing a new handshake. + ctx.set_options( + SSL.OP_NO_QUERY_MTU | SSL.OP_NO_RENEGOTIATION, # type: ignore[attr-defined] + ) diff --git a/contrib/python/trio/trio/_file_io.py b/contrib/python/trio/trio/_file_io.py new file mode 100644 index 000000000000..3df9b3e4435c --- /dev/null +++ b/contrib/python/trio/trio/_file_io.py @@ -0,0 +1,513 @@ +from __future__ import annotations + +import io +from collections.abc import Callable, Iterable +from functools import partial +from typing import ( + IO, + TYPE_CHECKING, + Any, + AnyStr, + BinaryIO, + Generic, + TypeVar, + Union, + overload, +) + +import trio + +from ._util import async_wraps +from .abc import AsyncResource + +if TYPE_CHECKING: + from _typeshed import ( + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + StrOrBytesPath, + ) + from typing_extensions import Literal + + from ._sync import CapacityLimiter + +# This list is also in the docs, make sure to keep them in sync +_FILE_SYNC_ATTRS: set[str] = { + "closed", + "encoding", + "errors", + "fileno", + "isatty", + "newlines", + "readable", + "seekable", + "writable", + # not defined in *IOBase: + "buffer", + "raw", + "line_buffering", + "closefd", + "name", + "mode", + "getvalue", + "getbuffer", +} + +# This list is also in the docs, make sure to keep them in sync +_FILE_ASYNC_METHODS: set[str] = { + "flush", + "read", + "read1", + "readall", + "readinto", + "readline", + "readlines", + "seek", + "tell", + "truncate", + "write", + "writelines", + # not defined in *IOBase: + "readinto1", + "peek", +} + + +FileT = TypeVar("FileT") +FileT_co = TypeVar("FileT_co", covariant=True) +T = TypeVar("T") +T_co = TypeVar("T_co", covariant=True) +T_contra = TypeVar("T_contra", contravariant=True) +AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True) +AnyStr_contra = TypeVar("AnyStr_contra", str, bytes, contravariant=True) + +# This is a little complicated. IO objects have a lot of methods, and which are available on +# different types varies wildly. We want to match the interface of whatever file we're wrapping. +# This pile of protocols each has one sync method/property, meaning they're going to be compatible +# with a file class that supports that method/property. The ones parameterized with AnyStr take +# either str or bytes depending. + +# The wrapper is then a generic class, where the typevar is set to the type of the sync file we're +# wrapping. For generics, adding a type to self has a special meaning - properties/methods can be +# conditional - it's only valid to call them if the object you're accessing them on is compatible +# with that type hint. By using the protocols, the type checker will be checking to see if the +# wrapped type has that method, and only allow the methods that do to be called. We can then alter +# the signature however it needs to match runtime behaviour. +# More info: https://mypy.readthedocs.io/en/stable/more_types.html#advanced-uses-of-self-types +if TYPE_CHECKING: + from typing_extensions import Buffer, Protocol + + # fmt: off + + class _HasClosed(Protocol): + @property + def closed(self) -> bool: ... + + class _HasEncoding(Protocol): + @property + def encoding(self) -> str: ... + + class _HasErrors(Protocol): + @property + def errors(self) -> str | None: ... + + class _HasFileNo(Protocol): + def fileno(self) -> int: ... + + class _HasIsATTY(Protocol): + def isatty(self) -> bool: ... + + class _HasNewlines(Protocol[T_co]): + # Type varies here - documented to be None, tuple of strings, strings. Typeshed uses Any. + @property + def newlines(self) -> T_co: ... + + class _HasReadable(Protocol): + def readable(self) -> bool: ... + + class _HasSeekable(Protocol): + def seekable(self) -> bool: ... + + class _HasWritable(Protocol): + def writable(self) -> bool: ... + + class _HasBuffer(Protocol): + @property + def buffer(self) -> BinaryIO: ... + + class _HasRaw(Protocol): + @property + def raw(self) -> io.RawIOBase: ... + + class _HasLineBuffering(Protocol): + @property + def line_buffering(self) -> bool: ... + + class _HasCloseFD(Protocol): + @property + def closefd(self) -> bool: ... + + class _HasName(Protocol): + @property + def name(self) -> str: ... + + class _HasMode(Protocol): + @property + def mode(self) -> str: ... + + class _CanGetValue(Protocol[AnyStr_co]): + def getvalue(self) -> AnyStr_co: ... + + class _CanGetBuffer(Protocol): + def getbuffer(self) -> memoryview: ... + + class _CanFlush(Protocol): + def flush(self) -> None: ... + + class _CanRead(Protocol[AnyStr_co]): + def read(self, size: int | None = ..., /) -> AnyStr_co: ... + + class _CanRead1(Protocol): + def read1(self, size: int | None = ..., /) -> bytes: ... + + class _CanReadAll(Protocol[AnyStr_co]): + def readall(self) -> AnyStr_co: ... + + class _CanReadInto(Protocol): + def readinto(self, buf: Buffer, /) -> int | None: ... + + class _CanReadInto1(Protocol): + def readinto1(self, buffer: Buffer, /) -> int: ... + + class _CanReadLine(Protocol[AnyStr_co]): + def readline(self, size: int = ..., /) -> AnyStr_co: ... + + class _CanReadLines(Protocol[AnyStr]): + def readlines(self, hint: int = ..., /) -> list[AnyStr]: ... + + class _CanSeek(Protocol): + def seek(self, target: int, whence: int = 0, /) -> int: ... + + class _CanTell(Protocol): + def tell(self) -> int: ... + + class _CanTruncate(Protocol): + def truncate(self, size: int | None = ..., /) -> int: ... + + class _CanWrite(Protocol[T_contra]): + def write(self, data: T_contra, /) -> int: ... + + class _CanWriteLines(Protocol[T_contra]): + # The lines parameter varies for bytes/str, so use a typevar to make the async match. + def writelines(self, lines: Iterable[T_contra], /) -> None: ... + + class _CanPeek(Protocol[AnyStr_co]): + def peek(self, size: int = 0, /) -> AnyStr_co: ... + + class _CanDetach(Protocol[T_co]): + # The T typevar will be the unbuffered/binary file this file wraps. + def detach(self) -> T_co: ... + + class _CanClose(Protocol): + def close(self) -> None: ... + + +# FileT needs to be covariant for the protocol trick to work - the real IO types are effectively a +# subtype of the protocols. +class AsyncIOWrapper(AsyncResource, Generic[FileT_co]): + """A generic :class:`~io.IOBase` wrapper that implements the :term:`asynchronous + file object` interface. Wrapped methods that could block are executed in + :meth:`trio.to_thread.run_sync`. + + All properties and methods defined in :mod:`~io` are exposed by this + wrapper, if they exist in the wrapped file object. + """ + + def __init__(self, file: FileT_co) -> None: + self._wrapped = file + + @property + def wrapped(self) -> FileT_co: + """object: A reference to the wrapped file object""" + + return self._wrapped + + if not TYPE_CHECKING: + + def __getattr__(self, name: str) -> object: + if name in _FILE_SYNC_ATTRS: + return getattr(self._wrapped, name) + if name in _FILE_ASYNC_METHODS: + meth = getattr(self._wrapped, name) + + @async_wraps(self.__class__, self._wrapped.__class__, name) + async def wrapper( + *args: Callable[..., T], + **kwargs: object | str | bool | CapacityLimiter | None, + ) -> T: + func = partial(meth, *args, **kwargs) + return await trio.to_thread.run_sync(func) + + # cache the generated method + setattr(self, name, wrapper) + return wrapper + + raise AttributeError(name) + + def __dir__(self) -> Iterable[str]: + attrs = set(super().__dir__()) + attrs.update(a for a in _FILE_SYNC_ATTRS if hasattr(self.wrapped, a)) + attrs.update(a for a in _FILE_ASYNC_METHODS if hasattr(self.wrapped, a)) + return attrs + + def __aiter__(self) -> AsyncIOWrapper[FileT_co]: + return self + + async def __anext__(self: AsyncIOWrapper[_CanReadLine[AnyStr]]) -> AnyStr: + line = await self.readline() + if line: + return line + else: + raise StopAsyncIteration + + async def detach(self: AsyncIOWrapper[_CanDetach[T]]) -> AsyncIOWrapper[T]: + """Like :meth:`io.BufferedIOBase.detach`, but async. + + This also re-wraps the result in a new :term:`asynchronous file object` + wrapper. + + """ + + raw = await trio.to_thread.run_sync(self._wrapped.detach) + return wrap_file(raw) + + async def aclose(self: AsyncIOWrapper[_CanClose]) -> None: + """Like :meth:`io.IOBase.close`, but async. + + This is also shielded from cancellation; if a cancellation scope is + cancelled, the wrapped file object will still be safely closed. + + """ + + # ensure the underling file is closed during cancellation + with trio.CancelScope(shield=True): + await trio.to_thread.run_sync(self._wrapped.close) + + await trio.lowlevel.checkpoint_if_cancelled() + + if TYPE_CHECKING: + # fmt: off + # Based on typing.IO and io stubs. + @property + def closed(self: AsyncIOWrapper[_HasClosed]) -> bool: ... + @property + def encoding(self: AsyncIOWrapper[_HasEncoding]) -> str: ... + @property + def errors(self: AsyncIOWrapper[_HasErrors]) -> str | None: ... + @property + def newlines(self: AsyncIOWrapper[_HasNewlines[T]]) -> T: ... + @property + def buffer(self: AsyncIOWrapper[_HasBuffer]) -> BinaryIO: ... + @property + def raw(self: AsyncIOWrapper[_HasRaw]) -> io.RawIOBase: ... + @property + def line_buffering(self: AsyncIOWrapper[_HasLineBuffering]) -> int: ... + @property + def closefd(self: AsyncIOWrapper[_HasCloseFD]) -> bool: ... + @property + def name(self: AsyncIOWrapper[_HasName]) -> str: ... + @property + def mode(self: AsyncIOWrapper[_HasMode]) -> str: ... + + def fileno(self: AsyncIOWrapper[_HasFileNo]) -> int: ... + def isatty(self: AsyncIOWrapper[_HasIsATTY]) -> bool: ... + def readable(self: AsyncIOWrapper[_HasReadable]) -> bool: ... + def seekable(self: AsyncIOWrapper[_HasSeekable]) -> bool: ... + def writable(self: AsyncIOWrapper[_HasWritable]) -> bool: ... + def getvalue(self: AsyncIOWrapper[_CanGetValue[AnyStr]]) -> AnyStr: ... + def getbuffer(self: AsyncIOWrapper[_CanGetBuffer]) -> memoryview: ... + async def flush(self: AsyncIOWrapper[_CanFlush]) -> None: ... + async def read(self: AsyncIOWrapper[_CanRead[AnyStr]], size: int | None = -1, /) -> AnyStr: ... + async def read1(self: AsyncIOWrapper[_CanRead1], size: int | None = -1, /) -> bytes: ... + async def readall(self: AsyncIOWrapper[_CanReadAll[AnyStr]]) -> AnyStr: ... + async def readinto(self: AsyncIOWrapper[_CanReadInto], buf: Buffer, /) -> int | None: ... + async def readline(self: AsyncIOWrapper[_CanReadLine[AnyStr]], size: int = -1, /) -> AnyStr: ... + async def readlines(self: AsyncIOWrapper[_CanReadLines[AnyStr]]) -> list[AnyStr]: ... + async def seek(self: AsyncIOWrapper[_CanSeek], target: int, whence: int = 0, /) -> int: ... + async def tell(self: AsyncIOWrapper[_CanTell]) -> int: ... + async def truncate(self: AsyncIOWrapper[_CanTruncate], size: int | None = None, /) -> int: ... + async def write(self: AsyncIOWrapper[_CanWrite[T]], data: T, /) -> int: ... + async def writelines(self: AsyncIOWrapper[_CanWriteLines[T]], lines: Iterable[T], /) -> None: ... + async def readinto1(self: AsyncIOWrapper[_CanReadInto1], buffer: Buffer, /) -> int: ... + async def peek(self: AsyncIOWrapper[_CanPeek[AnyStr]], size: int = 0, /) -> AnyStr: ... + + +# Type hints are copied from builtin open. +_OpenFile = Union["StrOrBytesPath", int] +_Opener = Callable[[str, int], int] + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenTextMode = "r", + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[io.TextIOWrapper]: ... + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[io.FileIO]: ... + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenBinaryModeUpdating, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[io.BufferedRandom]: ... + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[io.BufferedWriter]: ... + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenBinaryModeReading, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[io.BufferedReader]: ... + + +@overload +async def open_file( + file: _OpenFile, + mode: OpenBinaryMode, + buffering: int, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[BinaryIO]: ... + + +@overload +async def open_file( # type: ignore[explicit-any] # Any usage matches builtins.open(). + file: _OpenFile, + mode: str, + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[IO[Any]]: ... + + +async def open_file( + file: _OpenFile, + mode: str = "r", + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + closefd: bool = True, + opener: _Opener | None = None, +) -> AsyncIOWrapper[object]: + """Asynchronous version of :func:`open`. + + Returns: + An :term:`asynchronous file object` + + Example:: + + async with await trio.open_file(filename) as f: + async for line in f: + pass + + assert f.closed + + See also: + :func:`trio.Path.open` + + """ + file_ = wrap_file( + await trio.to_thread.run_sync( + io.open, + file, + mode, + buffering, + encoding, + errors, + newline, + closefd, + opener, + ), + ) + return file_ + + +def wrap_file(file: FileT) -> AsyncIOWrapper[FileT]: + """This wraps any file object in a wrapper that provides an asynchronous + file object interface. + + Args: + file: a :term:`file object` + + Returns: + An :term:`asynchronous file object` that wraps ``file`` + + Example:: + + async_file = trio.wrap_file(StringIO('asdf')) + + assert await async_file.read() == 'asdf' + + """ + + def has(attr: str) -> bool: + return hasattr(file, attr) and callable(getattr(file, attr)) + + if not (has("close") and (has("read") or has("write"))): + raise TypeError( + f"{file} does not implement required duck-file methods: " + "close and (read or write)", + ) + + return AsyncIOWrapper(file) diff --git a/contrib/python/trio/trio/_highlevel_generic.py b/contrib/python/trio/trio/_highlevel_generic.py new file mode 100644 index 000000000000..9bd8822c9e01 --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_generic.py @@ -0,0 +1,129 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Generic, TypeVar + +import attrs + +import trio +from trio._util import final + +from .abc import AsyncResource, HalfCloseableStream, ReceiveStream, SendStream + +if TYPE_CHECKING: + from typing_extensions import TypeGuard + + +SendStreamT = TypeVar("SendStreamT", bound=SendStream) +ReceiveStreamT = TypeVar("ReceiveStreamT", bound=ReceiveStream) + + +async def aclose_forcefully(resource: AsyncResource) -> None: + """Close an async resource or async generator immediately, without + blocking to do any graceful cleanup. + + :class:`~trio.abc.AsyncResource` objects guarantee that if their + :meth:`~trio.abc.AsyncResource.aclose` method is cancelled, then they will + still close the resource (albeit in a potentially ungraceful + fashion). :func:`aclose_forcefully` is a convenience function that + exploits this behavior to let you force a resource to be closed without + blocking: it works by calling ``await resource.aclose()`` and then + cancelling it immediately. + + Most users won't need this, but it may be useful on cleanup paths where + you can't afford to block, or if you want to close a resource and don't + care about handling it gracefully. For example, if + :class:`~trio.SSLStream` encounters an error and cannot perform its + own graceful close, then there's no point in waiting to gracefully shut + down the underlying transport either, so it calls ``await + aclose_forcefully(self.transport_stream)``. + + Note that this function is async, and that it acts as a checkpoint, but + unlike most async functions it cannot block indefinitely (at least, + assuming the underlying resource object is correctly implemented). + + """ + with trio.CancelScope() as cs: + cs.cancel(reason="cancelled during aclose_forcefully") + await resource.aclose() + + +def _is_halfclosable(stream: SendStream) -> TypeGuard[HalfCloseableStream]: + """Check if the stream has a send_eof() method.""" + return hasattr(stream, "send_eof") + + +@final +@attrs.define(eq=False, slots=False) +class StapledStream( + HalfCloseableStream, + Generic[SendStreamT, ReceiveStreamT], +): + """This class `staples `__ + together two unidirectional streams to make single bidirectional stream. + + Args: + send_stream (~trio.abc.SendStream): The stream to use for sending. + receive_stream (~trio.abc.ReceiveStream): The stream to use for + receiving. + + Example: + + A silly way to make a stream that echoes back whatever you write to + it:: + + left, right = trio.testing.memory_stream_pair() + echo_stream = StapledStream(SocketStream(left), SocketStream(right)) + await echo_stream.send_all(b"x") + assert await echo_stream.receive_some() == b"x" + + :class:`StapledStream` objects implement the methods in the + :class:`~trio.abc.HalfCloseableStream` interface. They also have two + additional public attributes: + + .. attribute:: send_stream + + The underlying :class:`~trio.abc.SendStream`. :meth:`send_all` and + :meth:`wait_send_all_might_not_block` are delegated to this object. + + .. attribute:: receive_stream + + The underlying :class:`~trio.abc.ReceiveStream`. :meth:`receive_some` + is delegated to this object. + + """ + + send_stream: SendStreamT + receive_stream: ReceiveStreamT + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + """Calls ``self.send_stream.send_all``.""" + return await self.send_stream.send_all(data) + + async def wait_send_all_might_not_block(self) -> None: + """Calls ``self.send_stream.wait_send_all_might_not_block``.""" + return await self.send_stream.wait_send_all_might_not_block() + + async def send_eof(self) -> None: + """Shuts down the send side of the stream. + + If :meth:`self.send_stream.send_eof() ` exists, + then this calls it. Otherwise, this calls + :meth:`self.send_stream.aclose() `. + """ + stream = self.send_stream + if _is_halfclosable(stream): + return await stream.send_eof() + else: + return await stream.aclose() + + # we intentionally accept more types from the caller than we support returning + async def receive_some(self, max_bytes: int | None = None) -> bytes: + """Calls ``self.receive_stream.receive_some``.""" + return await self.receive_stream.receive_some(max_bytes) + + async def aclose(self) -> None: + """Calls ``aclose`` on both underlying streams.""" + try: + await self.send_stream.aclose() + finally: + await self.receive_stream.aclose() diff --git a/contrib/python/trio/trio/_highlevel_open_tcp_listeners.py b/contrib/python/trio/trio/_highlevel_open_tcp_listeners.py new file mode 100644 index 000000000000..023b2b240f35 --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_open_tcp_listeners.py @@ -0,0 +1,251 @@ +from __future__ import annotations + +import errno +import sys +from typing import TYPE_CHECKING + +import trio +from trio import TaskStatus + +from . import socket as tsocket + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable + +if sys.version_info < (3, 11): + from exceptiongroup import ExceptionGroup + + +# Default backlog size: +# +# Having the backlog too low can cause practical problems (a perfectly healthy +# service that starts failing to accept connections if they arrive in a +# burst). +# +# Having it too high doesn't really cause any problems. Like any buffer, you +# want backlog queue to be zero usually, and it won't save you if you're +# getting connection attempts faster than you can call accept() on an ongoing +# basis. But unlike other buffers, this one doesn't really provide any +# backpressure. If a connection gets stuck waiting in the backlog queue, then +# from the peer's point of view the connection succeeded but then their +# send/recv will stall until we get to it, possibly for a long time. OTOH if +# there isn't room in the backlog queue, then their connect stalls, possibly +# for a long time, which is pretty much the same thing. +# +# A large backlog can also use a bit more kernel memory, but this seems fairly +# negligible these days. +# +# So this suggests we should make the backlog as large as possible. This also +# matches what Golang does. However, they do it in a weird way, where they +# have a bunch of code to sniff out the configured upper limit for backlog on +# different operating systems. But on every system, passing in a too-large +# backlog just causes it to be silently truncated to the configured maximum, +# so this is unnecessary -- we can just pass in "infinity" and get the maximum +# that way. (Verified on Windows, Linux, macOS using +# https://github.com/python-trio/trio/wiki/notes-to-self#measure-listen-backlogpy +def _compute_backlog(backlog: int | None) -> int: + # Many systems (Linux, BSDs, ...) store the backlog in a uint16 and are + # missing overflow protection, so we apply our own overflow protection. + # https://github.com/golang/go/issues/5030 + if not isinstance(backlog, int) and backlog is not None: + raise TypeError(f"backlog must be an int or None, not {backlog!r}") + if backlog is None: + return 0xFFFF + return min(backlog, 0xFFFF) + + +async def open_tcp_listeners( + port: int, + *, + host: str | bytes | None = None, + backlog: int | None = None, +) -> list[trio.SocketListener]: + """Create :class:`SocketListener` objects to listen for TCP connections. + + Args: + + port (int): The port to listen on. + + If you use 0 as your port, then the kernel will automatically pick + an arbitrary open port. But be careful: if you use this feature when + binding to multiple IP addresses, then each IP address will get its + own random port, and the returned listeners will probably be + listening on different ports. In particular, this will happen if you + use ``host=None`` – which is the default – because in this case + :func:`open_tcp_listeners` will bind to both the IPv4 wildcard + address (``0.0.0.0``) and also the IPv6 wildcard address (``::``). + + host (str, bytes, or None): The local interface to bind to. This is + passed to :func:`~socket.getaddrinfo` with the ``AI_PASSIVE`` flag + set. + + If you want to bind to the wildcard address on both IPv4 and IPv6, + in order to accept connections on all available interfaces, then + pass ``None``. This is the default. + + If you have a specific interface you want to bind to, pass its IP + address or hostname here. If a hostname resolves to multiple IP + addresses, this function will open one listener on each of them. + + If you want to use only IPv4, or only IPv6, but want to accept on + all interfaces, pass the family-specific wildcard address: + ``"0.0.0.0"`` for IPv4-only and ``"::"`` for IPv6-only. + + backlog (int or None): The listen backlog to use. If you leave this as + ``None`` then Trio will pick a good default. (Currently: whatever + your system has configured as the maximum backlog.) + + Returns: + list of :class:`SocketListener` + + Raises: + :class:`TypeError` if invalid arguments. + + """ + # getaddrinfo sometimes allows port=None, sometimes not (depending on + # whether host=None). And on some systems it treats "" as 0, others it + # doesn't: + # http://klickverbot.at/blog/2012/01/getaddrinfo-edge-case-behavior-on-windows-linux-and-osx/ + if not isinstance(port, int): + raise TypeError(f"port must be an int not {port!r}") + + computed_backlog = _compute_backlog(backlog) + + addresses = await tsocket.getaddrinfo( + host, + port, + type=tsocket.SOCK_STREAM, + flags=tsocket.AI_PASSIVE, + ) + + listeners = [] + unsupported_address_families = [] + try: + for family, type_, proto, _, sockaddr in addresses: + try: + sock = tsocket.socket(family, type_, proto) + except OSError as ex: + if ex.errno == errno.EAFNOSUPPORT: + # If a system only supports IPv4, or only IPv6, it + # is still likely that getaddrinfo will return + # both an IPv4 and an IPv6 address. As long as at + # least one of the returned addresses can be + # turned into a socket, we won't complain about a + # failure to create the other. + unsupported_address_families.append(ex) + continue + else: + raise + try: + # See https://github.com/python-trio/trio/issues/39 + if sys.platform != "win32": + sock.setsockopt(tsocket.SOL_SOCKET, tsocket.SO_REUSEADDR, 1) + + if family == tsocket.AF_INET6: + sock.setsockopt(tsocket.IPPROTO_IPV6, tsocket.IPV6_V6ONLY, 1) + + await sock.bind(sockaddr) + sock.listen(computed_backlog) + + listeners.append(trio.SocketListener(sock)) + except: + sock.close() + raise + except: + for listener in listeners: + listener.socket.close() + raise + + if unsupported_address_families and not listeners: + msg = ( + "This system doesn't support any of the kinds of " + "socket that that address could use" + ) + raise OSError(errno.EAFNOSUPPORT, msg) from ExceptionGroup( + msg, + unsupported_address_families, + ) + + return listeners + + +async def serve_tcp( + handler: Callable[[trio.SocketStream], Awaitable[object]], + port: int, + *, + host: str | bytes | None = None, + backlog: int | None = None, + handler_nursery: trio.Nursery | None = None, + task_status: TaskStatus[list[trio.SocketListener]] = trio.TASK_STATUS_IGNORED, +) -> None: + """Listen for incoming TCP connections, and for each one start a task + running ``handler(stream)``. + + This is a thin convenience wrapper around :func:`open_tcp_listeners` and + :func:`serve_listeners` – see them for full details. + + .. warning:: + + If ``handler`` raises an exception, then this function doesn't do + anything special to catch it – so by default the exception will + propagate out and crash your server. If you don't want this, then catch + exceptions inside your ``handler``, or use a ``handler_nursery`` object + that responds to exceptions in some other way. + + When used with ``nursery.start`` you get back the newly opened listeners. + So, for example, if you want to start a server in your test suite and then + connect to it to check that it's working properly, you can use something + like:: + + from trio import SocketListener, SocketStream + from trio.testing import open_stream_to_socket_listener + + async with trio.open_nursery() as nursery: + listeners: list[SocketListener] = await nursery.start(serve_tcp, handler, 0) + client_stream: SocketStream = await open_stream_to_socket_listener(listeners[0]) + + # Then send and receive data on 'client_stream', for example: + await client_stream.send_all(b"GET / HTTP/1.0\\r\\n\\r\\n") + + This avoids several common pitfalls: + + 1. It lets the kernel pick a random open port, so your test suite doesn't + depend on any particular port being open. + + 2. It waits for the server to be accepting connections on that port before + ``start`` returns, so there's no race condition where the incoming + connection arrives before the server is ready. + + 3. It uses the Listener object to find out which port was picked, so it + can connect to the right place. + + Args: + handler: The handler to start for each incoming connection. Passed to + :func:`serve_listeners`. + + port: The port to listen on. Use 0 to let the kernel pick an open port. + Passed to :func:`open_tcp_listeners`. + + host (str, bytes, or None): The host interface to listen on; use + ``None`` to bind to the wildcard address. Passed to + :func:`open_tcp_listeners`. + + backlog: The listen backlog, or None to have a good default picked. + Passed to :func:`open_tcp_listeners`. + + handler_nursery: The nursery to start handlers in, or None to use an + internal nursery. Passed to :func:`serve_listeners`. + + task_status: This function can be used with ``nursery.start``. + + Returns: + This function only returns when cancelled. + + """ + listeners = await trio.open_tcp_listeners(port, host=host, backlog=backlog) + await trio.serve_listeners( + handler, + listeners, + handler_nursery=handler_nursery, + task_status=task_status, + ) diff --git a/contrib/python/trio/trio/_highlevel_open_tcp_stream.py b/contrib/python/trio/trio/_highlevel_open_tcp_stream.py new file mode 100644 index 000000000000..1787f4a97e9b --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_open_tcp_stream.py @@ -0,0 +1,397 @@ +from __future__ import annotations + +import sys +from contextlib import contextmanager, suppress +from typing import TYPE_CHECKING, Any + +import trio +from trio.socket import SOCK_STREAM, SocketType, getaddrinfo, socket + +if TYPE_CHECKING: + from collections.abc import Generator, MutableSequence + from socket import AddressFamily, SocketKind + + from trio._socket import AddressFormat + +if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup, ExceptionGroup + + +# Implementation of RFC 6555 "Happy eyeballs" +# https://tools.ietf.org/html/rfc6555 +# +# Basically, the problem here is that if we want to connect to some host, and +# DNS returns multiple IP addresses, then we don't know which of them will +# actually work -- it can happen that some of them are reachable, and some of +# them are not. One particularly common situation where this happens is on a +# host that thinks it has ipv6 connectivity, but really doesn't. But in +# principle this could happen for any kind of multi-home situation (e.g. the +# route to one mirror is down but another is up). +# +# The naive algorithm (e.g. the stdlib's socket.create_connection) would be to +# pick one of the IP addresses and try to connect; if that fails, try the +# next; etc. The problem with this is that TCP is stubborn, and if the first +# address is a blackhole then it might take a very long time (tens of seconds) +# before that connection attempt fails. +# +# That's where RFC 6555 comes in. It tells us that what we do is: +# - get the list of IPs from getaddrinfo, trusting the order it gives us (with +# one exception noted in section 5.4) +# - start a connection attempt to the first IP +# - when this fails OR if it's still going after DELAY seconds, then start a +# connection attempt to the second IP +# - when this fails OR if it's still going after another DELAY seconds, then +# start a connection attempt to the third IP +# - ... repeat until we run out of IPs. +# +# Our implementation is similarly straightforward: we spawn a chain of tasks, +# where each one (a) waits until the previous connection has failed or DELAY +# seconds have passed, (b) spawns the next task, (c) attempts to connect. As +# soon as any task crashes or succeeds, we cancel all the tasks and return. +# +# Note: this currently doesn't attempt to cache any results, so if you make +# multiple connections to the same host it'll re-run the happy-eyeballs +# algorithm each time. RFC 6555 is pretty confusing about whether this is +# allowed. Section 4 describes an algorithm that attempts ipv4 and ipv6 +# simultaneously, and then says "The client MUST cache information regarding +# the outcome of each connection attempt, and it uses that information to +# avoid thrashing the network with subsequent attempts." Then section 4.2 says +# "implementations MUST prefer the first IP address family returned by the +# host's address preference policy, unless implementing a stateful +# algorithm". Here "stateful" means "one that caches information about +# previous attempts". So my reading of this is that IF you're starting ipv4 +# and ipv6 at the same time then you MUST cache the result for ~ten minutes, +# but IF you're "preferring" one protocol by trying it first (like we are), +# then you don't need to cache. +# +# Caching is quite tricky: to get it right you need to do things like detect +# when the network interfaces are reconfigured, and if you get it wrong then +# connection attempts basically just don't work. So we don't even try. + +# "Firefox and Chrome use 300 ms" +# https://tools.ietf.org/html/rfc6555#section-6 +# Though +# https://www.researchgate.net/profile/Vaibhav_Bajpai3/publication/304568993_Measuring_the_Effects_of_Happy_Eyeballs/links/5773848e08ae6f328f6c284c/Measuring-the-Effects-of-Happy-Eyeballs.pdf +# claims that Firefox actually uses 0 ms, unless an about:config option is +# toggled and then it uses 250 ms. +DEFAULT_DELAY = 0.250 + +# How should we call getaddrinfo? In particular, should we use AI_ADDRCONFIG? +# +# The idea of AI_ADDRCONFIG is that it only returns addresses that might +# work. E.g., if getaddrinfo knows that you don't have any IPv6 connectivity, +# then it doesn't return any IPv6 addresses. And this is kinda nice, because +# it means maybe you can skip sending AAAA requests entirely. But in practice, +# it doesn't really work right. +# +# - on Linux/glibc, empirically, the default is to return all addresses, and +# with AI_ADDRCONFIG then it only returns IPv6 addresses if there is at least +# one non-loopback IPv6 address configured... but this can be a link-local +# address, so in practice I guess this is basically always configured if IPv6 +# is enabled at all. OTOH if you pass in "::1" as the target address with +# AI_ADDRCONFIG and there's no *external* IPv6 address configured, you get an +# error. So AI_ADDRCONFIG mostly doesn't do anything, even when you would want +# it to, and when it does do something it might break things that would have +# worked. +# +# - on Windows 10, empirically, if no IPv6 address is configured then by +# default they are also suppressed from getaddrinfo (flags=0 and +# flags=AI_ADDRCONFIG seem to do the same thing). If you pass AI_ALL, then you +# get the full list. +# ...except for localhost! getaddrinfo("localhost", "80") gives me ::1, even +# though there's no ipv6 and other queries only return ipv4. +# If you pass in and IPv6 IP address as the target address, then that's always +# returned OK, even with AI_ADDRCONFIG set and no IPv6 configured. +# +# But I guess other versions of windows messed this up, judging from these bug +# reports: +# https://bugs.chromium.org/p/chromium/issues/detail?id=5234 +# https://bugs.chromium.org/p/chromium/issues/detail?id=32522#c50 +# +# So basically the options are either to use AI_ADDRCONFIG and then add some +# complicated special cases to work around its brokenness, or else don't use +# AI_ADDRCONFIG and accept that sometimes on legacy/misconfigured networks +# we'll waste 300 ms trying to connect to a blackholed destination. +# +# Twisted and Tornado always uses default flags. I think we'll do the same. + + +@contextmanager +def close_all() -> Generator[set[SocketType], None, None]: + sockets_to_close: set[SocketType] = set() + try: + yield sockets_to_close + finally: + errs = [] + for sock in sockets_to_close: + try: + sock.close() + except BaseException as exc: + errs.append(exc) + if len(errs) == 1: + raise errs[0] + elif errs: + raise BaseExceptionGroup("", errs) + + +def reorder_for_rfc_6555_section_5_4( # type: ignore[explicit-any] + targets: MutableSequence[tuple[AddressFamily, SocketKind, int, str, Any]], +) -> None: + # RFC 6555 section 5.4 says that if getaddrinfo returns multiple address + # families (e.g. IPv4 and IPv6), then you should make sure that your first + # and second attempts use different families: + # + # https://tools.ietf.org/html/rfc6555#section-5.4 + # + # This function post-processes the results from getaddrinfo, in-place, to + # satisfy this requirement. + for i in range(1, len(targets)): + if targets[i][0] != targets[0][0]: + # Found the first entry with a different address family; move it + # so that it becomes the second item on the list. + if i != 1: + targets.insert(1, targets.pop(i)) + break + + +def format_host_port(host: str | bytes, port: int | str) -> str: + host = host.decode("ascii") if isinstance(host, bytes) else host + if ":" in host: + return f"[{host}]:{port}" + else: + return f"{host}:{port}" + + +# Twisted's HostnameEndpoint has a good set of configurables: +# https://twistedmatrix.com/documents/current/api/twisted.internet.endpoints.HostnameEndpoint.html +# +# - per-connection timeout +# this doesn't seem useful -- we let you set a timeout on the whole thing +# using Trio's normal mechanisms, and that seems like enough +# - delay between attempts +# - bind address (but not port!) +# they *don't* support multiple address bindings, like giving the ipv4 and +# ipv6 addresses of the host. +# I think maybe our semantics should be: we accept a list of bind addresses, +# and we bind to the first one that is compatible with the +# connection attempt we want to make, and if none are compatible then we +# don't try to connect to that target. +# +# XX TODO: implement bind address support +# +# Actually, the best option is probably to be explicit: {AF_INET: "...", +# AF_INET6: "..."} +# this might be simpler after +async def open_tcp_stream( + host: str | bytes, + port: int, + *, + happy_eyeballs_delay: float | None = DEFAULT_DELAY, + local_address: str | None = None, +) -> trio.SocketStream: + """Connect to the given host and port over TCP. + + If the given ``host`` has multiple IP addresses associated with it, then + we have a problem: which one do we use? + + One approach would be to attempt to connect to the first one, and then if + that fails, attempt to connect to the second one ... until we've tried all + of them. But the problem with this is that if the first IP address is + unreachable (for example, because it's an IPv6 address and our network + discards IPv6 packets), then we might end up waiting tens of seconds for + the first connection attempt to timeout before we try the second address. + + Another approach would be to attempt to connect to all of the addresses at + the same time, in parallel, and then use whichever connection succeeds + first, abandoning the others. This would be fast, but create a lot of + unnecessary load on the network and the remote server. + + This function strikes a balance between these two extremes: it works its + way through the available addresses one at a time, like the first + approach; but, if ``happy_eyeballs_delay`` seconds have passed and it's + still waiting for an attempt to succeed or fail, then it gets impatient + and starts the next connection attempt in parallel. As soon as any one + connection attempt succeeds, all the other attempts are cancelled. This + avoids unnecessary load because most connections will succeed after just + one or two attempts, but if one of the addresses is unreachable then it + doesn't slow us down too much. + + This is known as a "happy eyeballs" algorithm, and our particular variant + is modelled after how Chrome connects to webservers; see `RFC 6555 + `__ for more details. + + Args: + host (str or bytes): The host to connect to. Can be an IPv4 address, + IPv6 address, or a hostname. + + port (int): The port to connect to. + + happy_eyeballs_delay (float or None): How many seconds to wait for each + connection attempt to succeed or fail before getting impatient and + starting another one in parallel. Set to `None` if you want + to limit to only one connection attempt at a time (like + :func:`socket.create_connection`). Default: 0.25 (250 ms). + + local_address (None or str): The local IP address or hostname to use as + the source for outgoing connections. If ``None``, we let the OS pick + the source IP. + + This is useful in some exotic networking configurations where your + host has multiple IP addresses, and you want to force the use of a + specific one. + + Note that if you pass an IPv4 ``local_address``, then you won't be + able to connect to IPv6 hosts, and vice-versa. If you want to take + advantage of this to force the use of IPv4 or IPv6 without + specifying an exact source address, you can use the IPv4 wildcard + address ``local_address="0.0.0.0"``, or the IPv6 wildcard address + ``local_address="::"``. + + Returns: + SocketStream: a :class:`~trio.abc.Stream` connected to the given server. + + Raises: + OSError: if the connection fails. + + See also: + open_ssl_over_tcp_stream + + """ + + # To keep our public API surface smaller, rule out some cases that + # getaddrinfo will accept in some circumstances, but that act weird or + # have non-portable behavior or are just plain not useful. + if not isinstance(host, (str, bytes)): + raise ValueError(f"host must be str or bytes, not {host!r}") + if not isinstance(port, int): + raise TypeError(f"port must be int, not {port!r}") + + if happy_eyeballs_delay is None: + happy_eyeballs_delay = DEFAULT_DELAY + + targets = await getaddrinfo(host, port, type=SOCK_STREAM) + + # I don't think this can actually happen -- if there are no results, + # getaddrinfo should have raised OSError instead of returning an empty + # list. But let's be paranoid and handle it anyway: + if not targets: + msg = f"no results found for hostname lookup: {format_host_port(host, port)}" + raise OSError(msg) + + reorder_for_rfc_6555_section_5_4(targets) + + # This list records all the connection failures that we ignored. + oserrors: list[OSError] = [] + + # Keeps track of the socket that we're going to complete with, + # need to make sure this isn't automatically closed + winning_socket: SocketType | None = None + + # Try connecting to the specified address. Possible outcomes: + # - success: record connected socket in winning_socket and cancel + # concurrent attempts + # - failure: record exception in oserrors, set attempt_failed allowing + # the next connection attempt to start early + # code needs to ensure sockets can be closed appropriately in the + # face of crash or cancellation + async def attempt_connect( + socket_args: tuple[AddressFamily, SocketKind, int], + sockaddr: AddressFormat, + attempt_failed: trio.Event, + ) -> None: + nonlocal winning_socket + + try: + sock = socket(*socket_args) + open_sockets.add(sock) + + if local_address is not None: + # TCP connections are identified by a 4-tuple: + # + # (local IP, local port, remote IP, remote port) + # + # So if a single local IP wants to make multiple connections + # to the same (remote IP, remote port) pair, then those + # connections have to use different local ports, or else TCP + # won't be able to tell them apart. OTOH, if you have multiple + # connections to different remote IP/ports, then those + # connections can share a local port. + # + # Normally, when you call bind(), the kernel will immediately + # assign a specific local port to your socket. At this point + # the kernel doesn't know which (remote IP, remote port) + # you're going to use, so it has to pick a local port that + # *no* other connection is using. That's the only way to + # guarantee that this local port will be usable later when we + # call connect(). (Alternatively, you can set SO_REUSEADDR to + # allow multiple nascent connections to share the same port, + # but then connect() might fail with EADDRNOTAVAIL if we get + # unlucky and our TCP 4-tuple ends up colliding with another + # unrelated connection.) + # + # So calling bind() before connect() works, but it disables + # sharing of local ports. This is inefficient: it makes you + # more likely to run out of local ports. + # + # But on some versions of Linux, we can re-enable sharing of + # local ports by setting a special flag. This flag tells + # bind() to only bind the IP, and not the port. That way, + # connect() is allowed to pick the the port, and it can do a + # better job of it because it knows the remote IP/port. + with suppress(OSError, AttributeError): + sock.setsockopt( + trio.socket.IPPROTO_IP, + trio.socket.IP_BIND_ADDRESS_NO_PORT, + 1, + ) + try: + await sock.bind((local_address, 0)) + except OSError: + raise OSError( + f"local_address={local_address!r} is incompatible " + f"with remote address {sockaddr!r}", + ) from None + + await sock.connect(sockaddr) + + # Success! Save the winning socket and cancel all outstanding + # connection attempts. + winning_socket = sock + nursery.cancel_scope.cancel(reason="successfully found a socket") + except OSError as exc: + # This connection attempt failed, but the next one might + # succeed. Save the error for later so we can report it if + # everything fails, and tell the next attempt that it should go + # ahead (if it hasn't already). + oserrors.append(exc) + attempt_failed.set() + + with close_all() as open_sockets: + # nursery spawns a task for each connection attempt, will be + # cancelled by the task that gets a successful connection + async with trio.open_nursery() as nursery: + for address_family, socket_type, proto, _, addr in targets: + # create an event to indicate connection failure, + # allowing the next target to be tried early + attempt_failed = trio.Event() + + nursery.start_soon( + attempt_connect, + (address_family, socket_type, proto), + addr, + attempt_failed, + ) + + # give this attempt at most this time before moving on + with trio.move_on_after(happy_eyeballs_delay): + await attempt_failed.wait() + + # nothing succeeded + if winning_socket is None: + assert len(oserrors) == len(targets) + msg = f"all attempts to connect to {format_host_port(host, port)} failed" + raise OSError(msg) from ExceptionGroup(msg, oserrors) + else: + stream = trio.SocketStream(winning_socket) + open_sockets.remove(winning_socket) + return stream diff --git a/contrib/python/trio/trio/_highlevel_open_unix_stream.py b/contrib/python/trio/trio/_highlevel_open_unix_stream.py new file mode 100644 index 000000000000..d419574369cc --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_open_unix_stream.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +import os +from contextlib import contextmanager +from typing import TYPE_CHECKING, Protocol, TypeVar + +import trio +from trio.socket import SOCK_STREAM, socket + +if TYPE_CHECKING: + from collections.abc import Generator + + +class Closable(Protocol): + def close(self) -> None: ... + + +CloseT = TypeVar("CloseT", bound=Closable) + + +try: + from trio.socket import AF_UNIX + + has_unix = True +except ImportError: + has_unix = False + + +@contextmanager +def close_on_error(obj: CloseT) -> Generator[CloseT, None, None]: + try: + yield obj + except: + obj.close() + raise + + +async def open_unix_socket( + filename: str | bytes | os.PathLike[str] | os.PathLike[bytes], +) -> trio.SocketStream: + """Opens a connection to the specified + `Unix domain socket `__. + + You must have read/write permission on the specified file to connect. + + Args: + filename (str or bytes): The filename to open the connection to. + + Returns: + SocketStream: a :class:`~trio.abc.Stream` connected to the given file. + + Raises: + OSError: If the socket file could not be connected to. + RuntimeError: If AF_UNIX sockets are not supported. + """ + if not has_unix: + raise RuntimeError("Unix sockets are not supported on this platform") + + # much more simplified logic vs tcp sockets - one socket type and only one + # possible location to connect to + sock = socket(AF_UNIX, SOCK_STREAM) + with close_on_error(sock): + await sock.connect(os.fspath(filename)) + + return trio.SocketStream(sock) diff --git a/contrib/python/trio/trio/_highlevel_serve_listeners.py b/contrib/python/trio/trio/_highlevel_serve_listeners.py new file mode 100644 index 000000000000..008caaabea55 --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_serve_listeners.py @@ -0,0 +1,148 @@ +from __future__ import annotations + +import errno +import logging +import os +from collections.abc import Awaitable, Callable +from typing import Any, NoReturn, TypeVar + +import trio + +# Errors that accept(2) can return, and which indicate that the system is +# overloaded +ACCEPT_CAPACITY_ERRNOS = { + errno.EMFILE, + errno.ENFILE, + errno.ENOMEM, + errno.ENOBUFS, +} + +# How long to sleep when we get one of those errors +SLEEP_TIME = 0.100 + +# The logger we use to complain when this happens +LOGGER = logging.getLogger("trio.serve_listeners") + + +StreamT = TypeVar("StreamT", bound=trio.abc.AsyncResource) +ListenerT = TypeVar("ListenerT", bound=trio.abc.Listener[Any]) # type: ignore[explicit-any] +Handler = Callable[[StreamT], Awaitable[object]] + + +async def _run_handler(stream: StreamT, handler: Handler[StreamT]) -> None: + try: + await handler(stream) + finally: + await trio.aclose_forcefully(stream) + + +async def _serve_one_listener( + listener: trio.abc.Listener[StreamT], + handler_nursery: trio.Nursery, + handler: Handler[StreamT], +) -> NoReturn: + async with listener: + while True: + try: + stream = await listener.accept() + except OSError as exc: + if exc.errno in ACCEPT_CAPACITY_ERRNOS: + LOGGER.error( + "accept returned %s (%s); retrying in %s seconds", + errno.errorcode[exc.errno], + os.strerror(exc.errno), + SLEEP_TIME, + exc_info=True, + ) + await trio.sleep(SLEEP_TIME) + else: + raise + else: + handler_nursery.start_soon(_run_handler, stream, handler) + + +# This cannot be typed correctly, we need generic typevar bounds / HKT to indicate the +# relationship between StreamT & ListenerT. +# https://github.com/python/typing/issues/1226 +# https://github.com/python/typing/issues/548 + + +async def serve_listeners( # type: ignore[explicit-any] + handler: Handler[StreamT], + listeners: list[ListenerT], + *, + handler_nursery: trio.Nursery | None = None, + task_status: trio.TaskStatus[list[ListenerT]] = trio.TASK_STATUS_IGNORED, +) -> NoReturn: + r"""Listen for incoming connections on ``listeners``, and for each one + start a task running ``handler(stream)``. + + .. warning:: + + If ``handler`` raises an exception, then this function doesn't do + anything special to catch it – so by default the exception will + propagate out and crash your server. If you don't want this, then catch + exceptions inside your ``handler``, or use a ``handler_nursery`` object + that responds to exceptions in some other way. + + Args: + + handler: An async callable, that will be invoked like + ``handler_nursery.start_soon(handler, stream)`` for each incoming + connection. + + listeners: A list of :class:`~trio.abc.Listener` objects. + :func:`serve_listeners` takes responsibility for closing them. + + handler_nursery: The nursery used to start handlers, or any object with + a ``start_soon`` method. If ``None`` (the default), then + :func:`serve_listeners` will create a new nursery internally and use + that. + + task_status: This function can be used with ``nursery.start``, which + will return ``listeners``. + + Returns: + + This function never returns unless cancelled. + + Resource handling: + + If ``handler`` neglects to close the ``stream``, then it will be closed + using :func:`trio.aclose_forcefully`. + + Error handling: + + Most errors coming from :meth:`~trio.abc.Listener.accept` are allowed to + propagate out (crashing the server in the process). However, some errors – + those which indicate that the server is temporarily overloaded – are + handled specially. These are :class:`OSError`\s with one of the following + errnos: + + * ``EMFILE``: process is out of file descriptors + * ``ENFILE``: system is out of file descriptors + * ``ENOBUFS``, ``ENOMEM``: the kernel hit some sort of memory limitation + when trying to create a socket object + + When :func:`serve_listeners` gets one of these errors, then it: + + * Logs the error to the standard library logger ``trio.serve_listeners`` + (level = ERROR, with exception information included). By default this + causes it to be printed to stderr. + * Waits 100 ms before calling ``accept`` again, in hopes that the + system will recover. + + """ + async with trio.open_nursery() as nursery: + if handler_nursery is None: + handler_nursery = nursery + for listener in listeners: + nursery.start_soon(_serve_one_listener, listener, handler_nursery, handler) + # The listeners are already queueing connections when we're called, + # but we wait until the end to call started() just in case we get an + # error or whatever. + task_status.started(listeners) + + raise AssertionError( + "_serve_one_listener should never complete", + ) # pragma: no cover diff --git a/contrib/python/trio/trio/_highlevel_socket.py b/contrib/python/trio/trio/_highlevel_socket.py new file mode 100644 index 000000000000..142ab11e0731 --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_socket.py @@ -0,0 +1,423 @@ +# "High-level" networking interface +from __future__ import annotations + +import errno +from contextlib import contextmanager, suppress +from typing import TYPE_CHECKING, overload + +import trio + +from . import socket as tsocket +from ._util import ConflictDetector, final +from .abc import HalfCloseableStream, Listener + +if TYPE_CHECKING: + from collections.abc import Generator + + from ._socket import SocketType + +import sys + +if sys.version_info >= (3, 12): + # NOTE: this isn't in the `TYPE_CHECKING` since for some reason + # sphinx doesn't autoreload this module for SocketStream + # (hypothesis: it's our module renaming magic) + from collections.abc import Buffer +elif TYPE_CHECKING: + from typing_extensions import Buffer + +# XX TODO: this number was picked arbitrarily. We should do experiments to +# tune it. (Or make it dynamic -- one idea is to start small and increase it +# if we observe single reads filling up the whole buffer, at least within some +# limits.) +DEFAULT_RECEIVE_SIZE = 65536 + +_closed_stream_errnos = { + # Unix + errno.EBADF, + # Windows + errno.ENOTSOCK, +} + + +@contextmanager +def _translate_socket_errors_to_stream_errors() -> Generator[None, None, None]: + try: + yield + except OSError as exc: + if exc.errno in _closed_stream_errnos: + raise trio.ClosedResourceError("this socket was already closed") from None + else: + raise trio.BrokenResourceError(f"socket connection broken: {exc}") from exc + + +@final +class SocketStream(HalfCloseableStream): + """An implementation of the :class:`trio.abc.HalfCloseableStream` + interface based on a raw network socket. + + Args: + socket: The Trio socket object to wrap. Must have type ``SOCK_STREAM``, + and be connected. + + By default for TCP sockets, :class:`SocketStream` enables ``TCP_NODELAY``, + and (on platforms where it's supported) enables ``TCP_NOTSENT_LOWAT`` with + a reasonable buffer size (currently 16 KiB) – see `issue #72 + `__ for discussion. You can + of course override these defaults by calling :meth:`setsockopt`. + + Once a :class:`SocketStream` object is constructed, it implements the full + :class:`trio.abc.HalfCloseableStream` interface. In addition, it provides + a few extra features: + + .. attribute:: socket + + The Trio socket object that this stream wraps. + + """ + + def __init__(self, socket: SocketType) -> None: + if not isinstance(socket, tsocket.SocketType): + raise TypeError("SocketStream requires a Trio socket object") + if socket.type != tsocket.SOCK_STREAM: + raise ValueError("SocketStream requires a SOCK_STREAM socket") + + self.socket = socket + self._send_conflict_detector = ConflictDetector( + "another task is currently sending data on this SocketStream", + ) + + # Socket defaults: + + # Not supported on e.g. unix domain sockets + with suppress(OSError): + self.setsockopt(tsocket.IPPROTO_TCP, tsocket.TCP_NODELAY, True) + + if hasattr(tsocket, "TCP_NOTSENT_LOWAT"): + # 16 KiB is pretty arbitrary and could probably do with some + # tuning. (Apple is also setting this by default in CFNetwork + # apparently -- I'm curious what value they're using, though I + # couldn't find it online trivially. CFNetwork-129.20 source + # has no mentions of TCP_NOTSENT_LOWAT. This presentation says + # "typically 8 kilobytes": + # http://devstreaming.apple.com/videos/wwdc/2015/719ui2k57m/719/719_your_app_and_next_generation_networks.pdf?dl=1 + # ). The theory is that you want it to be bandwidth * + # rescheduling interval. + with suppress(OSError): + self.setsockopt(tsocket.IPPROTO_TCP, tsocket.TCP_NOTSENT_LOWAT, 2**14) + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + if self.socket.did_shutdown_SHUT_WR: + raise trio.ClosedResourceError("can't send data after sending EOF") + with self._send_conflict_detector: + with _translate_socket_errors_to_stream_errors(): + with memoryview(data) as data: + if not data: + if self.socket.fileno() == -1: + raise trio.ClosedResourceError("socket was already closed") + await trio.lowlevel.checkpoint() + return + total_sent = 0 + while total_sent < len(data): + with data[total_sent:] as remaining: + sent = await self.socket.send(remaining) + total_sent += sent + + async def wait_send_all_might_not_block(self) -> None: + with self._send_conflict_detector: + if self.socket.fileno() == -1: + raise trio.ClosedResourceError + with _translate_socket_errors_to_stream_errors(): + await self.socket.wait_writable() + + async def send_eof(self) -> None: + with self._send_conflict_detector: + await trio.lowlevel.checkpoint() + # On macOS, calling shutdown a second time raises ENOTCONN, but + # send_eof needs to be idempotent. + if self.socket.did_shutdown_SHUT_WR: + return + with _translate_socket_errors_to_stream_errors(): + self.socket.shutdown(tsocket.SHUT_WR) + + async def receive_some(self, max_bytes: int | None = None) -> bytes: + if max_bytes is None: + max_bytes = DEFAULT_RECEIVE_SIZE + if max_bytes < 1: + raise ValueError("max_bytes must be >= 1") + with _translate_socket_errors_to_stream_errors(): + return await self.socket.recv(max_bytes) + + async def aclose(self) -> None: + self.socket.close() + await trio.lowlevel.checkpoint() + + # __aenter__, __aexit__ inherited from HalfCloseableStream are OK + + @overload + def setsockopt(self, level: int, option: int, value: int | Buffer) -> None: ... + + @overload + def setsockopt(self, level: int, option: int, value: None, length: int) -> None: ... + + # TODO: rename `length` to `optlen` + def setsockopt( + self, + level: int, + option: int, + value: int | Buffer | None, + length: int | None = None, + ) -> None: + """Set an option on the underlying socket. + + See :meth:`socket.socket.setsockopt` for details. + + """ + if length is None: + if value is None: + raise TypeError( + "invalid value for argument 'value', must not be None when specifying length", + ) + return self.socket.setsockopt(level, option, value) + if value is not None: + raise TypeError( + f"invalid value for argument 'value': {value!r}, must be None when specifying optlen", + ) + return self.socket.setsockopt(level, option, value, length) + + @overload + def getsockopt(self, level: int, option: int) -> int: ... + + @overload + def getsockopt(self, level: int, option: int, buffersize: int) -> bytes: ... + + def getsockopt(self, level: int, option: int, buffersize: int = 0) -> int | bytes: + """Check the current value of an option on the underlying socket. + + See :meth:`socket.socket.getsockopt` for details. + + """ + # This is to work around + # https://bitbucket.org/pypy/pypy/issues/2561 + # We should be able to drop it when the next PyPy3 beta is released. + if buffersize == 0: + return self.socket.getsockopt(level, option) + else: + return self.socket.getsockopt(level, option, buffersize) + + +################################################################ +# SocketListener +################################################################ + +# Accept error handling +# ===================== +# +# Literature review +# ----------------- +# +# Here's a list of all the possible errors that accept() can return, according +# to the POSIX spec or the Linux, FreeBSD, macOS, and Windows docs: +# +# Can't happen with a Trio socket: +# - EAGAIN/(WSA)EWOULDBLOCK +# - EINTR +# - WSANOTINITIALISED +# - WSAEINPROGRESS: a blocking call is already in progress +# - WSAEINTR: someone called WSACancelBlockingCall, but we don't make blocking +# calls in the first place +# +# Something is wrong with our call: +# - EBADF: not a file descriptor +# - (WSA)EINVAL: socket isn't listening, or (Linux, BSD) bad flags +# - (WSA)ENOTSOCK: not a socket +# - (WSA)EOPNOTSUPP: this kind of socket doesn't support accept +# - (Linux, FreeBSD, Windows) EFAULT: the sockaddr pointer points to readonly +# memory +# +# Something is wrong with the environment: +# - (WSA)EMFILE: this process hit its fd limit +# - ENFILE: the system hit its fd limit +# - (WSA)ENOBUFS, ENOMEM: unspecified memory problems +# +# Something is wrong with the connection we were going to accept. There's a +# ton of variability between systems here: +# - ECONNABORTED: documented everywhere, but apparently only the BSDs do this +# (signals a connection was closed/reset before being accepted) +# - EPROTO: unspecified protocol error +# - (Linux) EPERM: firewall rule prevented connection +# - (Linux) ENETDOWN, EPROTO, ENOPROTOOPT, EHOSTDOWN, ENONET, EHOSTUNREACH, +# EOPNOTSUPP, ENETUNREACH, ENOSR, ESOCKTNOSUPPORT, EPROTONOSUPPORT, +# ETIMEDOUT, ... or any other error that the socket could give, because +# apparently if an error happens on a connection before it's accept()ed, +# Linux will report that error from accept(). +# - (Windows) WSAECONNRESET, WSAENETDOWN +# +# +# Code review +# ----------- +# +# What do other libraries do? +# +# Twisted on Unix or when using nonblocking I/O on Windows: +# - ignores EPERM, with comment about Linux firewalls +# - logs and ignores EMFILE, ENOBUFS, ENFILE, ENOMEM, ECONNABORTED +# Comment notes that ECONNABORTED is a BSDism and that Linux returns the +# socket before having it fail, and macOS just silently discards it. +# - other errors are raised, which is logged + kills the socket +# ref: src/twisted/internet/tcp.py, Port.doRead +# +# Twisted using IOCP on Windows: +# - logs and ignores all errors +# ref: src/twisted/internet/iocpreactor/tcp.py, Port.handleAccept +# +# Tornado: +# - ignore ECONNABORTED (comments notes that it was observed on FreeBSD) +# - everything else raised, but all this does (by default) is cause it to be +# logged and then ignored +# (ref: tornado/netutil.py, tornado/ioloop.py) +# +# libuv on Unix: +# - ignores ECONNABORTED +# - does a "trick" for EMFILE or ENFILE +# - all other errors passed to the connection_cb to be handled +# (ref: src/unix/stream.c:uv__server_io, uv__emfile_trick) +# +# libuv on Windows: +# src/win/tcp.c:uv_tcp_queue_accept +# this calls AcceptEx, and then arranges to call: +# src/win/tcp.c:uv_process_tcp_accept_req +# this gets the result from AcceptEx. If the original AcceptEx call failed, +# then "we stop accepting connections and report this error to the +# connection callback". I think this is for things like ENOTSOCK. If +# AcceptEx successfully queues an overlapped operation, and then that +# reports an error, it's just discarded. +# +# asyncio, selector mode: +# - ignores EWOULDBLOCK, EINTR, ECONNABORTED +# - on EMFILE, ENFILE, ENOBUFS, ENOMEM, logs an error and then disables the +# listening loop for 1 second +# - everything else raises, but then the event loop just logs and ignores it +# (selector_events.py: BaseSelectorEventLoop._accept_connection) +# +# +# What should we do? +# ------------------ +# +# When accept() returns an error, we can either ignore it or raise it. +# +# We have a long list of errors that should be ignored, and a long list of +# errors that should be raised. The big question is what to do with an error +# that isn't on either list. On Linux apparently you can get nearly arbitrary +# errors from accept() and they should be ignored, because it just indicates a +# socket that crashed before it began, and there isn't really anything to be +# done about this, plus on other platforms you may not get any indication at +# all, so programs have to tolerate not getting any indication too. OTOH if we +# get an unexpected error then it could indicate something arbitrarily bad -- +# after all, it's unexpected. +# +# Given that we know that other libraries seem to be getting along fine with a +# fairly minimal list of errors to ignore, I think we'll be OK if we write +# down that list and then raise on everything else. +# +# The other question is what to do about the capacity problem errors: EMFILE, +# ENFILE, ENOBUFS, ENOMEM. Just flat out ignoring these is clearly not optimal +# -- at the very least you want to log them, and probably you want to take +# some remedial action. And if we ignore them then it prevents higher levels +# from doing anything clever with them. So we raise them. + +_ignorable_accept_errno_names = [ + # Linux can do this when the a connection is denied by the firewall + "EPERM", + # BSDs with an early close/reset + "ECONNABORTED", + # All the other miscellany noted above -- may not happen in practice, but + # whatever. + "EPROTO", + "ENETDOWN", + "ENOPROTOOPT", + "EHOSTDOWN", + "ENONET", + "EHOSTUNREACH", + "EOPNOTSUPP", + "ENETUNREACH", + "ENOSR", + "ESOCKTNOSUPPORT", + "EPROTONOSUPPORT", + "ETIMEDOUT", + "ECONNRESET", +] + +# Not all errnos are defined on all platforms +_ignorable_accept_errnos: set[int] = set() +for name in _ignorable_accept_errno_names: + with suppress(AttributeError): + _ignorable_accept_errnos.add(getattr(errno, name)) + + +@final +class SocketListener(Listener[SocketStream]): + """A :class:`~trio.abc.Listener` that uses a listening socket to accept + incoming connections as :class:`SocketStream` objects. + + Args: + socket: The Trio socket object to wrap. Must have type ``SOCK_STREAM``, + and be listening. + + Note that the :class:`SocketListener` "takes ownership" of the given + socket; closing the :class:`SocketListener` will also close the socket. + + .. attribute:: socket + + The Trio socket object that this stream wraps. + + """ + + def __init__(self, socket: SocketType) -> None: + if not isinstance(socket, tsocket.SocketType): + raise TypeError("SocketListener requires a Trio socket object") + if socket.type != tsocket.SOCK_STREAM: + raise ValueError("SocketListener requires a SOCK_STREAM socket") + try: + listening = socket.getsockopt(tsocket.SOL_SOCKET, tsocket.SO_ACCEPTCONN) + except OSError: + # SO_ACCEPTCONN fails on macOS; we just have to trust the user. + pass + else: + if not listening: + raise ValueError("SocketListener requires a listening socket") + + self.socket = socket + + async def accept(self) -> SocketStream: + """Accept an incoming connection. + + Returns: + :class:`SocketStream` + + Raises: + OSError: if the underlying call to ``accept`` raises an unexpected + error. + ClosedResourceError: if you already closed the socket. + + This method handles routine errors like ``ECONNABORTED``, but passes + other errors on to its caller. In particular, it does *not* make any + special effort to handle resource exhaustion errors like ``EMFILE``, + ``ENFILE``, ``ENOBUFS``, ``ENOMEM``. + + """ + while True: + try: + sock, _ = await self.socket.accept() + except OSError as exc: + if exc.errno in _closed_stream_errnos: + raise trio.ClosedResourceError from None + if exc.errno not in _ignorable_accept_errnos: + raise + else: + return SocketStream(sock) + + async def aclose(self) -> None: + """Close this listener and its underlying socket.""" + self.socket.close() + await trio.lowlevel.checkpoint() diff --git a/contrib/python/trio/trio/_highlevel_ssl_helpers.py b/contrib/python/trio/trio/_highlevel_ssl_helpers.py new file mode 100644 index 000000000000..1239491a43bc --- /dev/null +++ b/contrib/python/trio/trio/_highlevel_ssl_helpers.py @@ -0,0 +1,180 @@ +from __future__ import annotations + +import ssl +from typing import TYPE_CHECKING, NoReturn, TypeVar + +import trio + +from ._highlevel_open_tcp_stream import DEFAULT_DELAY + +T = TypeVar("T") + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable + + from ._highlevel_socket import SocketStream + + +# It might have been nice to take a ssl_protocols= argument here to set up +# NPN/ALPN, but to do this we have to mutate the context object, which is OK +# if it's one we created, but not OK if it's one that was passed in... and +# the one major protocol using NPN/ALPN is HTTP/2, which mandates that you use +# a specially configured SSLContext anyway! I also thought maybe we could copy +# the given SSLContext and then mutate the copy, but it's no good as SSLContext +# objects can't be copied: https://bugs.python.org/issue33023. +# So... let's punt on that for now. Hopefully we'll be getting a new Python +# TLS API soon and can revisit this then. +async def open_ssl_over_tcp_stream( + host: str | bytes, + port: int, + *, + https_compatible: bool = False, + ssl_context: ssl.SSLContext | None = None, + happy_eyeballs_delay: float | None = DEFAULT_DELAY, +) -> trio.SSLStream[SocketStream]: + """Make a TLS-encrypted Connection to the given host and port over TCP. + + This is a convenience wrapper that calls :func:`open_tcp_stream` and + wraps the result in an :class:`~trio.SSLStream`. + + This function does not perform the TLS handshake; you can do it + manually by calling :meth:`~trio.SSLStream.do_handshake`, or else + it will be performed automatically the first time you send or receive + data. + + Args: + host (bytes or str): The host to connect to. We require the server + to have a TLS certificate valid for this hostname. + port (int): The port to connect to. + https_compatible (bool): Set this to True if you're connecting to a web + server. See :class:`~trio.SSLStream` for details. Default: + False. + ssl_context (:class:`~ssl.SSLContext` or None): The SSL context to + use. If None (the default), :func:`ssl.create_default_context` + will be called to create a context. + happy_eyeballs_delay (float): See :func:`open_tcp_stream`. + + Returns: + trio.SSLStream: the encrypted connection to the server. + + """ + tcp_stream = await trio.open_tcp_stream( + host, + port, + happy_eyeballs_delay=happy_eyeballs_delay, + ) + if ssl_context is None: + ssl_context = ssl.create_default_context() + + if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"): + ssl_context.options &= ~ssl.OP_IGNORE_UNEXPECTED_EOF + + return trio.SSLStream( + tcp_stream, + ssl_context, + server_hostname=host, + https_compatible=https_compatible, + ) + + +async def open_ssl_over_tcp_listeners( + port: int, + ssl_context: ssl.SSLContext, + *, + host: str | bytes | None = None, + https_compatible: bool = False, + backlog: int | None = None, +) -> list[trio.SSLListener[SocketStream]]: + """Start listening for SSL/TLS-encrypted TCP connections to the given port. + + Args: + port (int): The port to listen on. See :func:`open_tcp_listeners`. + ssl_context (~ssl.SSLContext): The SSL context to use for all incoming + connections. + host (str, bytes, or None): The address to bind to; use ``None`` to bind + to the wildcard address. See :func:`open_tcp_listeners`. + https_compatible (bool): See :class:`~trio.SSLStream` for details. + backlog (int or None): See :func:`open_tcp_listeners` for details. + + """ + tcp_listeners = await trio.open_tcp_listeners(port, host=host, backlog=backlog) + ssl_listeners = [ + trio.SSLListener(tcp_listener, ssl_context, https_compatible=https_compatible) + for tcp_listener in tcp_listeners + ] + return ssl_listeners + + +async def serve_ssl_over_tcp( + handler: Callable[[trio.SSLStream[SocketStream]], Awaitable[object]], + port: int, + ssl_context: ssl.SSLContext, + *, + host: str | bytes | None = None, + https_compatible: bool = False, + backlog: int | None = None, + handler_nursery: trio.Nursery | None = None, + task_status: trio.TaskStatus[ + list[trio.SSLListener[SocketStream]] + ] = trio.TASK_STATUS_IGNORED, +) -> NoReturn: + """Listen for incoming TCP connections, and for each one start a task + running ``handler(stream)``. + + This is a thin convenience wrapper around + :func:`open_ssl_over_tcp_listeners` and :func:`serve_listeners` – see them + for full details. + + .. warning:: + + If ``handler`` raises an exception, then this function doesn't do + anything special to catch it – so by default the exception will + propagate out and crash your server. If you don't want this, then catch + exceptions inside your ``handler``, or use a ``handler_nursery`` object + that responds to exceptions in some other way. + + When used with ``nursery.start`` you get back the newly opened listeners. + See the documentation for :func:`serve_tcp` for an example where this is + useful. + + Args: + handler: The handler to start for each incoming connection. Passed to + :func:`serve_listeners`. + + port (int): The port to listen on. Use 0 to let the kernel pick + an open port. Ultimately passed to :func:`open_tcp_listeners`. + + ssl_context (~ssl.SSLContext): The SSL context to use for all incoming + connections. Passed to :func:`open_ssl_over_tcp_listeners`. + + host (str, bytes, or None): The address to bind to; use ``None`` to bind + to the wildcard address. Ultimately passed to + :func:`open_tcp_listeners`. + + https_compatible (bool): Set this to True if you want to use + "HTTPS-style" TLS. See :class:`~trio.SSLStream` for details. + + backlog (int or None): See :class:`~trio.SSLStream` for details. + + handler_nursery: The nursery to start handlers in, or None to use an + internal nursery. Passed to :func:`serve_listeners`. + + task_status: This function can be used with ``nursery.start``. + + Returns: + This function only returns when cancelled. + + """ + listeners = await trio.open_ssl_over_tcp_listeners( + port, + ssl_context, + host=host, + https_compatible=https_compatible, + backlog=backlog, + ) + await trio.serve_listeners( + handler, + listeners, + handler_nursery=handler_nursery, + task_status=task_status, + ) diff --git a/contrib/python/trio/trio/_path.py b/contrib/python/trio/trio/_path.py new file mode 100644 index 000000000000..af6fbe00597f --- /dev/null +++ b/contrib/python/trio/trio/_path.py @@ -0,0 +1,280 @@ +from __future__ import annotations + +import os +import pathlib +import sys +from functools import partial, update_wrapper +from inspect import cleandoc +from typing import IO, TYPE_CHECKING, Any, BinaryIO, ClassVar, TypeVar, overload + +from trio._file_io import AsyncIOWrapper, wrap_file +from trio._util import final +from trio.to_thread import run_sync + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable, Iterable + from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper + + from _typeshed import ( + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + ) + from typing_extensions import Concatenate, Literal, ParamSpec, Self + + P = ParamSpec("P") + + PathT = TypeVar("PathT", bound="Path") + T = TypeVar("T") + + +def _wraps_async( # type: ignore[explicit-any] + wrapped: Callable[..., object], +) -> Callable[[Callable[P, T]], Callable[P, Awaitable[T]]]: + def decorator(fn: Callable[P, T]) -> Callable[P, Awaitable[T]]: + async def wrapper(*args: P.args, **kwargs: P.kwargs) -> T: + return await run_sync(partial(fn, *args, **kwargs)) + + update_wrapper(wrapper, wrapped) + if wrapped.__doc__: + module = wrapped.__module__ + # these are exported specially from CPython's intersphinx inventory + module = module.replace("pathlib._local", "pathlib") + module = module.replace("pathlib._abc", "pathlib") + + name = wrapped.__qualname__ + name = name.replace( + "PathBase", "Path" + ) # I'm not sure why this is necessary + + wrapper.__doc__ = ( + f"Like :meth:`~{module}.{name}`, but async.\n" + f"\n" + f"{cleandoc(wrapped.__doc__)}\n" + ) + return wrapper + + return decorator + + +def _wrap_method( + fn: Callable[Concatenate[pathlib.Path, P], T], +) -> Callable[Concatenate[Path, P], Awaitable[T]]: + @_wraps_async(fn) + def wrapper(self: Path, /, *args: P.args, **kwargs: P.kwargs) -> T: + return fn(self._wrapped_cls(self), *args, **kwargs) + + return wrapper + + +def _wrap_method_path( + fn: Callable[Concatenate[pathlib.Path, P], pathlib.Path], +) -> Callable[Concatenate[PathT, P], Awaitable[PathT]]: + @_wraps_async(fn) + def wrapper(self: PathT, /, *args: P.args, **kwargs: P.kwargs) -> PathT: + return self.__class__(fn(self._wrapped_cls(self), *args, **kwargs)) + + return wrapper + + +def _wrap_method_path_iterable( + fn: Callable[Concatenate[pathlib.Path, P], Iterable[pathlib.Path]], +) -> Callable[Concatenate[PathT, P], Awaitable[Iterable[PathT]]]: + @_wraps_async(fn) + def wrapper(self: PathT, /, *args: P.args, **kwargs: P.kwargs) -> Iterable[PathT]: + return map(self.__class__, [*fn(self._wrapped_cls(self), *args, **kwargs)]) + + if wrapper.__doc__: + wrapper.__doc__ += ( + f"\n" + f"This is an async method that returns a synchronous iterator, so you\n" + f"use it like:\n" + f"\n" + f".. code:: python\n" + f"\n" + f" for subpath in await mypath.{fn.__name__}():\n" + f" ...\n" + f"\n" + f".. note::\n" + f"\n" + f" The iterator is loaded into memory immediately during the initial\n" + f" call (see `issue #501\n" + f" `__ for discussion).\n" + ) + return wrapper + + +class Path(pathlib.PurePath): + """An async :class:`pathlib.Path` that executes blocking methods in :meth:`trio.to_thread.run_sync`. + + Instantiating :class:`Path` returns a concrete platform-specific subclass, one of :class:`PosixPath` or + :class:`WindowsPath`. + """ + + __slots__ = () + + _wrapped_cls: ClassVar[type[pathlib.Path]] + + def __new__(cls, *args: str | os.PathLike[str]) -> Self: + if cls is Path: + cls = WindowsPath if os.name == "nt" else PosixPath # type: ignore[assignment] + return super().__new__(cls, *args) + + @classmethod + @_wraps_async(pathlib.Path.cwd) + def cwd(cls) -> Self: + return cls(pathlib.Path.cwd()) + + @classmethod + @_wraps_async(pathlib.Path.home) + def home(cls) -> Self: + return cls(pathlib.Path.home()) + + @overload + async def open( + self, + mode: OpenTextMode = "r", + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + ) -> AsyncIOWrapper[TextIOWrapper]: ... + + @overload + async def open( + self, + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + errors: None = None, + newline: None = None, + ) -> AsyncIOWrapper[FileIO]: ... + + @overload + async def open( + self, + mode: OpenBinaryModeUpdating, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + ) -> AsyncIOWrapper[BufferedRandom]: ... + + @overload + async def open( + self, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + ) -> AsyncIOWrapper[BufferedWriter]: ... + + @overload + async def open( + self, + mode: OpenBinaryModeReading, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + ) -> AsyncIOWrapper[BufferedReader]: ... + + @overload + async def open( + self, + mode: OpenBinaryMode, + buffering: int = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + ) -> AsyncIOWrapper[BinaryIO]: ... + + @overload + async def open( # type: ignore[explicit-any] # Any usage matches builtins.open(). + self, + mode: str, + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + ) -> AsyncIOWrapper[IO[Any]]: ... + + @_wraps_async(pathlib.Path.open) + def open(self, *args: Any, **kwargs: Any) -> AsyncIOWrapper[IO[Any]]: # type: ignore[misc, explicit-any] # Overload return mismatch. + return wrap_file(self._wrapped_cls(self).open(*args, **kwargs)) + + def __repr__(self) -> str: + return f"trio.Path({str(self)!r})" + + stat = _wrap_method(pathlib.Path.stat) + chmod = _wrap_method(pathlib.Path.chmod) + exists = _wrap_method(pathlib.Path.exists) + glob = _wrap_method_path_iterable(pathlib.Path.glob) + rglob = _wrap_method_path_iterable(pathlib.Path.rglob) + is_dir = _wrap_method(pathlib.Path.is_dir) + is_file = _wrap_method(pathlib.Path.is_file) + is_symlink = _wrap_method(pathlib.Path.is_symlink) + is_socket = _wrap_method(pathlib.Path.is_socket) + is_fifo = _wrap_method(pathlib.Path.is_fifo) + is_block_device = _wrap_method(pathlib.Path.is_block_device) + is_char_device = _wrap_method(pathlib.Path.is_char_device) + if sys.version_info >= (3, 12): + is_junction = _wrap_method(pathlib.Path.is_junction) + iterdir = _wrap_method_path_iterable(pathlib.Path.iterdir) + lchmod = _wrap_method(pathlib.Path.lchmod) + lstat = _wrap_method(pathlib.Path.lstat) + mkdir = _wrap_method(pathlib.Path.mkdir) + if sys.platform != "win32": + owner = _wrap_method(pathlib.Path.owner) + group = _wrap_method(pathlib.Path.group) + if sys.platform != "win32" or sys.version_info >= (3, 12): + is_mount = _wrap_method(pathlib.Path.is_mount) + readlink = _wrap_method_path(pathlib.Path.readlink) + rename = _wrap_method_path(pathlib.Path.rename) + replace = _wrap_method_path(pathlib.Path.replace) + resolve = _wrap_method_path(pathlib.Path.resolve) + rmdir = _wrap_method(pathlib.Path.rmdir) + symlink_to = _wrap_method(pathlib.Path.symlink_to) + if sys.version_info >= (3, 10): + hardlink_to = _wrap_method(pathlib.Path.hardlink_to) + touch = _wrap_method(pathlib.Path.touch) + unlink = _wrap_method(pathlib.Path.unlink) + absolute = _wrap_method_path(pathlib.Path.absolute) + expanduser = _wrap_method_path(pathlib.Path.expanduser) + read_bytes = _wrap_method(pathlib.Path.read_bytes) + read_text = _wrap_method(pathlib.Path.read_text) + samefile = _wrap_method(pathlib.Path.samefile) + write_bytes = _wrap_method(pathlib.Path.write_bytes) + write_text = _wrap_method(pathlib.Path.write_text) + if sys.version_info < (3, 12): + link_to = _wrap_method(pathlib.Path.link_to) + if sys.version_info >= (3, 13): + full_match = _wrap_method(pathlib.Path.full_match) + + def as_uri(self) -> str: + return pathlib.Path.as_uri(self) + + +if Path.relative_to.__doc__: # pragma: no branch + Path.relative_to.__doc__ = Path.relative_to.__doc__.replace(" `..` ", " ``..`` ") + + +@final +class PosixPath(Path, pathlib.PurePosixPath): + """An async :class:`pathlib.PosixPath` that executes blocking methods in :meth:`trio.to_thread.run_sync`.""" + + __slots__ = () + + _wrapped_cls: ClassVar[type[pathlib.Path]] = pathlib.PosixPath + + +@final +class WindowsPath(Path, pathlib.PureWindowsPath): + """An async :class:`pathlib.WindowsPath` that executes blocking methods in :meth:`trio.to_thread.run_sync`.""" + + __slots__ = () + + _wrapped_cls: ClassVar[type[pathlib.Path]] = pathlib.WindowsPath diff --git a/contrib/python/trio/trio/_repl.py b/contrib/python/trio/trio/_repl.py new file mode 100644 index 000000000000..5a96e6878989 --- /dev/null +++ b/contrib/python/trio/trio/_repl.py @@ -0,0 +1,156 @@ +from __future__ import annotations + +import ast +import contextlib +import inspect +import sys +import warnings +from code import InteractiveConsole +from types import CodeType, FrameType, FunctionType +from typing import Callable + +import outcome + +import trio +import trio.lowlevel +from trio._util import final + + +class SuppressDecorator(contextlib.ContextDecorator, contextlib.suppress): + pass + + +@SuppressDecorator(KeyboardInterrupt) +@trio.lowlevel.disable_ki_protection +def terminal_newline() -> None: # TODO: test this line + import fcntl + import termios + + # Fake up a newline char as if user had typed it at the terminal + try: + fcntl.ioctl(sys.stdin, termios.TIOCSTI, b"\n") # type: ignore[attr-defined, unused-ignore] + except OSError as e: + print(f"\nPress enter! Newline injection failed: {e}", end="", flush=True) + + +@final +class TrioInteractiveConsole(InteractiveConsole): + def __init__(self, repl_locals: dict[str, object] | None = None) -> None: + super().__init__(locals=repl_locals) + self.token: trio.lowlevel.TrioToken | None = None + self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT + self.interrupted = False + + def runcode(self, code: CodeType) -> None: + func = FunctionType(code, self.locals) + if inspect.iscoroutinefunction(func): + result = trio.from_thread.run(outcome.acapture, func) + else: + result = trio.from_thread.run_sync(outcome.capture, func) + if isinstance(result, outcome.Error): + # If it is SystemExit, quit the repl. Otherwise, print the traceback. + # If there is a SystemExit inside a BaseExceptionGroup, it probably isn't + # the user trying to quit the repl, but rather an error in the code. So, we + # don't try to inspect groups for SystemExit. Instead, we just print and + # return to the REPL. + if isinstance(result.error, SystemExit): + raise result.error + else: + # Inline our own version of self.showtraceback that can use + # outcome.Error.error directly to print clean tracebacks. + # This also means overriding self.showtraceback does nothing. + sys.last_type, sys.last_value = type(result.error), result.error + sys.last_traceback = result.error.__traceback__ + # see https://docs.python.org/3/library/sys.html#sys.last_exc + if sys.version_info >= (3, 12): + sys.last_exc = result.error + + # We always use sys.excepthook, unlike other implementations. + # This means that overriding self.write also does nothing to tbs. + sys.excepthook(sys.last_type, sys.last_value, sys.last_traceback) + # clear any residual KI + trio.from_thread.run(trio.lowlevel.checkpoint_if_cancelled) + # trio.from_thread.check_cancelled() has too long of a memory + + if sys.platform == "win32": # TODO: test this line + + def raw_input(self, prompt: str = "") -> str: + try: + return input(prompt) + except EOFError: + # check if trio has a pending KI + trio.from_thread.run(trio.lowlevel.checkpoint_if_cancelled) + raise + + else: + + def raw_input(self, prompt: str = "") -> str: + from signal import SIGINT, signal + + assert not self.interrupted + + def install_handler() -> ( + Callable[[int, FrameType | None], None] | int | None + ): + def handler( + sig: int, frame: FrameType | None + ) -> None: # TODO: test this line + self.interrupted = True + token.run_sync_soon(terminal_newline, idempotent=True) + + token = trio.lowlevel.current_trio_token() + + return signal(SIGINT, handler) + + prev_handler = trio.from_thread.run_sync(install_handler) + try: + return input(prompt) + finally: + trio.from_thread.run_sync(signal, SIGINT, prev_handler) + if self.interrupted: # TODO: test this line + raise KeyboardInterrupt + + def write(self, output: str) -> None: + if self.interrupted: # TODO: test this line + assert output == "\nKeyboardInterrupt\n" + sys.stderr.write(output[1:]) + self.interrupted = False + else: + sys.stderr.write(output) + + +async def run_repl(console: TrioInteractiveConsole) -> None: + banner = ( + f"trio REPL {sys.version} on {sys.platform}\n" + f'Use "await" directly instead of "trio.run()".\n' + f'Type "help", "copyright", "credits" or "license" ' + f"for more information.\n" + f'{getattr(sys, "ps1", ">>> ")}import trio' + ) + try: + await trio.to_thread.run_sync(console.interact, banner) + finally: + warnings.filterwarnings( + "ignore", + message=r"^coroutine .* was never awaited$", + category=RuntimeWarning, + ) + + +def main(original_locals: dict[str, object]) -> None: + with contextlib.suppress(ImportError): + import readline # noqa: F401 + + repl_locals: dict[str, object] = {"trio": trio} + for key in { + "__name__", + "__package__", + "__loader__", + "__spec__", + "__builtins__", + "__file__", + }: + repl_locals[key] = original_locals[key] + + console = TrioInteractiveConsole(repl_locals) + trio.run(run_repl, console) diff --git a/contrib/python/trio/trio/_signals.py b/contrib/python/trio/trio/_signals.py new file mode 100644 index 000000000000..729c48ad4e11 --- /dev/null +++ b/contrib/python/trio/trio/_signals.py @@ -0,0 +1,185 @@ +from __future__ import annotations + +import signal +from collections import OrderedDict +from contextlib import contextmanager +from typing import TYPE_CHECKING + +import trio + +from ._util import ConflictDetector, is_main_thread + +if TYPE_CHECKING: + from collections.abc import AsyncIterator, Callable, Generator, Iterable + from types import FrameType + + from typing_extensions import Self + +# Discussion of signal handling strategies: +# +# - On Windows signals barely exist. There are no options; signal handlers are +# the only available API. +# +# - On Linux signalfd is arguably the natural way. Semantics: signalfd acts as +# an *alternative* signal delivery mechanism. The way you use it is to mask +# out the relevant signals process-wide (so that they don't get delivered +# the normal way), and then when you read from signalfd that actually counts +# as delivering it (despite the mask). The problem with this is that we +# don't have any reliable way to mask out signals process-wide -- the only +# way to do that in Python is to call pthread_sigmask from the main thread +# *before starting any other threads*, and as a library we can't really +# impose that, and the failure mode is annoying (signals get delivered via +# signal handlers whether we want them to or not). +# +# - on macOS/*BSD, kqueue is the natural way. Semantics: kqueue acts as an +# *extra* signal delivery mechanism. Signals are delivered the normal +# way, *and* are delivered to kqueue. So you want to set them to SIG_IGN so +# that they don't end up pending forever (I guess?). I can't find any actual +# docs on how masking and EVFILT_SIGNAL interact. I did see someone note +# that if a signal is pending when the kqueue filter is added then you +# *don't* get notified of that, which makes sense. But still, we have to +# manipulate signal state (e.g. setting SIG_IGN) which as far as Python is +# concerned means we have to do this from the main thread. +# +# So in summary, there don't seem to be any compelling advantages to using the +# platform-native signal notification systems; they're kinda nice, but it's +# simpler to implement the naive signal-handler-based system once and be +# done. (The big advantage would be if there were a reliable way to monitor +# for SIGCHLD from outside the main thread and without interfering with other +# libraries that also want to monitor for SIGCHLD. But there isn't. I guess +# kqueue might give us that, but in kqueue we don't need it, because kqueue +# can directly monitor for child process state changes.) + + +@contextmanager +def _signal_handler( + signals: Iterable[int], + handler: Callable[[int, FrameType | None], object] | int | signal.Handlers | None, +) -> Generator[None, None, None]: + original_handlers = {} + try: + for signum in set(signals): + original_handlers[signum] = signal.signal(signum, handler) + yield + finally: + for signum, original_handler in original_handlers.items(): + signal.signal(signum, original_handler) + + +class SignalReceiver: + def __init__(self) -> None: + # {signal num: None} + self._pending: OrderedDict[int, None] = OrderedDict() + self._lot = trio.lowlevel.ParkingLot() + self._conflict_detector = ConflictDetector( + "only one task can iterate on a signal receiver at a time", + ) + self._closed = False + + def _add(self, signum: int) -> None: + if self._closed: + signal.raise_signal(signum) + else: + self._pending[signum] = None + self._lot.unpark() + + def _redeliver_remaining(self) -> None: + # First make sure that any signals still in the delivery pipeline will + # get redelivered + self._closed = True + + # And then redeliver any that are sitting in pending. This is done + # using a weird recursive construct to make sure we process everything + # even if some of the handlers raise exceptions. + def deliver_next() -> None: + if self._pending: + signum, _ = self._pending.popitem(last=False) + try: + signal.raise_signal(signum) + finally: + deliver_next() + + deliver_next() + + def __aiter__(self) -> Self: + return self + + async def __anext__(self) -> int: + if self._closed: + raise RuntimeError("open_signal_receiver block already exited") + # In principle it would be possible to support multiple concurrent + # calls to __anext__, but doing it without race conditions is quite + # tricky, and there doesn't seem to be any point in trying. + with self._conflict_detector: + if not self._pending: + await self._lot.park() + else: + await trio.lowlevel.checkpoint() + signum, _ = self._pending.popitem(last=False) + return signum + + +def get_pending_signal_count(rec: AsyncIterator[int]) -> int: + """Helper for tests, not public or otherwise used.""" + # open_signal_receiver() always produces SignalReceiver, this should not fail. + assert isinstance(rec, SignalReceiver) + return len(rec._pending) + + +@contextmanager +def open_signal_receiver( + *signals: signal.Signals | int, +) -> Generator[AsyncIterator[int], None, None]: + """A context manager for catching signals. + + Entering this context manager starts listening for the given signals and + returns an async iterator; exiting the context manager stops listening. + + The async iterator blocks until a signal arrives, and then yields it. + + Note that if you leave the ``with`` block while the iterator has + unextracted signals still pending inside it, then they will be + re-delivered using Python's regular signal handling logic. This avoids a + race condition when signals arrives just before we exit the ``with`` + block. + + Args: + signals: the signals to listen for. + + Raises: + TypeError: if no signals were provided. + + RuntimeError: if you try to use this anywhere except Python's main + thread. (This is a Python limitation.) + + Example: + + A common convention for Unix daemons is that they should reload their + configuration when they receive a ``SIGHUP``. Here's a sketch of what + that might look like using :func:`open_signal_receiver`:: + + with trio.open_signal_receiver(signal.SIGHUP) as signal_aiter: + async for signum in signal_aiter: + assert signum == signal.SIGHUP + reload_configuration() + + """ + if not signals: + raise TypeError("No signals were provided") + + if not is_main_thread(): + raise RuntimeError( + "Sorry, open_signal_receiver is only possible when running in " + "Python interpreter's main thread", + ) + token = trio.lowlevel.current_trio_token() + queue = SignalReceiver() + + def handler(signum: int, frame: FrameType | None) -> None: + token.run_sync_soon(queue._add, signum, idempotent=True) + + try: + with _signal_handler(signals, handler): + yield queue + finally: + queue._redeliver_remaining() diff --git a/contrib/python/trio/trio/_socket.py b/contrib/python/trio/trio/_socket.py new file mode 100644 index 000000000000..8454970693de --- /dev/null +++ b/contrib/python/trio/trio/_socket.py @@ -0,0 +1,1325 @@ +from __future__ import annotations + +import os +import select +import socket as _stdlib_socket +import sys +from operator import index +from socket import AddressFamily, SocketKind +from typing import ( + TYPE_CHECKING, + Any, + SupportsIndex, + TypeVar, + Union, + overload, +) + +import idna as _idna + +import trio +from trio._util import wraps as _wraps + +from . import _core + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable, Iterable + from types import TracebackType + + from typing_extensions import Buffer, Concatenate, ParamSpec, Self, TypeAlias + + from ._abc import HostnameResolver, SocketFactory + + P = ParamSpec("P") + + +T = TypeVar("T") + +# _stdlib_socket.socket supports 13 different socket families, see +# https://docs.python.org/3/library/socket.html#socket-families +# and the return type of several methods in SocketType will depend on those. Typeshed +# has ended up typing those return types as `Any` in most cases, but for users that +# know which family/families they're working in we could make SocketType a generic type, +# where you specify the return values you expect from those methods depending on the +# protocol the socket will be handling. +# But without the ability to default the value to `Any` it will be overly cumbersome for +# most users, so currently we just specify it as `Any`. Otherwise we would write: +# `AddressFormat = TypeVar("AddressFormat")` +# but instead we simply do: +AddressFormat: TypeAlias = Any # type: ignore[explicit-any] + + +# Usage: +# +# async with _try_sync(): +# return sync_call_that_might_fail_with_exception() +# # we only get here if the sync call in fact did fail with a +# # BlockingIOError +# return await do_it_properly_with_a_check_point() +# +class _try_sync: + def __init__( + self, + blocking_exc_override: Callable[[BaseException], bool] | None = None, + ) -> None: + self._blocking_exc_override = blocking_exc_override + + def _is_blocking_io_error(self, exc: BaseException) -> bool: + if self._blocking_exc_override is None: + return isinstance(exc, BlockingIOError) + else: + return self._blocking_exc_override(exc) + + async def __aenter__(self) -> None: + await trio.lowlevel.checkpoint_if_cancelled() + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> bool: + if exc_value is not None and self._is_blocking_io_error(exc_value): + # Discard the exception and fall through to the code below the + # block + return True + else: + await trio.lowlevel.cancel_shielded_checkpoint() + # Let the return or exception propagate + return False + + +################################################################ +# Overrides +################################################################ + +_resolver: _core.RunVar[HostnameResolver | None] = _core.RunVar("hostname_resolver") +_socket_factory: _core.RunVar[SocketFactory | None] = _core.RunVar("socket_factory") + + +def set_custom_hostname_resolver( + hostname_resolver: HostnameResolver | None, +) -> HostnameResolver | None: + """Set a custom hostname resolver. + + By default, Trio's :func:`getaddrinfo` and :func:`getnameinfo` functions + use the standard system resolver functions. This function allows you to + customize that behavior. The main intended use case is for testing, but it + might also be useful for using third-party resolvers like `c-ares + `__ (though be warned that these rarely make + perfect drop-in replacements for the system resolver). See + :class:`trio.abc.HostnameResolver` for more details. + + Setting a custom hostname resolver affects all future calls to + :func:`getaddrinfo` and :func:`getnameinfo` within the enclosing call to + :func:`trio.run`. All other hostname resolution in Trio is implemented in + terms of these functions. + + Generally you should call this function just once, right at the beginning + of your program. + + Args: + hostname_resolver (trio.abc.HostnameResolver or None): The new custom + hostname resolver, or None to restore the default behavior. + + Returns: + The previous hostname resolver (which may be None). + + """ + old = _resolver.get(None) + _resolver.set(hostname_resolver) + return old + + +def set_custom_socket_factory( + socket_factory: SocketFactory | None, +) -> SocketFactory | None: + """Set a custom socket object factory. + + This function allows you to replace Trio's normal socket class with a + custom class. This is very useful for testing, and probably a bad idea in + any other circumstance. See :class:`trio.abc.HostnameResolver` for more + details. + + Setting a custom socket factory affects all future calls to :func:`socket` + within the enclosing call to :func:`trio.run`. + + Generally you should call this function just once, right at the beginning + of your program. + + Args: + socket_factory (trio.abc.SocketFactory or None): The new custom + socket factory, or None to restore the default behavior. + + Returns: + The previous socket factory (which may be None). + + """ + old = _socket_factory.get(None) + _socket_factory.set(socket_factory) + return old + + +################################################################ +# getaddrinfo and friends +################################################################ + +# AI_NUMERICSERV may be missing on some older platforms, so use it when available. +# See: https://github.com/python-trio/trio/issues/3133 +_NUMERIC_ONLY = _stdlib_socket.AI_NUMERICHOST +_NUMERIC_ONLY |= getattr(_stdlib_socket, "AI_NUMERICSERV", 0) + + +# It would be possible to @overload the return value depending on Literal[AddressFamily.INET/6], but should probably be added in typeshed first +async def getaddrinfo( + host: bytes | str | None, + port: bytes | str | int | None, + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, +) -> list[ + tuple[ + AddressFamily, + SocketKind, + int, + str, + tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], + ] +]: + """Look up a numeric address given a name. + + Arguments and return values are identical to :func:`socket.getaddrinfo`, + except that this version is async. + + Also, :func:`trio.socket.getaddrinfo` correctly uses IDNA 2008 to process + non-ASCII domain names. (:func:`socket.getaddrinfo` uses IDNA 2003, which + can give the wrong result in some cases and cause you to connect to a + different host than the one you intended; see `bpo-17305 + `__.) + + This function's behavior can be customized using + :func:`set_custom_hostname_resolver`. + + """ + + # If host and port are numeric, then getaddrinfo doesn't block and we can + # skip the whole thread thing, which seems worthwhile. So we try first + # with the _NUMERIC_ONLY flags set, and then only spawn a thread if that + # fails with EAI_NONAME: + def numeric_only_failure(exc: BaseException) -> bool: + return ( + isinstance(exc, _stdlib_socket.gaierror) + and exc.errno == _stdlib_socket.EAI_NONAME + ) + + async with _try_sync(numeric_only_failure): + return _stdlib_socket.getaddrinfo( + host, + port, + family, + type, + proto, + flags | _NUMERIC_ONLY, + ) + # That failed; it's a real hostname. We better use a thread. + # + # Also, it might be a unicode hostname, in which case we want to do our + # own encoding using the idna module, rather than letting Python do + # it. (Python will use the old IDNA 2003 standard, and possibly get the + # wrong answer - see bpo-17305). However, the idna module is picky, and + # will refuse to process some valid hostname strings, like "::1". So if + # it's already ascii, we pass it through; otherwise, we encode it to. + if isinstance(host, str): + try: + host = host.encode("ascii") + except UnicodeEncodeError: + # UTS-46 defines various normalizations; in particular, by default + # idna.encode will error out if the hostname has Capital Letters + # in it; with uts46=True it will lowercase them instead. + host = _idna.encode(host, uts46=True) + hr = _resolver.get(None) + if hr is not None: + return await hr.getaddrinfo(host, port, family, type, proto, flags) + else: + return await trio.to_thread.run_sync( + _stdlib_socket.getaddrinfo, + host, + port, + family, + type, + proto, + flags, + abandon_on_cancel=True, + ) + + +async def getnameinfo( + sockaddr: tuple[str, int] | tuple[str, int, int, int], + flags: int, +) -> tuple[str, str]: + """Look up a name given a numeric address. + + Arguments and return values are identical to :func:`socket.getnameinfo`, + except that this version is async. + + This function's behavior can be customized using + :func:`set_custom_hostname_resolver`. + + """ + hr = _resolver.get(None) + if hr is not None: + return await hr.getnameinfo(sockaddr, flags) + else: + return await trio.to_thread.run_sync( + _stdlib_socket.getnameinfo, + sockaddr, + flags, + abandon_on_cancel=True, + ) + + +async def getprotobyname(name: str) -> int: + """Look up a protocol number by name. (Rarely used.) + + Like :func:`socket.getprotobyname`, but async. + + """ + return await trio.to_thread.run_sync( + _stdlib_socket.getprotobyname, + name, + abandon_on_cancel=True, + ) + + +# obsolete gethostbyname etc. intentionally omitted +# likewise for create_connection (use open_tcp_stream instead) + +################################################################ +# Socket "constructors" +################################################################ + + +def from_stdlib_socket(sock: _stdlib_socket.socket) -> SocketType: + """Convert a standard library :class:`socket.socket` object into a Trio + socket object. + + """ + return _SocketType(sock) + + +@_wraps(_stdlib_socket.fromfd, assigned=(), updated=()) +def fromfd( + fd: SupportsIndex, + family: AddressFamily | int = _stdlib_socket.AF_INET, + type: SocketKind | int = _stdlib_socket.SOCK_STREAM, + proto: int = 0, +) -> SocketType: + """Like :func:`socket.fromfd`, but returns a Trio socket object.""" + family, type_, proto = _sniff_sockopts_for_fileno(family, type, proto, index(fd)) + return from_stdlib_socket(_stdlib_socket.fromfd(fd, family, type_, proto)) + + +if sys.platform == "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket, "fromshare") +): + + @_wraps(_stdlib_socket.fromshare, assigned=(), updated=()) + def fromshare(info: bytes) -> SocketType: + """Like :func:`socket.fromshare`, but returns a Trio socket object.""" + return from_stdlib_socket(_stdlib_socket.fromshare(info)) + + +if sys.platform == "win32": + FamilyT: TypeAlias = int + TypeT: TypeAlias = int + FamilyDefault = _stdlib_socket.AF_INET +else: + FamilyDefault: None = None + FamilyT: TypeAlias = Union[int, AddressFamily, None] + TypeT: TypeAlias = Union[_stdlib_socket.socket, int] + + +@_wraps(_stdlib_socket.socketpair, assigned=(), updated=()) +def socketpair( + family: FamilyT = FamilyDefault, + type: TypeT = SocketKind.SOCK_STREAM, + proto: int = 0, +) -> tuple[SocketType, SocketType]: + """Like :func:`socket.socketpair`, but returns a pair of Trio socket + objects. + + """ + left, right = _stdlib_socket.socketpair(family, type, proto) + return (from_stdlib_socket(left), from_stdlib_socket(right)) + + +@_wraps(_stdlib_socket.socket, assigned=(), updated=()) +def socket( + family: AddressFamily | int = _stdlib_socket.AF_INET, + type: SocketKind | int = _stdlib_socket.SOCK_STREAM, + proto: int = 0, + fileno: int | None = None, +) -> SocketType: + """Create a new Trio socket, like :class:`socket.socket`. + + This function's behavior can be customized using + :func:`set_custom_socket_factory`. + + """ + if fileno is None: + sf = _socket_factory.get(None) + if sf is not None: + return sf.socket(family, type, proto) + else: + family, type, proto = _sniff_sockopts_for_fileno( # noqa: A001 + family, + type, + proto, + fileno, + ) + stdlib_socket = _stdlib_socket.socket(family, type, proto, fileno) + return from_stdlib_socket(stdlib_socket) + + +def _sniff_sockopts_for_fileno( + family: AddressFamily | int, + type_: SocketKind | int, + proto: int, + fileno: int | None, +) -> tuple[AddressFamily | int, SocketKind | int, int]: + """Correct SOCKOPTS for given fileno, falling back to provided values.""" + # Wrap the raw fileno into a Python socket object + # This object might have the wrong metadata, but it lets us easily call getsockopt + # and then we'll throw it away and construct a new one with the correct metadata. + if sys.platform != "linux": + return family, type_, proto + from socket import ( # type: ignore[attr-defined,unused-ignore] + SO_DOMAIN, + SO_PROTOCOL, + SO_TYPE, + SOL_SOCKET, + ) + + sockobj = _stdlib_socket.socket(family, type_, proto, fileno=fileno) + try: + family = sockobj.getsockopt(SOL_SOCKET, SO_DOMAIN) + proto = sockobj.getsockopt(SOL_SOCKET, SO_PROTOCOL) + type_ = sockobj.getsockopt(SOL_SOCKET, SO_TYPE) + finally: + # Unwrap it again, so that sockobj.__del__ doesn't try to close our socket + sockobj.detach() + return family, type_, proto + + +################################################################ +# SocketType +################################################################ + +# sock.type gets weird stuff set in it, in particular on Linux: +# +# https://bugs.python.org/issue21327 +# +# But on other platforms (e.g. Windows) SOCK_NONBLOCK and SOCK_CLOEXEC aren't +# even defined. To recover the actual socket type (e.g. SOCK_STREAM) from a +# socket.type attribute, mask with this: +_SOCK_TYPE_MASK = ~( + getattr(_stdlib_socket, "SOCK_NONBLOCK", 0) + | getattr(_stdlib_socket, "SOCK_CLOEXEC", 0) +) + + +def _make_simple_sock_method_wrapper( + fn: Callable[Concatenate[_stdlib_socket.socket, P], T], + wait_fn: Callable[[_stdlib_socket.socket], Awaitable[None]], + maybe_avail: bool = False, +) -> Callable[Concatenate[_SocketType, P], Awaitable[T]]: + @_wraps(fn, assigned=("__name__",), updated=()) + async def wrapper(self: _SocketType, *args: P.args, **kwargs: P.kwargs) -> T: + return await self._nonblocking_helper(wait_fn, fn, *args, **kwargs) + + wrapper.__doc__ = f"""Like :meth:`socket.socket.{fn.__name__}`, but async. + + """ + if maybe_avail: + wrapper.__doc__ += ( + f"Only available on platforms where :meth:`socket.socket.{fn.__name__}` is " + "available." + ) + return wrapper + + +# Helpers to work with the (hostname, port) language that Python uses for socket +# addresses everywhere. Split out into a standalone function so it can be reused by +# FakeNet. + + +# Take an address in Python's representation, and returns a new address in +# the same representation, but with names resolved to numbers, +# etc. +# +# local=True means that the address is being used with bind() or similar +# local=False means that the address is being used with connect() or sendto() or +# similar. +# + + +# Using a TypeVar to indicate we return the same type of address appears to give errors +# when passed a union of address types. +# @overload likely works, but is extremely verbose. +# NOTE: this function does not always checkpoint +async def _resolve_address_nocp( + type_: int, + family: AddressFamily, + proto: int, + *, + ipv6_v6only: bool | int, + address: AddressFormat, + local: bool, +) -> AddressFormat: + # Do some pre-checking (or exit early for non-IP sockets) + if family == _stdlib_socket.AF_INET: + if not isinstance(address, tuple) or not len(address) == 2: + raise ValueError("address should be a (host, port) tuple") + elif family == _stdlib_socket.AF_INET6: + if not isinstance(address, tuple) or not 2 <= len(address) <= 4: + raise ValueError( + "address should be a (host, port, [flowinfo, [scopeid]]) tuple", + ) + elif hasattr(_stdlib_socket, "AF_UNIX") and family == _stdlib_socket.AF_UNIX: + # unwrap path-likes + assert isinstance(address, (str, bytes, os.PathLike)) + return os.fspath(address) + else: + return address + + # -- From here on we know we have IPv4 or IPV6 -- + host: str | None + host, port, *_ = address + # Fast path for the simple case: already-resolved IP address, + # already-resolved port. This is particularly important for UDP, since + # every sendto call goes through here. + if isinstance(port, int) and host is not None: + try: + _stdlib_socket.inet_pton(family, host) + except (OSError, TypeError): + pass + else: + return address + # Special cases to match the stdlib, see gh-277 + if host == "": + host = None + if host == "": + host = "255.255.255.255" + flags = 0 + if local: + flags |= _stdlib_socket.AI_PASSIVE + # Since we always pass in an explicit family here, AI_ADDRCONFIG + # doesn't add any value -- if we have no ipv6 connectivity and are + # working with an ipv6 socket, then things will break soon enough! And + # if we do enable it, then it makes it impossible to even run tests + # for ipv6 address resolution on travis-ci, which as of 2017-03-07 has + # no ipv6. + # flags |= AI_ADDRCONFIG + if family == _stdlib_socket.AF_INET6 and not ipv6_v6only: + flags |= _stdlib_socket.AI_V4MAPPED + gai_res = await getaddrinfo(host, port, family, type_, proto, flags) + # AFAICT from the spec it's not possible for getaddrinfo to return an + # empty list. + assert len(gai_res) >= 1 + # Address is the last item in the first entry + (*_, normed), *_ = gai_res + # The above ignored any flowid and scopeid in the passed-in address, + # so restore them if present: + if family == _stdlib_socket.AF_INET6: + list_normed = list(normed) + assert len(normed) == 4 + if len(address) >= 3: + list_normed[2] = address[2] + if len(address) >= 4: + list_normed[3] = address[3] + return tuple(list_normed) + return normed + + +class SocketType: + def __init__(self) -> None: + # make sure this __init__ works with multiple inheritance + super().__init__() + # and only raises error if it's directly constructed + if type(self) is SocketType: + raise TypeError( + "SocketType is an abstract class; use trio.socket.socket if you " + "want to construct a socket object", + ) + + def detach(self) -> int: + raise NotImplementedError + + def fileno(self) -> int: + raise NotImplementedError + + def getpeername(self) -> AddressFormat: + raise NotImplementedError + + def getsockname(self) -> AddressFormat: + raise NotImplementedError + + @overload + def getsockopt(self, level: int, optname: int) -> int: ... + + @overload + def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... + + def getsockopt( + self, + level: int, + optname: int, + buflen: int | None = None, + ) -> int | bytes: + raise NotImplementedError + + @overload + def setsockopt(self, level: int, optname: int, value: int | Buffer) -> None: ... + + @overload + def setsockopt( + self, + level: int, + optname: int, + value: None, + optlen: int, + ) -> None: ... + + def setsockopt( + self, + level: int, + optname: int, + value: int | Buffer | None, + optlen: int | None = None, + ) -> None: + raise NotImplementedError + + def listen(self, backlog: int = min(_stdlib_socket.SOMAXCONN, 128)) -> None: + raise NotImplementedError + + def get_inheritable(self) -> bool: + raise NotImplementedError + + def set_inheritable(self, inheritable: bool) -> None: + raise NotImplementedError + + if sys.platform == "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "share") + ): + + def share(self, process_id: int) -> bytes: + raise NotImplementedError + + def __enter__(self) -> Self: + raise NotImplementedError + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + raise NotImplementedError + + @property + def family(self) -> AddressFamily: + raise NotImplementedError + + @property + def type(self) -> SocketKind: + raise NotImplementedError + + @property + def proto(self) -> int: + raise NotImplementedError + + @property + def did_shutdown_SHUT_WR(self) -> bool: + """Return True if the socket has been shut down with the SHUT_WR flag""" + raise NotImplementedError + + def __repr__(self) -> str: + raise NotImplementedError + + def dup(self) -> SocketType: + raise NotImplementedError + + def close(self) -> None: + raise NotImplementedError + + async def bind(self, address: AddressFormat) -> None: + raise NotImplementedError + + def shutdown(self, flag: int) -> None: + raise NotImplementedError + + def is_readable(self) -> bool: + """Return True if the socket is readable. This is checked with `select.select` on Windows, otherwise `select.poll`.""" + raise NotImplementedError + + async def wait_writable(self) -> None: + """Convenience method that calls trio.lowlevel.wait_writable for the object.""" + raise NotImplementedError + + async def accept(self) -> tuple[SocketType, AddressFormat]: + raise NotImplementedError + + async def connect(self, address: AddressFormat) -> None: + raise NotImplementedError + + def recv(self, buflen: int, flags: int = 0, /) -> Awaitable[bytes]: + raise NotImplementedError + + def recv_into( + self, + buffer: Buffer, + nbytes: int = 0, + flags: int = 0, + ) -> Awaitable[int]: + raise NotImplementedError + + # return type of socket.socket.recvfrom in typeshed is tuple[bytes, Any] + def recvfrom( + self, + bufsize: int, + flags: int = 0, + /, + ) -> Awaitable[tuple[bytes, AddressFormat]]: + raise NotImplementedError + + # return type of socket.socket.recvfrom_into in typeshed is tuple[bytes, Any] + def recvfrom_into( + self, + buffer: Buffer, + nbytes: int = 0, + flags: int = 0, + ) -> Awaitable[tuple[int, AddressFormat]]: + raise NotImplementedError + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg") + ): + + def recvmsg( + self, + bufsize: int, + ancbufsize: int = 0, + flags: int = 0, + /, + ) -> Awaitable[tuple[bytes, list[tuple[int, int, bytes]], int, object]]: + raise NotImplementedError + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg_into") + ): + + def recvmsg_into( + self, + buffers: Iterable[Buffer], + ancbufsize: int = 0, + flags: int = 0, + /, + ) -> Awaitable[tuple[int, list[tuple[int, int, bytes]], int, object]]: + raise NotImplementedError + + def send(self, bytes: Buffer, flags: int = 0, /) -> Awaitable[int]: + raise NotImplementedError + + @overload + async def sendto( + self, + data: Buffer, + address: tuple[object, ...] | str | Buffer, + /, + ) -> int: ... + + @overload + async def sendto( + self, + data: Buffer, + flags: int, + address: tuple[object, ...] | str | Buffer, + /, + ) -> int: ... + + async def sendto(self, *args: object) -> int: + raise NotImplementedError + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "sendmsg") + ): + + @_wraps(_stdlib_socket.socket.sendmsg, assigned=(), updated=()) + async def sendmsg( + self, + buffers: Iterable[Buffer], + ancdata: Iterable[tuple[int, int, Buffer]] = (), + flags: int = 0, + address: AddressFormat | None = None, + /, + ) -> int: + raise NotImplementedError + + +# copy docstrings from socket.SocketType / socket.socket +for name, obj in SocketType.__dict__.items(): + # skip dunders and already defined docstrings + if name.startswith("__") or obj.__doc__: + continue + # try both socket.socket and socket.SocketType + for stdlib_type in _stdlib_socket.socket, _stdlib_socket.SocketType: + stdlib_obj = getattr(stdlib_type, name, None) + if stdlib_obj and stdlib_obj.__doc__: + break + else: + continue + obj.__doc__ = stdlib_obj.__doc__ + + +class _SocketType(SocketType): + def __init__(self, sock: _stdlib_socket.socket) -> None: + if type(sock) is not _stdlib_socket.socket: + # For example, ssl.SSLSocket subclasses socket.socket, but we + # certainly don't want to blindly wrap one of those. + raise TypeError( + f"expected object of type 'socket.socket', not '{type(sock).__name__}'", + ) + self._sock = sock + self._sock.setblocking(False) + self._did_shutdown_SHUT_WR = False + + ################################################################ + # Simple + portable methods and attributes + ################################################################ + + # forwarded methods + def detach(self) -> int: + return self._sock.detach() + + def fileno(self) -> int: + return self._sock.fileno() + + def getpeername(self) -> AddressFormat: + return self._sock.getpeername() + + def getsockname(self) -> AddressFormat: + return self._sock.getsockname() + + @overload + def getsockopt(self, level: int, optname: int) -> int: ... + + @overload + def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... + + def getsockopt( + self, + level: int, + optname: int, + buflen: int | None = None, + ) -> int | bytes: + if buflen is None: + return self._sock.getsockopt(level, optname) + return self._sock.getsockopt(level, optname, buflen) + + @overload + def setsockopt(self, level: int, optname: int, value: int | Buffer) -> None: ... + + @overload + def setsockopt( + self, + level: int, + optname: int, + value: None, + optlen: int, + ) -> None: ... + + def setsockopt( + self, + level: int, + optname: int, + value: int | Buffer | None, + optlen: int | None = None, + ) -> None: + if optlen is None: + if value is None: + raise TypeError( + "invalid value for argument 'value', must not be None when specifying optlen", + ) + return self._sock.setsockopt(level, optname, value) + if value is not None: + raise TypeError( + f"invalid value for argument 'value': {value!r}, must be None when specifying optlen", + ) + + # Note: PyPy may crash here due to setsockopt only supporting + # four parameters. + return self._sock.setsockopt(level, optname, value, optlen) + + def listen(self, backlog: int = min(_stdlib_socket.SOMAXCONN, 128)) -> None: + return self._sock.listen(backlog) + + def get_inheritable(self) -> bool: + return self._sock.get_inheritable() + + def set_inheritable(self, inheritable: bool) -> None: + return self._sock.set_inheritable(inheritable) + + if sys.platform == "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "share") + ): + + def share(self, process_id: int) -> bytes: + return self._sock.share(process_id) + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + return self._sock.__exit__(exc_type, exc_value, traceback) + + @property + def family(self) -> AddressFamily: + return self._sock.family + + @property + def type(self) -> SocketKind: + return self._sock.type + + @property + def proto(self) -> int: + return self._sock.proto + + @property + def did_shutdown_SHUT_WR(self) -> bool: + return self._did_shutdown_SHUT_WR + + def __repr__(self) -> str: + return repr(self._sock).replace("socket.socket", "trio.socket.socket") + + def dup(self) -> SocketType: + """Same as :meth:`socket.socket.dup`.""" + return _SocketType(self._sock.dup()) + + def close(self) -> None: + if self._sock.fileno() != -1: + trio.lowlevel.notify_closing(self._sock) + self._sock.close() + + async def bind(self, address: AddressFormat) -> None: + address = await self._resolve_address_nocp(address, local=True) + if ( + hasattr(_stdlib_socket, "AF_UNIX") + and self.family == _stdlib_socket.AF_UNIX + and address[0] + ): + # Use a thread for the filesystem traversal (unless it's an + # abstract domain socket) + return await trio.to_thread.run_sync(self._sock.bind, address) + else: + # POSIX actually says that bind can return EWOULDBLOCK and + # complete asynchronously, like connect. But in practice AFAICT + # there aren't yet any real systems that do this, so we'll worry + # about it when it happens. + await trio.lowlevel.checkpoint() + return self._sock.bind(address) + + def shutdown(self, flag: int) -> None: + # no need to worry about return value b/c always returns None: + self._sock.shutdown(flag) + # only do this if the call succeeded: + if flag in [_stdlib_socket.SHUT_WR, _stdlib_socket.SHUT_RDWR]: + self._did_shutdown_SHUT_WR = True + + def is_readable(self) -> bool: + # use select.select on Windows, and select.poll everywhere else + if sys.platform == "win32": + rready, _, _ = select.select([self._sock], [], [], 0) + return bool(rready) + p = select.poll() + p.register(self._sock, select.POLLIN) + return bool(p.poll(0)) + + async def wait_writable(self) -> None: + await _core.wait_writable(self._sock) + + async def _resolve_address_nocp( + self, + address: AddressFormat, + *, + local: bool, + ) -> AddressFormat: + if self.family == _stdlib_socket.AF_INET6: + ipv6_v6only = self._sock.getsockopt( + _stdlib_socket.IPPROTO_IPV6, + _stdlib_socket.IPV6_V6ONLY, + ) + else: + ipv6_v6only = False + return await _resolve_address_nocp( + self.type, + self.family, + self.proto, + ipv6_v6only=ipv6_v6only, + address=address, + local=local, + ) + + # args and kwargs must be starred, otherwise pyright complains: + # '"args" member of ParamSpec is valid only when used with *args parameter' + # '"kwargs" member of ParamSpec is valid only when used with **kwargs parameter' + # wait_fn and fn must also be first in the signature + # 'Keyword parameter cannot appear in signature after ParamSpec args parameter' + + async def _nonblocking_helper( + self, + wait_fn: Callable[[_stdlib_socket.socket], Awaitable[None]], + fn: Callable[Concatenate[_stdlib_socket.socket, P], T], + *args: P.args, + **kwargs: P.kwargs, + ) -> T: + # We have to reconcile two conflicting goals: + # - We want to make it look like we always blocked in doing these + # operations. The obvious way is to always do an IO wait before + # calling the function. + # - But, we also want to provide the correct semantics, and part + # of that means giving correct errors. So, for example, if you + # haven't called .listen(), then .accept() raises an error + # immediately. But in this same circumstance, then on macOS, the + # socket does not register as readable. So if we block waiting + # for read *before* we call accept, then we'll be waiting + # forever instead of properly raising an error. (On Linux, + # interestingly, AFAICT a socket that can't possible read/write + # *does* count as readable/writable for select() purposes. But + # not on macOS.) + # + # So, we have to call the function once, with the appropriate + # cancellation/yielding sandwich if it succeeds, and if it gives + # BlockingIOError *then* we fall back to IO wait. + # + # XX think if this can be combined with the similar logic for IOCP + # submission... + async with _try_sync(): + return fn(self._sock, *args, **kwargs) + # First attempt raised BlockingIOError: + while True: + await wait_fn(self._sock) + try: + return fn(self._sock, *args, **kwargs) + except BlockingIOError: + pass + + ################################################################ + # accept + ################################################################ + + _accept = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.accept, + _core.wait_readable, + ) + + async def accept(self) -> tuple[SocketType, AddressFormat]: + """Like :meth:`socket.socket.accept`, but async.""" + sock, addr = await self._accept() + return from_stdlib_socket(sock), addr + + ################################################################ + # connect + ################################################################ + + async def connect(self, address: AddressFormat) -> None: + # nonblocking connect is weird -- you call it to start things + # off, then the socket becomes writable as a completion + # notification. This means it isn't really cancellable... we close the + # socket if cancelled, to avoid confusion. + try: + address = await self._resolve_address_nocp(address, local=False) + async with _try_sync(): + # An interesting puzzle: can a non-blocking connect() return EINTR + # (= raise InterruptedError)? PEP 475 specifically left this as + # the one place where it lets an InterruptedError escape instead + # of automatically retrying. This is based on the idea that EINTR + # from connect means that the connection was already started, and + # will continue in the background. For a blocking connect, this + # sort of makes sense: if it returns EINTR then the connection + # attempt is continuing in the background, and on many system you + # can't then call connect() again because there is already a + # connect happening. See: + # + # http://www.madore.org/~david/computers/connect-intr.html + # + # For a non-blocking connect, it doesn't make as much sense -- + # surely the interrupt didn't happen after we successfully + # initiated the connect and are just waiting for it to complete, + # because a non-blocking connect does not wait! And the spec + # describes the interaction between EINTR/blocking connect, but + # doesn't have anything useful to say about non-blocking connect: + # + # http://pubs.opengroup.org/onlinepubs/007904975/functions/connect.html + # + # So we have a conundrum: if EINTR means that the connect() hasn't + # happened (like it does for essentially every other syscall), + # then InterruptedError should be caught and retried. If EINTR + # means that the connect() has successfully started, then + # InterruptedError should be caught and ignored. Which should we + # do? + # + # In practice, the resolution is probably that non-blocking + # connect simply never returns EINTR, so the question of how to + # handle it is moot. Someone spelunked macOS/FreeBSD and + # confirmed this is true there: + # + # https://stackoverflow.com/questions/14134440/eintr-and-non-blocking-calls + # + # and exarkun seems to think it's true in general of non-blocking + # calls: + # + # https://twistedmatrix.com/pipermail/twisted-python/2010-September/022864.html + # (and indeed, AFAICT twisted doesn't try to handle + # InterruptedError). + # + # So we don't try to catch InterruptedError. This way if it + # happens, someone will hopefully tell us, and then hopefully we + # can investigate their system to figure out what its semantics + # are. + return self._sock.connect(address) + # It raised BlockingIOError, meaning that it's started the + # connection attempt. We wait for it to complete: + await _core.wait_writable(self._sock) + except trio.Cancelled: + # We can't really cancel a connect, and the socket is in an + # indeterminate state. Better to close it so we don't get + # confused. + self._sock.close() + raise + # Okay, the connect finished, but it might have failed: + err = self._sock.getsockopt(_stdlib_socket.SOL_SOCKET, _stdlib_socket.SO_ERROR) + if err != 0: + raise OSError(err, f"Error connecting to {address!r}: {os.strerror(err)}") + + ################################################################ + # recv + ################################################################ + + # Not possible to typecheck with a Callable (due to DefaultArg), nor with a + # callback Protocol (https://github.com/python/typing/discussions/1040) + # but this seems to work. If not explicitly defined then pyright --verifytypes will + # complain about AmbiguousType + if TYPE_CHECKING: + + def recv(self, buflen: int, flags: int = 0, /) -> Awaitable[bytes]: ... + + recv = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recv, + _core.wait_readable, + ) + + ################################################################ + # recv_into + ################################################################ + + if TYPE_CHECKING: + + def recv_into( + self, + /, + buffer: Buffer, + nbytes: int = 0, + flags: int = 0, + ) -> Awaitable[int]: ... + + recv_into = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recv_into, + _core.wait_readable, + ) + + ################################################################ + # recvfrom + ################################################################ + + if TYPE_CHECKING: + # return type of socket.socket.recvfrom in typeshed is tuple[bytes, Any] + def recvfrom( + self, + bufsize: int, + flags: int = 0, + /, + ) -> Awaitable[tuple[bytes, AddressFormat]]: ... + + recvfrom = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recvfrom, + _core.wait_readable, + ) + + ################################################################ + # recvfrom_into + ################################################################ + + if TYPE_CHECKING: + # return type of socket.socket.recvfrom_into in typeshed is tuple[bytes, Any] + def recvfrom_into( + self, + /, + buffer: Buffer, + nbytes: int = 0, + flags: int = 0, + ) -> Awaitable[tuple[int, AddressFormat]]: ... + + recvfrom_into = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recvfrom_into, + _core.wait_readable, + ) + + ################################################################ + # recvmsg + ################################################################ + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg") + ): + if TYPE_CHECKING: + + def recvmsg( + self, + bufsize: int, + ancbufsize: int = 0, + flags: int = 0, + /, + ) -> Awaitable[tuple[bytes, list[tuple[int, int, bytes]], int, object]]: ... + + recvmsg = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recvmsg, + _core.wait_readable, + maybe_avail=True, + ) + + ################################################################ + # recvmsg_into + ################################################################ + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "recvmsg_into") + ): + if TYPE_CHECKING: + + def recvmsg_into( + self, + buffers: Iterable[Buffer], + ancbufsize: int = 0, + flags: int = 0, + /, + ) -> Awaitable[tuple[int, list[tuple[int, int, bytes]], int, object]]: ... + + recvmsg_into = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.recvmsg_into, + _core.wait_readable, + maybe_avail=True, + ) + + ################################################################ + # send + ################################################################ + + if TYPE_CHECKING: + + def send(self, bytes: Buffer, flags: int = 0, /) -> Awaitable[int]: ... + + send = _make_simple_sock_method_wrapper( + _stdlib_socket.socket.send, + _core.wait_writable, + ) + + ################################################################ + # sendto + ################################################################ + + @overload + async def sendto( + self, + data: Buffer, + address: tuple[object, ...] | str | Buffer, + /, + ) -> int: ... + + @overload + async def sendto( + self, + data: Buffer, + flags: int, + address: tuple[object, ...] | str | Buffer, + /, + ) -> int: ... + + @_wraps(_stdlib_socket.socket.sendto, assigned=(), updated=()) + async def sendto(self, *args: object) -> int: + """Similar to :meth:`socket.socket.sendto`, but async.""" + # args is: data[, flags], address + # and kwargs are not accepted + args_list = list(args) + args_list[-1] = await self._resolve_address_nocp(args[-1], local=False) + # args_list is Any, which isn't the signature of sendto(). + # We don't care about invalid types, sendto() will do the checking. + return await self._nonblocking_helper( + _core.wait_writable, + _stdlib_socket.socket.sendto, # type: ignore[arg-type] + *args_list, + ) + + ################################################################ + # sendmsg + ################################################################ + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(_stdlib_socket.socket, "sendmsg") + ): + + @_wraps(_stdlib_socket.socket.sendmsg, assigned=(), updated=()) + async def sendmsg( + self, + buffers: Iterable[Buffer], + ancdata: Iterable[tuple[int, int, Buffer]] = (), + flags: int = 0, + address: AddressFormat | None = None, + /, + ) -> int: + """Similar to :meth:`socket.socket.sendmsg`, but async. + + Only available on platforms where :meth:`socket.socket.sendmsg` is + available. + + """ + if address is not None: + address = await self._resolve_address_nocp(address, local=False) + return await self._nonblocking_helper( + _core.wait_writable, + _stdlib_socket.socket.sendmsg, + buffers, + ancdata, + flags, + address, + ) + + ################################################################ + # sendfile + ################################################################ + + # Not implemented yet: + # async def sendfile(self, file, offset=0, count=None): + # XX + + # Intentionally omitted: + # sendall + # makefile + # setblocking/getblocking + # settimeout/gettimeout + # timeout diff --git a/contrib/python/trio/trio/_ssl.py b/contrib/python/trio/trio/_ssl.py new file mode 100644 index 000000000000..52c5137ea15f --- /dev/null +++ b/contrib/python/trio/trio/_ssl.py @@ -0,0 +1,964 @@ +from __future__ import annotations + +import contextlib +import operator as _operator +import ssl as _stdlib_ssl +from enum import Enum as _Enum +from typing import TYPE_CHECKING, Any, ClassVar, Final as TFinal, Generic, TypeVar + +import trio + +from . import _sync +from ._highlevel_generic import aclose_forcefully +from ._util import ConflictDetector, final +from .abc import Listener, Stream + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable + + from typing_extensions import TypeVarTuple, Unpack + + Ts = TypeVarTuple("Ts") + +# General theory of operation: +# +# We implement an API that closely mirrors the stdlib ssl module's blocking +# API, and we do it using the stdlib ssl module's non-blocking in-memory API. +# The stdlib non-blocking in-memory API is barely documented, and acts as a +# thin wrapper around openssl, whose documentation also leaves something to be +# desired. So here's the main things you need to know to understand the code +# in this file: +# +# We use an ssl.SSLObject, which exposes the four main I/O operations: +# +# - do_handshake: performs the initial handshake. Must be called once at the +# beginning of each connection; is a no-op once it's completed once. +# +# - write: takes some unencrypted data and attempts to send it to the remote +# peer. + +# - read: attempts to decrypt and return some data from the remote peer. +# +# - unwrap: this is weirdly named; maybe it helps to realize that the thing it +# wraps is called SSL_shutdown. It sends a cryptographically signed message +# saying "I'm closing this connection now", and then waits to receive the +# same from the remote peer (unless we already received one, in which case +# it returns immediately). +# +# All of these operations read and write from some in-memory buffers called +# "BIOs", which are an opaque OpenSSL-specific object that's basically +# semantically equivalent to a Python bytearray. When they want to send some +# bytes to the remote peer, they append them to the outgoing BIO, and when +# they want to receive some bytes from the remote peer, they try to pull them +# out of the incoming BIO. "Sending" always succeeds, because the outgoing BIO +# can always be extended to hold more data. "Receiving" acts sort of like a +# non-blocking socket: it might manage to get some data immediately, or it +# might fail and need to be tried again later. We can also directly add or +# remove data from the BIOs whenever we want. +# +# Now the problem is that while these I/O operations are opaque atomic +# operations from the point of view of us calling them, under the hood they +# might require some arbitrary sequence of sends and receives from the remote +# peer. This is particularly true for do_handshake, which generally requires a +# few round trips, but it's also true for write and read, due to an evil thing +# called "renegotiation". +# +# Renegotiation is the process by which one of the peers might arbitrarily +# decide to redo the handshake at any time. Did I mention it's evil? It's +# pretty evil, and almost universally hated. The HTTP/2 spec forbids the use +# of TLS renegotiation for HTTP/2 connections. TLS 1.3 removes it from the +# protocol entirely. It's impossible to trigger a renegotiation if using +# Python's ssl module. OpenSSL's renegotiation support is pretty buggy [1]. +# Nonetheless, it does get used in real life, mostly in two cases: +# +# 1) Normally in TLS 1.2 and below, when the client side of a connection wants +# to present a certificate to prove their identity, that certificate gets sent +# in plaintext. This is bad, because it means that anyone eavesdropping can +# see who's connecting – it's like sending your username in plain text. Not as +# bad as sending your password in plain text, but still, pretty bad. However, +# renegotiations *are* encrypted. So as a workaround, it's not uncommon for +# systems that want to use client certificates to first do an anonymous +# handshake, and then to turn around and do a second handshake (= +# renegotiation) and this time ask for a client cert. Or sometimes this is +# done on a case-by-case basis, e.g. a web server might accept a connection, +# read the request, and then once it sees the page you're asking for it might +# stop and ask you for a certificate. +# +# 2) In principle the same TLS connection can be used for an arbitrarily long +# time, and might transmit arbitrarily large amounts of data. But this creates +# a cryptographic problem: an attacker who has access to arbitrarily large +# amounts of data that's all encrypted using the same key may eventually be +# able to use this to figure out the key. Is this a real practical problem? I +# have no idea, I'm not a cryptographer. In any case, some people worry that +# it's a problem, so their TLS libraries are designed to automatically trigger +# a renegotiation every once in a while on some sort of timer. +# +# The end result is that you might be going along, minding your own business, +# and then *bam*! a wild renegotiation appears! And you just have to cope. +# +# The reason that coping with renegotiations is difficult is that some +# unassuming "read" or "write" call might find itself unable to progress until +# it does a handshake, which remember is a process with multiple round +# trips. So read might have to send data, and write might have to receive +# data, and this might happen multiple times. And some of those attempts might +# fail because there isn't any data yet, and need to be retried. Managing all +# this is pretty complicated. +# +# Here's how openssl (and thus the stdlib ssl module) handle this. All of the +# I/O operations above follow the same rules. When you call one of them: +# +# - it might write some data to the outgoing BIO +# - it might read some data from the incoming BIO +# - it might raise SSLWantReadError if it can't complete without reading more +# data from the incoming BIO. This is important: the "read" in ReadError +# refers to reading from the *underlying* stream. +# - (and in principle it might raise SSLWantWriteError too, but that never +# happens when using memory BIOs, so never mind) +# +# If it doesn't raise an error, then the operation completed successfully +# (though we still need to take any outgoing data out of the memory buffer and +# put it onto the wire). If it *does* raise an error, then we need to retry +# *exactly that method call* later – in particular, if a 'write' failed, we +# need to try again later *with the same data*, because openssl might have +# already committed some of the initial parts of our data to its output even +# though it didn't tell us that, and has remembered that the next time we call +# write it needs to skip the first 1024 bytes or whatever it is. (Well, +# technically, we're actually allowed to call 'write' again with a data buffer +# which is the same as our old one PLUS some extra stuff added onto the end, +# but in Trio that never comes up so never mind.) +# +# There are some people online who claim that once you've gotten a Want*Error +# then the *very next call* you make to openssl *must* be the same as the +# previous one. I'm pretty sure those people are wrong. In particular, it's +# okay to call write, get a WantReadError, and then call read a few times; +# it's just that *the next time you call write*, it has to be with the same +# data. +# +# One final wrinkle: we want our SSLStream to support full-duplex operation, +# i.e. it should be possible for one task to be calling send_all while another +# task is calling receive_some. But renegotiation makes this a big hassle, because +# even if SSLStream's restricts themselves to one task calling send_all and one +# task calling receive_some, those two tasks might end up both wanting to call +# send_all, or both to call receive_some at the same time *on the underlying +# stream*. So we have to do some careful locking to hide this problem from our +# users. +# +# (Renegotiation is evil.) +# +# So our basic strategy is to define a single helper method called "_retry", +# which has generic logic for dealing with SSLWantReadError, pushing data from +# the outgoing BIO to the wire, reading data from the wire to the incoming +# BIO, retrying an I/O call until it works, and synchronizing with other tasks +# that might be calling _retry concurrently. Basically it takes an SSLObject +# non-blocking in-memory method and converts it into a Trio async blocking +# method. _retry is only about 30 lines of code, but all these cases +# multiplied by concurrent calls make it extremely tricky, so there are lots +# of comments down below on the details, and a really extensive test suite in +# test_ssl.py. And now you know *why* it's so tricky, and can probably +# understand how it works. +# +# [1] https://rt.openssl.org/Ticket/Display.html?id=3712 + +# XX how closely should we match the stdlib API? +# - maybe suppress_ragged_eofs=False is a better default? +# - maybe check crypto folks for advice? +# - this is also interesting: https://bugs.python.org/issue8108#msg102867 + +# Definitely keep an eye on Cory's TLS API ideas on security-sig etc. + +# XX document behavior on cancellation/error (i.e.: all is lost abandon +# stream) +# docs will need to make very clear that this is different from all the other +# cancellations in core Trio + + +T = TypeVar("T") + +################################################################ +# SSLStream +################################################################ + +# Ideally, when the user calls SSLStream.receive_some() with no argument, then +# we should do exactly one call to self.transport_stream.receive_some(), +# decrypt everything we got, and return it. Unfortunately, the way openssl's +# API works, we have to pick how much data we want to allow when we call +# read(), and then it (potentially) triggers a call to +# transport_stream.receive_some(). So at the time we pick the amount of data +# to decrypt, we don't know how much data we've read. As a simple heuristic, +# we record the max amount of data returned by previous calls to +# transport_stream.receive_some(), and we use that for future calls to read(). +# But what do we use for the very first call? That's what this constant sets. +# +# Note that the value passed to read() is a limit on the amount of +# *decrypted* data, but we can only see the size of the *encrypted* data +# returned by transport_stream.receive_some(). TLS adds a small amount of +# framing overhead, and TLS compression is rarely used these days because it's +# insecure. So the size of the encrypted data should be a slight over-estimate +# of the size of the decrypted data, which is exactly what we want. +# +# The specific value is not really based on anything; it might be worth tuning +# at some point. But, if you have an TCP connection with the typical 1500 byte +# MTU and an initial window of 10 (see RFC 6928), then the initial burst of +# data will be limited to ~15000 bytes (or a bit less due to IP-level framing +# overhead), so this is chosen to be larger than that. +STARTING_RECEIVE_SIZE: TFinal = 16384 + + +def _is_eof(exc: BaseException | None) -> bool: + # There appears to be a bug on Python 3.10, where SSLErrors + # aren't properly translated into SSLEOFErrors. + # This stringly-typed error check is borrowed from the AnyIO + # project. + return isinstance(exc, _stdlib_ssl.SSLEOFError) or ( + "UNEXPECTED_EOF_WHILE_READING" in getattr(exc, "strerror", ()) + ) + + +class NeedHandshakeError(Exception): + """Some :class:`SSLStream` methods can't return any meaningful data until + after the handshake. If you call them before the handshake, they raise + this error. + + """ + + +class _Once: + __slots__ = ("_afn", "_args", "_done", "started") + + def __init__( + self, + afn: Callable[[*Ts], Awaitable[object]], + *args: Unpack[Ts], + ) -> None: + self._afn = afn + self._args = args + self.started = False + self._done = _sync.Event() + + async def ensure(self, *, checkpoint: bool) -> None: + if not self.started: + self.started = True + await self._afn(*self._args) + self._done.set() + elif not checkpoint and self._done.is_set(): + return + else: + await self._done.wait() + + @property + def done(self) -> bool: + return bool(self._done.is_set()) + + +_State = _Enum("_State", ["OK", "BROKEN", "CLOSED"]) + +# invariant +T_Stream = TypeVar("T_Stream", bound=Stream) + + +@final +class SSLStream(Stream, Generic[T_Stream]): + r"""Encrypted communication using SSL/TLS. + + :class:`SSLStream` wraps an arbitrary :class:`~trio.abc.Stream`, and + allows you to perform encrypted communication over it using the usual + :class:`~trio.abc.Stream` interface. You pass regular data to + :meth:`send_all`, then it encrypts it and sends the encrypted data on the + underlying :class:`~trio.abc.Stream`; :meth:`receive_some` takes encrypted + data out of the underlying :class:`~trio.abc.Stream` and decrypts it + before returning it. + + You should read the standard library's :mod:`ssl` documentation carefully + before attempting to use this class, and probably other general + documentation on SSL/TLS as well. SSL/TLS is subtle and quick to + anger. Really. I'm not kidding. + + Args: + transport_stream (~trio.abc.Stream): The stream used to transport + encrypted data. Required. + + ssl_context (~ssl.SSLContext): The :class:`~ssl.SSLContext` used for + this connection. Required. Usually created by calling + :func:`ssl.create_default_context`. + + server_hostname (str, bytes, or None): The name of the server being + connected to. Used for `SNI + `__ and for + validating the server's certificate (if hostname checking is + enabled). This is effectively mandatory for clients, and actually + mandatory if ``ssl_context.check_hostname`` is ``True``. + + server_side (bool): Whether this stream is acting as a client or + server. Defaults to False, i.e. client mode. + + https_compatible (bool): There are two versions of SSL/TLS commonly + encountered in the wild: the standard version, and the version used + for HTTPS (HTTP-over-SSL/TLS). + + Standard-compliant SSL/TLS implementations always send a + cryptographically signed ``close_notify`` message before closing the + connection. This is important because if the underlying transport + were simply closed, then there wouldn't be any way for the other + side to know whether the connection was intentionally closed by the + peer that they negotiated a cryptographic connection to, or by some + `man-in-the-middle + `__ attacker + who can't manipulate the cryptographic stream, but can manipulate + the transport layer (a so-called "truncation attack"). + + However, this part of the standard is widely ignored by real-world + HTTPS implementations, which means that if you want to interoperate + with them, then you NEED to ignore it too. + + Fortunately this isn't as bad as it sounds, because the HTTP + protocol already includes its own equivalent of ``close_notify``, so + doing this again at the SSL/TLS level is redundant. But not all + protocols do! Therefore, by default Trio implements the safer + standard-compliant version (``https_compatible=False``). But if + you're speaking HTTPS or some other protocol where + ``close_notify``\s are commonly skipped, then you should set + ``https_compatible=True``; with this setting, Trio will neither + expect nor send ``close_notify`` messages. + + If you have code that was written to use :class:`ssl.SSLSocket` and + now you're porting it to Trio, then it may be useful to know that a + difference between :class:`SSLStream` and :class:`ssl.SSLSocket` is + that :class:`~ssl.SSLSocket` implements the + ``https_compatible=True`` behavior by default. + + Attributes: + transport_stream (trio.abc.Stream): The underlying transport stream + that was passed to ``__init__``. An example of when this would be + useful is if you're using :class:`SSLStream` over a + :class:`~trio.SocketStream` and want to call the + :class:`~trio.SocketStream`'s :meth:`~trio.SocketStream.setsockopt` + method. + + Internally, this class is implemented using an instance of + :class:`ssl.SSLObject`, and all of :class:`~ssl.SSLObject`'s methods and + attributes are re-exported as methods and attributes on this class. + However, there is one difference: :class:`~ssl.SSLObject` has several + methods that return information about the encrypted connection, like + :meth:`~ssl.SSLSocket.cipher` or + :meth:`~ssl.SSLSocket.selected_alpn_protocol`. If you call them before the + handshake, when they can't possibly return useful data, then + :class:`ssl.SSLObject` returns None, but :class:`trio.SSLStream` + raises :exc:`NeedHandshakeError`. + + This also means that if you register a SNI callback using + `~ssl.SSLContext.sni_callback`, then the first argument your callback + receives will be a :class:`ssl.SSLObject`. + + """ + + # Note: any new arguments here should likely also be added to + # SSLListener.__init__, and maybe the open_ssl_over_tcp_* helpers. + def __init__( + self, + transport_stream: T_Stream, + ssl_context: _stdlib_ssl.SSLContext, + *, + server_hostname: str | bytes | None = None, + server_side: bool = False, + https_compatible: bool = False, + ) -> None: + self.transport_stream: T_Stream = transport_stream + self._state = _State.OK + self._https_compatible = https_compatible + self._outgoing = _stdlib_ssl.MemoryBIO() + self._delayed_outgoing: bytes | None = None + self._incoming = _stdlib_ssl.MemoryBIO() + self._ssl_object = ssl_context.wrap_bio( + self._incoming, + self._outgoing, + server_side=server_side, + server_hostname=server_hostname, + ) + # Tracks whether we've already done the initial handshake + self._handshook = _Once(self._do_handshake) + + # These are used to synchronize access to self.transport_stream + self._inner_send_lock = _sync.StrictFIFOLock() + self._inner_recv_count = 0 + self._inner_recv_lock = _sync.Lock() + + # These are used to make sure that our caller doesn't attempt to make + # multiple concurrent calls to send_all/wait_send_all_might_not_block + # or to receive_some. + self._outer_send_conflict_detector = ConflictDetector( + "another task is currently sending data on this SSLStream", + ) + self._outer_recv_conflict_detector = ConflictDetector( + "another task is currently receiving data on this SSLStream", + ) + + self._estimated_receive_size = STARTING_RECEIVE_SIZE + + _forwarded: ClassVar = { + "context", + "server_side", + "server_hostname", + "session", + "session_reused", + "getpeercert", + "selected_npn_protocol", + "cipher", + "shared_ciphers", + "compression", + "pending", + "get_channel_binding", + "selected_alpn_protocol", + "version", + } + + _after_handshake: ClassVar = { + "session_reused", + "getpeercert", + "selected_npn_protocol", + "cipher", + "shared_ciphers", + "compression", + "get_channel_binding", + "selected_alpn_protocol", + "version", + } + + def __getattr__( # type: ignore[explicit-any] + self, + name: str, + ) -> Any: + if name in self._forwarded: + if name in self._after_handshake and not self._handshook.done: + raise NeedHandshakeError(f"call do_handshake() before calling {name!r}") + + return getattr(self._ssl_object, name) + else: + raise AttributeError(name) + + def __setattr__(self, name: str, value: object) -> None: + if name in self._forwarded: + setattr(self._ssl_object, name, value) + else: + super().__setattr__(name, value) + + def __dir__(self) -> list[str]: + return list(super().__dir__()) + list(self._forwarded) + + def _check_status(self) -> None: + if self._state is _State.OK: + return + elif self._state is _State.BROKEN: + raise trio.BrokenResourceError + elif self._state is _State.CLOSED: + raise trio.ClosedResourceError + else: # pragma: no cover + raise AssertionError() + + # This is probably the single trickiest function in Trio. It has lots of + # comments, though, just make sure to think carefully if you ever have to + # touch it. The big comment at the top of this file will help explain + # too. + async def _retry( + self, + fn: Callable[[*Ts], T], + *args: Unpack[Ts], + ignore_want_read: bool = False, + is_handshake: bool = False, + ) -> T | None: + await trio.lowlevel.checkpoint_if_cancelled() + yielded = False + finished = False + while not finished: + # WARNING: this code needs to be very careful with when it + # calls 'await'! There might be multiple tasks calling this + # function at the same time trying to do different operations, + # so we need to be careful to: + # + # 1) interact with the SSLObject, then + # 2) await on exactly one thing that lets us make forward + # progress, then + # 3) loop or exit + # + # In particular we don't want to yield while interacting with + # the SSLObject (because it's shared state, so someone else + # might come in and mess with it while we're suspended), and + # we don't want to yield *before* starting the operation that + # will help us make progress, because then someone else might + # come in and leapfrog us. + + # Call the SSLObject method, and get its result. + # + # NB: despite what the docs say, SSLWantWriteError can't + # happen – "Writes to memory BIOs will always succeed if + # memory is available: that is their size can grow + # indefinitely." + # https://wiki.openssl.org/index.php/Manual:BIO_s_mem(3) + want_read = False + ret = None + try: + ret = fn(*args) + except _stdlib_ssl.SSLWantReadError: + want_read = True + except (_stdlib_ssl.SSLError, _stdlib_ssl.CertificateError) as exc: + self._state = _State.BROKEN + raise trio.BrokenResourceError from exc + else: + finished = True + if ignore_want_read: + want_read = False + finished = True + to_send = self._outgoing.read() + + # Some versions of SSL_do_handshake have a bug in how they handle + # the TLS 1.3 handshake on the server side: after the handshake + # finishes, they automatically send session tickets, even though + # the client may not be expecting data to arrive at this point and + # sending it could cause a deadlock or lost data. This applies at + # least to OpenSSL 1.1.1c and earlier, and the OpenSSL devs + # currently have no plans to fix it: + # + # https://github.com/openssl/openssl/issues/7948 + # https://github.com/openssl/openssl/issues/7967 + # + # The correct behavior is to wait to send session tickets on the + # first call to SSL_write. (This is what BoringSSL does.) So, we + # use a heuristic to detect when OpenSSL has tried to send session + # tickets, and we manually delay sending them until the + # appropriate moment. For more discussion see: + # + # https://github.com/python-trio/trio/issues/819#issuecomment-517529763 + if ( + is_handshake + and not want_read + and self._ssl_object.server_side + and self._ssl_object.version() == "TLSv1.3" + ): + assert self._delayed_outgoing is None + self._delayed_outgoing = to_send + to_send = b"" + + # Outputs from the above code block are: + # + # - to_send: bytestring; if non-empty then we need to send + # this data to make forward progress + # + # - want_read: True if we need to receive_some some data to make + # forward progress + # + # - finished: False means that we need to retry the call to + # fn(*args) again, after having pushed things forward. True + # means we still need to do whatever was said (in particular + # send any data in to_send), but once we do then we're + # done. + # + # - ret: the operation's return value. (Meaningless unless + # finished is True.) + # + # Invariant: want_read and finished can't both be True at the + # same time. + # + # Now we need to move things forward. There are two things we + # might have to do, and any given operation might require + # either, both, or neither to proceed: + # + # - send the data in to_send + # + # - receive_some some data and put it into the incoming BIO + # + # Our strategy is: if there's data to send, send it; + # *otherwise* if there's data to receive_some, receive_some it. + # + # If both need to happen, then we only send. Why? Well, we + # know that *right now* we have to both send and receive_some + # before the operation can complete. But as soon as we yield, + # that information becomes potentially stale – e.g. while + # we're sending, some other task might go and receive_some the + # data we need and put it into the incoming BIO. And if it + # does, then we *definitely don't* want to do a receive_some – + # there might not be any more data coming, and we'd deadlock! + # We could do something tricky to keep track of whether a + # receive_some happens while we're sending, but the case where + # we have to do both is very unusual (only during a + # renegotiation), so it's better to keep things simple. So we + # do just one potentially-blocking operation, then check again + # for fresh information. + # + # And we prioritize sending over receiving because, if there + # are multiple tasks that want to receive_some, then it + # doesn't matter what order they go in. But if there are + # multiple tasks that want to send, then they each have + # different data, and the data needs to get put onto the wire + # in the same order that it was retrieved from the outgoing + # BIO. So if we have data to send, that *needs* to be the + # *very* *next* *thing* we do, to make sure no-one else sneaks + # in before us. Or if we can't send immediately because + # someone else is, then we at least need to get in line + # immediately. + if to_send: + # NOTE: This relies on the lock being strict FIFO fair! + async with self._inner_send_lock: + yielded = True + try: + if self._delayed_outgoing is not None: + to_send = self._delayed_outgoing + to_send + self._delayed_outgoing = None + await self.transport_stream.send_all(to_send) + except: + # Some unknown amount of our data got sent, and we + # don't know how much. This stream is doomed. + self._state = _State.BROKEN + raise + elif want_read: + # It's possible that someone else is already blocked in + # transport_stream.receive_some. If so then we want to + # wait for them to finish, but we don't want to call + # transport_stream.receive_some again ourselves; we just + # want to loop around and check if their contribution + # helped anything. So we make a note of how many times + # some task has been through here before taking the lock, + # and if it's changed by the time we get the lock, then we + # skip calling transport_stream.receive_some and loop + # around immediately. + recv_count = self._inner_recv_count + async with self._inner_recv_lock: + yielded = True + if recv_count == self._inner_recv_count: + data = await self.transport_stream.receive_some() + if not data: + self._incoming.write_eof() + else: + self._estimated_receive_size = max( + self._estimated_receive_size, + len(data), + ) + self._incoming.write(data) + self._inner_recv_count += 1 + if not yielded: + await trio.lowlevel.cancel_shielded_checkpoint() + return ret + + async def _do_handshake(self) -> None: + try: + await self._retry(self._ssl_object.do_handshake, is_handshake=True) + except: + self._state = _State.BROKEN + raise + + async def do_handshake(self) -> None: + """Ensure that the initial handshake has completed. + + The SSL protocol requires an initial handshake to exchange + certificates, select cryptographic keys, and so forth, before any + actual data can be sent or received. You don't have to call this + method; if you don't, then :class:`SSLStream` will automatically + perform the handshake as needed, the first time you try to send or + receive data. But if you want to trigger it manually – for example, + because you want to look at the peer's certificate before you start + talking to them – then you can call this method. + + If the initial handshake is already in progress in another task, this + waits for it to complete and then returns. + + If the initial handshake has already completed, this returns + immediately without doing anything (except executing a checkpoint). + + .. warning:: If this method is cancelled, then it may leave the + :class:`SSLStream` in an unusable state. If this happens then any + future attempt to use the object will raise + :exc:`trio.BrokenResourceError`. + + """ + self._check_status() + await self._handshook.ensure(checkpoint=True) + + # Most things work if we don't explicitly force do_handshake to be called + # before calling receive_some or send_all, because openssl will + # automatically perform the handshake on the first SSL_{read,write} + # call. BUT, allowing openssl to do this will disable Python's hostname + # checking!!! See: + # https://bugs.python.org/issue30141 + # So we *definitely* have to make sure that do_handshake is called + # before doing anything else. + async def receive_some(self, max_bytes: int | None = None) -> bytes | bytearray: + """Read some data from the underlying transport, decrypt it, and + return it. + + See :meth:`trio.abc.ReceiveStream.receive_some` for details. + + .. warning:: If this method is cancelled while the initial handshake + or a renegotiation are in progress, then it may leave the + :class:`SSLStream` in an unusable state. If this happens then any + future attempt to use the object will raise + :exc:`trio.BrokenResourceError`. + + """ + with self._outer_recv_conflict_detector: + self._check_status() + try: + await self._handshook.ensure(checkpoint=False) + except trio.BrokenResourceError as exc: + # For some reason, EOF before handshake sometimes raises + # SSLSyscallError instead of SSLEOFError (e.g. on my linux + # laptop, but not on appveyor). Thanks openssl. + if self._https_compatible and ( + isinstance(exc.__cause__, _stdlib_ssl.SSLSyscallError) + or _is_eof(exc.__cause__) + ): + await trio.lowlevel.checkpoint() + return b"" + else: + raise + if max_bytes is None: + # If we somehow have more data already in our pending buffer + # than the estimate receive size, bump up our size a bit for + # this read only. + max_bytes = max(self._estimated_receive_size, self._incoming.pending) + else: + max_bytes = _operator.index(max_bytes) + if max_bytes < 1: + raise ValueError("max_bytes must be >= 1") + try: + received = await self._retry(self._ssl_object.read, max_bytes) + assert received is not None + return received + except trio.BrokenResourceError as exc: + # This isn't quite equivalent to just returning b"" in the + # first place, because we still end up with self._state set to + # BROKEN. But that's actually fine, because after getting an + # EOF on TLS then the only thing you can do is close the + # stream, and closing doesn't care about the state. + + if self._https_compatible and _is_eof(exc.__cause__): + await trio.lowlevel.checkpoint() + return b"" + else: + raise + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + """Encrypt some data and then send it on the underlying transport. + + See :meth:`trio.abc.SendStream.send_all` for details. + + .. warning:: If this method is cancelled, then it may leave the + :class:`SSLStream` in an unusable state. If this happens then any + attempt to use the object will raise + :exc:`trio.BrokenResourceError`. + + """ + with self._outer_send_conflict_detector: + self._check_status() + await self._handshook.ensure(checkpoint=False) + # SSLObject interprets write(b"") as an EOF for some reason, which + # is not what we want. + if not data: + await trio.lowlevel.checkpoint() + return + await self._retry(self._ssl_object.write, data) + + async def unwrap(self) -> tuple[Stream, bytes | bytearray]: + """Cleanly close down the SSL/TLS encryption layer, allowing the + underlying stream to be used for unencrypted communication. + + You almost certainly don't need this. + + Returns: + A pair ``(transport_stream, trailing_bytes)``, where + ``transport_stream`` is the underlying transport stream, and + ``trailing_bytes`` is a byte string. Since :class:`SSLStream` + doesn't necessarily know where the end of the encrypted data will + be, it can happen that it accidentally reads too much from the + underlying stream. ``trailing_bytes`` contains this extra data; you + should process it as if it was returned from a call to + ``transport_stream.receive_some(...)``. + + """ + with self._outer_recv_conflict_detector, self._outer_send_conflict_detector: + self._check_status() + await self._handshook.ensure(checkpoint=False) + await self._retry(self._ssl_object.unwrap) + transport_stream = self.transport_stream + self._state = _State.CLOSED + self.transport_stream = None # type: ignore[assignment] # State is CLOSED now, nothing should use + return (transport_stream, self._incoming.read()) + + async def aclose(self) -> None: + """Gracefully shut down this connection, and close the underlying + transport. + + If ``https_compatible`` is False (the default), then this attempts to + first send a ``close_notify`` and then close the underlying stream by + calling its :meth:`~trio.abc.AsyncResource.aclose` method. + + If ``https_compatible`` is set to True, then this simply closes the + underlying stream and marks this stream as closed. + + """ + if self._state is _State.CLOSED: + await trio.lowlevel.checkpoint() + return + if self._state is _State.BROKEN or self._https_compatible: + self._state = _State.CLOSED + await self.transport_stream.aclose() + return + try: + # https_compatible=False, so we're in spec-compliant mode and have + # to send close_notify so that the other side gets a cryptographic + # assurance that we've called aclose. Of course, we can't do + # anything cryptographic until after we've completed the + # handshake: + await self._handshook.ensure(checkpoint=False) + # Then, we call SSL_shutdown *once*, because we want to send a + # close_notify but *not* wait for the other side to send back a + # response. In principle it would be more polite to wait for the + # other side to reply with their own close_notify. However, if + # they aren't paying attention (e.g., if they're just sending + # data and not receiving) then we will never notice our + # close_notify and we'll be waiting forever. Eventually we'll time + # out (hopefully), but it's still kind of nasty. And we can't + # require the other side to always be receiving, because (a) + # backpressure is kind of important, and (b) I bet there are + # broken TLS implementations out there that don't receive all the + # time. (Like e.g. anyone using Python ssl in synchronous mode.) + # + # The send-then-immediately-close behavior is explicitly allowed + # by the TLS specs, so we're ok on that. + # + # Subtlety: SSLObject.unwrap will immediately call it a second + # time, and the second time will raise SSLWantReadError because + # there hasn't been time for the other side to respond + # yet. (Unless they spontaneously sent a close_notify before we + # called this, and it's either already been processed or gets + # pulled out of the buffer by Python's second call.) So the way to + # do what we want is to ignore SSLWantReadError on this call. + # + # Also, because the other side might have already sent + # close_notify and closed their connection then it's possible that + # our attempt to send close_notify will raise + # BrokenResourceError. This is totally legal, and in fact can happen + # with two well-behaved Trio programs talking to each other, so we + # don't want to raise an error. So we suppress BrokenResourceError + # here. (This is safe, because literally the only thing this call + # to _retry will do is send the close_notify alert, so that's + # surely where the error comes from.) + # + # FYI in some cases this could also raise SSLSyscallError which I + # think is because SSL_shutdown is terrible. (Check out that note + # at the bottom of the man page saying that it sometimes gets + # raised spuriously.) I haven't seen this since we switched to + # immediately closing the socket, and I don't know exactly what + # conditions cause it and how to respond, so for now we're just + # letting that happen. But if you start seeing it, then hopefully + # this will give you a little head start on tracking it down, + # because whoa did this puzzle us at the 2017 PyCon sprints. + # + # Also, if someone else is blocked in send/receive, then we aren't + # going to be able to do a clean shutdown. If that happens, we'll + # just do an unclean shutdown. + with contextlib.suppress(trio.BrokenResourceError, trio.BusyResourceError): + await self._retry(self._ssl_object.unwrap, ignore_want_read=True) + except: + # Failure! Kill the stream and move on. + await aclose_forcefully(self.transport_stream) + raise + else: + # Success! Gracefully close the underlying stream. + await self.transport_stream.aclose() + finally: + self._state = _State.CLOSED + + async def wait_send_all_might_not_block(self) -> None: + """See :meth:`trio.abc.SendStream.wait_send_all_might_not_block`.""" + # This method's implementation is deceptively simple. + # + # First, we take the outer send lock, because of Trio's standard + # semantics that wait_send_all_might_not_block and send_all + # conflict. + with self._outer_send_conflict_detector: + self._check_status() + # Then we take the inner send lock. We know that no other tasks + # are calling self.send_all or self.wait_send_all_might_not_block, + # because we have the outer_send_lock. But! There might be another + # task calling self.receive_some -> transport_stream.send_all, in + # which case if we were to call + # transport_stream.wait_send_all_might_not_block directly we'd + # have two tasks doing write-related operations on + # transport_stream simultaneously, which is not allowed. We + # *don't* want to raise this conflict to our caller, because it's + # purely an internal affair – all they did was call + # wait_send_all_might_not_block and receive_some at the same time, + # which is totally valid. And waiting for the lock is OK, because + # a call to send_all certainly wouldn't complete while the other + # task holds the lock. + async with self._inner_send_lock: + # Now we have the lock, which creates another potential + # problem: what if a call to self.receive_some attempts to do + # transport_stream.send_all now? It'll have to wait for us to + # finish! But that's OK, because we release the lock as soon + # as the underlying stream becomes writable, and the + # self.receive_some call wasn't going to make any progress + # until then anyway. + # + # Of course, this does mean we might return *before* the + # stream is logically writable, because immediately after we + # return self.receive_some might write some data and make it + # non-writable again. But that's OK too, + # wait_send_all_might_not_block only guarantees that it + # doesn't return late. + await self.transport_stream.wait_send_all_might_not_block() + + +# this is necessary for Sphinx, see also `_abc.py` +SSLStream.__module__ = SSLStream.__module__.replace("._ssl", "") + + +@final +class SSLListener(Listener[SSLStream[T_Stream]]): + """A :class:`~trio.abc.Listener` for SSL/TLS-encrypted servers. + + :class:`SSLListener` wraps around another Listener, and converts + all incoming connections to encrypted connections by wrapping them + in a :class:`SSLStream`. + + Args: + transport_listener (~trio.abc.Listener): The listener whose incoming + connections will be wrapped in :class:`SSLStream`. + + ssl_context (~ssl.SSLContext): The :class:`~ssl.SSLContext` that will be + used for incoming connections. + + https_compatible (bool): Passed on to :class:`SSLStream`. + + Attributes: + transport_listener (trio.abc.Listener): The underlying listener that was + passed to ``__init__``. + + """ + + def __init__( + self, + transport_listener: Listener[T_Stream], + ssl_context: _stdlib_ssl.SSLContext, + *, + https_compatible: bool = False, + ) -> None: + self.transport_listener = transport_listener + self._ssl_context = ssl_context + self._https_compatible = https_compatible + + async def accept(self) -> SSLStream[T_Stream]: + """Accept the next connection and wrap it in an :class:`SSLStream`. + + See :meth:`trio.abc.Listener.accept` for details. + + """ + transport_stream = await self.transport_listener.accept() + return SSLStream( + transport_stream, + self._ssl_context, + server_side=True, + https_compatible=self._https_compatible, + ) + + async def aclose(self) -> None: + """Close the transport listener.""" + await self.transport_listener.aclose() diff --git a/contrib/python/trio/trio/_subprocess.py b/contrib/python/trio/trio/_subprocess.py new file mode 100644 index 000000000000..d4faf317f87a --- /dev/null +++ b/contrib/python/trio/trio/_subprocess.py @@ -0,0 +1,1186 @@ +from __future__ import annotations + +import contextlib +import os +import subprocess +import sys +import warnings +from contextlib import ExitStack +from functools import partial +from typing import ( + TYPE_CHECKING, + Final, + Literal, + Protocol, + TypedDict, + Union, + overload, +) + +import trio + +from ._core import ClosedResourceError, TaskStatus +from ._highlevel_generic import StapledStream +from ._subprocess_platform import ( + create_pipe_from_child_output, + create_pipe_to_child_stdin, + wait_child_exiting, +) +from ._sync import Lock +from ._util import NoPublicConstructor, final + +if TYPE_CHECKING: + import signal + from collections.abc import Awaitable, Callable, Iterable, Mapping, Sequence + from io import TextIOWrapper + + from typing_extensions import TypeAlias, Unpack + + from ._abc import ReceiveStream, SendStream + + +# Sphinx cannot parse the stringified version +StrOrBytesPath: TypeAlias = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]] + + +# Linux-specific, but has complex lifetime management stuff so we hard-code it +# here instead of hiding it behind the _subprocess_platform abstraction +can_try_pidfd_open: bool +if TYPE_CHECKING: + + def pidfd_open(fd: int, flags: int) -> int: ... + + from ._subprocess_platform import ClosableReceiveStream, ClosableSendStream + +else: + can_try_pidfd_open = True + try: + from os import pidfd_open + except ImportError: + if sys.platform == "linux": + # this workaround is needed on: + # - CPython <= 3.8 + # - non-CPython (maybe?) + # - Anaconda's interpreter (as it is built to assume an older + # than current linux kernel) + # + # The last point implies that other custom builds might not work; + # therefore, no assertion should be here. + import ctypes + + _cdll_for_pidfd_open = ctypes.CDLL(None, use_errno=True) + _cdll_for_pidfd_open.syscall.restype = ctypes.c_long + # pid and flags are actually int-sized, but the syscall() function + # always takes longs. (Except on x32 where long is 32-bits and syscall + # takes 64-bit arguments. But in the unlikely case that anyone is + # using x32, this will still work, b/c we only need to pass in 32 bits + # of data, and the C ABI doesn't distinguish between passing 32-bit vs + # 64-bit integers; our 32-bit values will get loaded into 64-bit + # registers where syscall() will find them.) + _cdll_for_pidfd_open.syscall.argtypes = [ + ctypes.c_long, # syscall number + ctypes.c_long, # pid + ctypes.c_long, # flags + ] + __NR_pidfd_open = 434 + + def pidfd_open(fd: int, flags: int) -> int: + result = _cdll_for_pidfd_open.syscall(__NR_pidfd_open, fd, flags) + if result < 0: # pragma: no cover + err = ctypes.get_errno() + raise OSError(err, os.strerror(err)) + return result + + else: + can_try_pidfd_open = False + + +class HasFileno(Protocol): + """Represents any file-like object that has a file descriptor.""" + + def fileno(self) -> int: ... + + +@final +class Process(metaclass=NoPublicConstructor): + r"""A child process. Like :class:`subprocess.Popen`, but async. + + This class has no public constructor. The most common way to get a + `Process` object is to combine `Nursery.start` with `run_process`:: + + process_object = await nursery.start(run_process, ...) + + This way, `run_process` supervises the process and makes sure that it is + cleaned up properly, while optionally checking the return value, feeding + it input, and so on. + + If you need more control – for example, because you want to spawn a child + process that outlives your program – then another option is to use + `trio.lowlevel.open_process`:: + + process_object = await trio.lowlevel.open_process(...) + + Attributes: + args (str or list): The ``command`` passed at construction time, + specifying the process to execute and its arguments. + pid (int): The process ID of the child process managed by this object. + stdin (trio.abc.SendStream or None): A stream connected to the child's + standard input stream: when you write bytes here, they become available + for the child to read. Only available if the :class:`Process` + was constructed using ``stdin=PIPE``; otherwise this will be None. + stdout (trio.abc.ReceiveStream or None): A stream connected to + the child's standard output stream: when the child writes to + standard output, the written bytes become available for you + to read here. Only available if the :class:`Process` was + constructed using ``stdout=PIPE``; otherwise this will be None. + stderr (trio.abc.ReceiveStream or None): A stream connected to + the child's standard error stream: when the child writes to + standard error, the written bytes become available for you + to read here. Only available if the :class:`Process` was + constructed using ``stderr=PIPE``; otherwise this will be None. + stdio (trio.StapledStream or None): A stream that sends data to + the child's standard input and receives from the child's standard + output. Only available if both :attr:`stdin` and :attr:`stdout` are + available; otherwise this will be None. + + """ + + # We're always in binary mode. + universal_newlines: Final = False + encoding: Final = None + errors: Final = None + + # Available for the per-platform wait_child_exiting() implementations + # to stash some state; waitid platforms use this to avoid spawning + # arbitrarily many threads if wait() keeps getting cancelled. + _wait_for_exit_data: object = None + + def __init__( + self, + popen: subprocess.Popen[bytes], + stdin: SendStream | None, + stdout: ReceiveStream | None, + stderr: ReceiveStream | None, + ) -> None: + self._proc = popen + self.stdin = stdin + self.stdout = stdout + self.stderr = stderr + + self.stdio: StapledStream[SendStream, ReceiveStream] | None = None + if self.stdin is not None and self.stdout is not None: + self.stdio = StapledStream(self.stdin, self.stdout) + + self._wait_lock: Lock = Lock() + + self._pidfd: TextIOWrapper | None = None + if can_try_pidfd_open: + try: + fd: int = pidfd_open(self._proc.pid, 0) + except OSError: # pragma: no cover + # Well, we tried, but it didn't work (probably because we're + # running on an older kernel, or in an older sandbox, that + # hasn't been updated to support pidfd_open). We'll fall back + # on waitid instead. + pass + else: + # It worked! Wrap the raw fd up in a Python file object to + # make sure it'll get closed. + # SIM115: open-file-with-context-handler + self._pidfd = open(fd) # noqa: SIM115 + + self.args: StrOrBytesPath | Sequence[StrOrBytesPath] = self._proc.args + self.pid: int = self._proc.pid + + def __repr__(self) -> str: + returncode = self.returncode + if returncode is None: + status = f"running with PID {self.pid}" + else: + if returncode < 0: + status = f"exited with signal {-returncode}" + else: + status = f"exited with status {returncode}" + return f"" + + @property + def returncode(self) -> int | None: + """The exit status of the process (an integer), or ``None`` if it's + still running. + + By convention, a return code of zero indicates success. On + UNIX, negative values indicate termination due to a signal, + e.g., -11 if terminated by signal 11 (``SIGSEGV``). On + Windows, a process that exits due to a call to + :meth:`Process.terminate` will have an exit status of 1. + + Unlike the standard library `subprocess.Popen.returncode`, you don't + have to call `poll` or `wait` to update this attribute; it's + automatically updated as needed, and will always give you the latest + information. + + """ + result = self._proc.poll() + if result is not None: + self._close_pidfd() + return result + + def _close_pidfd(self) -> None: + if self._pidfd is not None: + trio.lowlevel.notify_closing(self._pidfd.fileno()) + self._pidfd.close() + self._pidfd = None + + async def wait(self) -> int: + """Block until the process exits. + + Returns: + The exit status of the process; see :attr:`returncode`. + """ + async with self._wait_lock: + if self.poll() is None: + if self._pidfd is not None: + with contextlib.suppress( + ClosedResourceError, + ): # something else (probably a call to poll) already closed the pidfd + await trio.lowlevel.wait_readable(self._pidfd.fileno()) + else: + await wait_child_exiting(self) + # We have to use .wait() here, not .poll(), because on macOS + # (and maybe other systems, who knows), there's a race + # condition inside the kernel that creates a tiny window where + # kqueue reports that the process has exited, but + # waitpid(WNOHANG) can't yet reap it. So this .wait() may + # actually block for a tiny fraction of a second. + self._proc.wait() + self._close_pidfd() + assert self._proc.returncode is not None + return self._proc.returncode + + def poll(self) -> int | None: + """Returns the exit status of the process (an integer), or ``None`` if + it's still running. + + Note that on Trio (unlike the standard library `subprocess.Popen`), + ``process.poll()`` and ``process.returncode`` always give the same + result. See `returncode` for more details. This method is only + included to make it easier to port code from `subprocess`. + + """ + return self.returncode + + def send_signal(self, sig: signal.Signals | int) -> None: + """Send signal ``sig`` to the process. + + On UNIX, ``sig`` may be any signal defined in the + :mod:`signal` module, such as ``signal.SIGINT`` or + ``signal.SIGTERM``. On Windows, it may be anything accepted by + the standard library :meth:`subprocess.Popen.send_signal`. + """ + self._proc.send_signal(sig) + + def terminate(self) -> None: + """Terminate the process, politely if possible. + + On UNIX, this is equivalent to + ``send_signal(signal.SIGTERM)``; by convention this requests + graceful termination, but a misbehaving or buggy process might + ignore it. On Windows, :meth:`terminate` forcibly terminates the + process in the same manner as :meth:`kill`. + """ + self._proc.terminate() + + def kill(self) -> None: + """Immediately terminate the process. + + On UNIX, this is equivalent to + ``send_signal(signal.SIGKILL)``. On Windows, it calls + ``TerminateProcess``. In both cases, the process cannot + prevent itself from being killed, but the termination will be + delivered asynchronously; use :meth:`wait` if you want to + ensure the process is actually dead before proceeding. + """ + self._proc.kill() + + +async def _open_process( + command: StrOrBytesPath | Sequence[StrOrBytesPath], + *, + stdin: int | HasFileno | None = None, + stdout: int | HasFileno | None = None, + stderr: int | HasFileno | None = None, + **options: object, +) -> Process: + r"""Execute a child program in a new process. + + After construction, you can interact with the child process by writing data to its + `~trio.Process.stdin` stream (a `~trio.abc.SendStream`), reading data from its + `~trio.Process.stdout` and/or `~trio.Process.stderr` streams (both + `~trio.abc.ReceiveStream`\s), sending it signals using `~trio.Process.terminate`, + `~trio.Process.kill`, or `~trio.Process.send_signal`, and waiting for it to exit + using `~trio.Process.wait`. See `trio.Process` for details. + + Each standard stream is only available if you specify that a pipe should be created + for it. For example, if you pass ``stdin=subprocess.PIPE``, you can write to the + `~trio.Process.stdin` stream, else `~trio.Process.stdin` will be ``None``. + + Unlike `trio.run_process`, this function doesn't do any kind of automatic + management of the child process. It's up to you to implement whatever semantics you + want. + + Args: + command: The command to run. Typically this is a sequence of strings or + bytes such as ``['ls', '-l', 'directory with spaces']``, where the + first element names the executable to invoke and the other elements + specify its arguments. With ``shell=True`` in the ``**options``, or on + Windows, ``command`` can be a string or bytes, which will be parsed + following platform-dependent :ref:`quoting rules + `. In all cases ``command`` can be a path or a + sequence of paths. + stdin: Specifies what the child process's standard input + stream should connect to: output written by the parent + (``subprocess.PIPE``), nothing (``subprocess.DEVNULL``), + or an open file (pass a file descriptor or something whose + ``fileno`` method returns one). If ``stdin`` is unspecified, + the child process will have the same standard input stream + as its parent. + stdout: Like ``stdin``, but for the child process's standard output + stream. + stderr: Like ``stdin``, but for the child process's standard error + stream. An additional value ``subprocess.STDOUT`` is supported, + which causes the child's standard output and standard error + messages to be intermixed on a single standard output stream, + attached to whatever the ``stdout`` option says to attach it to. + **options: Other :ref:`general subprocess options ` + are also accepted. + + Returns: + A new `trio.Process` object. + + Raises: + OSError: if the process spawning fails, for example because the + specified command could not be found. + + """ + for key in ("universal_newlines", "text", "encoding", "errors", "bufsize"): + if options.get(key): + raise TypeError( + "trio.Process only supports communicating over " + f"unbuffered byte streams; the '{key}' option is not supported", + ) + + if os.name == "posix": + # TODO: how do paths and sequences thereof play with `shell=True`? + if isinstance(command, (str, bytes)) and not options.get("shell"): + raise TypeError( + "command must be a sequence (not a string or bytes) if " + "shell=False on UNIX systems", + ) + if not isinstance(command, (str, bytes)) and options.get("shell"): + raise TypeError( + "command must be a string or bytes (not a sequence) if " + "shell=True on UNIX systems", + ) + + trio_stdin: ClosableSendStream | None = None + trio_stdout: ClosableReceiveStream | None = None + trio_stderr: ClosableReceiveStream | None = None + # Close the parent's handle for each child side of a pipe; we want the child to + # have the only copy, so that when it exits we can read EOF on our side. The + # trio ends of pipes will be transferred to the Process object, which will be + # responsible for their lifetime. If process spawning fails, though, we still + # want to close them before letting the failure bubble out + with ExitStack() as always_cleanup, ExitStack() as cleanup_on_fail: + if stdin == subprocess.PIPE: + trio_stdin, stdin = create_pipe_to_child_stdin() + always_cleanup.callback(os.close, stdin) + cleanup_on_fail.callback(trio_stdin.close) + if stdout == subprocess.PIPE: + trio_stdout, stdout = create_pipe_from_child_output() + always_cleanup.callback(os.close, stdout) + cleanup_on_fail.callback(trio_stdout.close) + if stderr == subprocess.STDOUT: + # If we created a pipe for stdout, pass the same pipe for + # stderr. If stdout was some non-pipe thing (DEVNULL or a + # given FD), pass the same thing. If stdout was passed as + # None, keep stderr as STDOUT to allow subprocess to dup + # our stdout. Regardless of which of these is applicable, + # don't create a new Trio stream for stderr -- if stdout + # is piped, stderr will be intermixed on the stdout stream. + if stdout is not None: + stderr = stdout + elif stderr == subprocess.PIPE: + trio_stderr, stderr = create_pipe_from_child_output() + always_cleanup.callback(os.close, stderr) + cleanup_on_fail.callback(trio_stderr.close) + + popen = await trio.to_thread.run_sync( + partial( + subprocess.Popen, + command, + stdin=stdin, + stdout=stdout, + stderr=stderr, + **options, + ), + ) + # We did not fail, so dismiss the stack for the trio ends + cleanup_on_fail.pop_all() + + return Process._create(popen, trio_stdin, trio_stdout, trio_stderr) + + +# async function missing await +async def _windows_deliver_cancel(p: Process) -> None: # noqa: RUF029 + try: + p.terminate() + except OSError as exc: + warnings.warn( + RuntimeWarning(f"TerminateProcess on {p!r} failed with: {exc!r}"), + stacklevel=1, + ) + + +async def _posix_deliver_cancel(p: Process) -> None: + try: + p.terminate() + await trio.sleep(5) + warnings.warn( + RuntimeWarning( + f"process {p!r} ignored SIGTERM for 5 seconds. " + "(Maybe you should pass a custom deliver_cancel?) " + "Trying SIGKILL.", + ), + stacklevel=1, + ) + p.kill() + except OSError as exc: + warnings.warn( + RuntimeWarning(f"tried to kill process {p!r}, but failed with: {exc!r}"), + stacklevel=1, + ) + + +# Use a private name, so we can declare platform-specific stubs below. +# This is also the signature read by Sphinx +async def _run_process( + command: StrOrBytesPath | Sequence[StrOrBytesPath], + *, + stdin: bytes | bytearray | memoryview | int | HasFileno | None = b"", + capture_stdout: bool = False, + capture_stderr: bool = False, + check: bool = True, + deliver_cancel: Callable[[Process], Awaitable[object]] | None = None, + task_status: TaskStatus[Process] = trio.TASK_STATUS_IGNORED, + **options: object, +) -> subprocess.CompletedProcess[bytes]: + """Run ``command`` in a subprocess and wait for it to complete. + + This function can be called in two different ways. + + One option is a direct call, like:: + + completed_process_info = await trio.run_process(...) + + In this case, it returns a :class:`subprocess.CompletedProcess` instance + describing the results. Use this if you want to treat a process like a + function call. + + The other option is to run it as a task using `Nursery.start` – the enhanced version + of `~Nursery.start_soon` that lets a task pass back a value during startup:: + + process = await nursery.start(trio.run_process, ...) + + In this case, `~Nursery.start` returns a `Process` object that you can use + to interact with the process while it's running. Use this if you want to + treat a process like a background task. + + Either way, `run_process` makes sure that the process has exited before + returning, handles cancellation, optionally checks for errors, and + provides some convenient shorthands for dealing with the child's + input/output. + + **Input:** `run_process` supports all the same ``stdin=`` arguments as + `subprocess.Popen`. In addition, if you simply want to pass in some fixed + data, you can pass a plain `bytes` object, and `run_process` will take + care of setting up a pipe, feeding in the data you gave, and then sending + end-of-file. The default is ``b""``, which means that the child will receive + an empty stdin. If you want the child to instead read from the parent's + stdin, use ``stdin=None``. + + **Output:** By default, any output produced by the subprocess is + passed through to the standard output and error streams of the + parent Trio process. + + When calling `run_process` directly, you can capture the subprocess's output by + passing ``capture_stdout=True`` to capture the subprocess's standard output, and/or + ``capture_stderr=True`` to capture its standard error. Captured data is collected up + by Trio into an in-memory buffer, and then provided as the + :attr:`~subprocess.CompletedProcess.stdout` and/or + :attr:`~subprocess.CompletedProcess.stderr` attributes of the returned + :class:`~subprocess.CompletedProcess` object. The value for any stream that was not + captured will be ``None``. + + If you want to capture both stdout and stderr while keeping them + separate, pass ``capture_stdout=True, capture_stderr=True``. + + If you want to capture both stdout and stderr but mixed together + in the order they were printed, use: ``capture_stdout=True, stderr=subprocess.STDOUT``. + This directs the child's stderr into its stdout, so the combined + output will be available in the `~subprocess.CompletedProcess.stdout` + attribute. + + If you're using ``await nursery.start(trio.run_process, ...)`` and want to capture + the subprocess's output for further processing, then use ``stdout=subprocess.PIPE`` + and then make sure to read the data out of the `Process.stdout` stream. If you want + to capture stderr separately, use ``stderr=subprocess.PIPE``. If you want to capture + both, but mixed together in the correct order, use ``stdout=subprocess.PIPE, + stderr=subprocess.STDOUT``. + + **Error checking:** If the subprocess exits with a nonzero status + code, indicating failure, :func:`run_process` raises a + :exc:`subprocess.CalledProcessError` exception rather than + returning normally. The captured outputs are still available as + the :attr:`~subprocess.CalledProcessError.stdout` and + :attr:`~subprocess.CalledProcessError.stderr` attributes of that + exception. To disable this behavior, so that :func:`run_process` + returns normally even if the subprocess exits abnormally, pass ``check=False``. + + Note that this can make the ``capture_stdout`` and ``capture_stderr`` + arguments useful even when starting `run_process` as a task: if you only + care about the output if the process fails, then you can enable capturing + and then read the output off of the `~subprocess.CalledProcessError`. + + **Cancellation:** If cancelled, `run_process` sends a termination + request to the subprocess, then waits for it to fully exit. The + ``deliver_cancel`` argument lets you control how the process is terminated. + + .. note:: `run_process` is intentionally similar to the standard library + `subprocess.run`, but some of the defaults are different. Specifically, we + default to: + + - ``check=True``, because `"errors should never pass silently / unless + explicitly silenced" `__. + + - ``stdin=b""``, because it produces less-confusing results if a subprocess + unexpectedly tries to read from stdin. + + To get the `subprocess.run` semantics, use ``check=False, stdin=None``. + + Args: + command (list or str): The command to run. Typically this is a + sequence of strings such as ``['ls', '-l', 'directory with spaces']``, + where the first element names the executable to invoke and the other + elements specify its arguments. With ``shell=True`` in the + ``**options``, or on Windows, ``command`` may alternatively + be a string, which will be parsed following platform-dependent + :ref:`quoting rules `. + + stdin (:obj:`bytes`, subprocess.PIPE, file descriptor, or None): The + bytes to provide to the subprocess on its standard input stream, or + ``None`` if the subprocess's standard input should come from the + same place as the parent Trio process's standard input. As is the + case with the :mod:`subprocess` module, you can also pass a file + descriptor or an object with a ``fileno()`` method, in which case + the subprocess's standard input will come from that file. + + When starting `run_process` as a background task, you can also use + ``stdin=subprocess.PIPE``, in which case `Process.stdin` will be a + `~trio.abc.SendStream` that you can use to send data to the child. + + capture_stdout (bool): If true, capture the bytes that the subprocess + writes to its standard output stream and return them in the + `~subprocess.CompletedProcess.stdout` attribute of the returned + `subprocess.CompletedProcess` or `subprocess.CalledProcessError`. + + capture_stderr (bool): If true, capture the bytes that the subprocess + writes to its standard error stream and return them in the + `~subprocess.CompletedProcess.stderr` attribute of the returned + `~subprocess.CompletedProcess` or `subprocess.CalledProcessError`. + + check (bool): If false, don't validate that the subprocess exits + successfully. You should be sure to check the + ``returncode`` attribute of the returned object if you pass + ``check=False``, so that errors don't pass silently. + + deliver_cancel (async function or None): If `run_process` is cancelled, + then it needs to kill the child process. There are multiple ways to + do this, so we let you customize it. + + If you pass None (the default), then the behavior depends on the + platform: + + - On Windows, Trio calls ``TerminateProcess``, which should kill the + process immediately. + + - On Unix-likes, the default behavior is to send a ``SIGTERM``, wait + 5 seconds, and send a ``SIGKILL``. + + Alternatively, you can customize this behavior by passing in an + arbitrary async function, which will be called with the `Process` + object as an argument. For example, the default Unix behavior could + be implemented like this:: + + async def my_deliver_cancel(process): + process.send_signal(signal.SIGTERM) + await trio.sleep(5) + process.send_signal(signal.SIGKILL) + + When the process actually exits, the ``deliver_cancel`` function + will automatically be cancelled – so if the process exits after + ``SIGTERM``, then we'll never reach the ``SIGKILL``. + + In any case, `run_process` will always wait for the child process to + exit before raising `Cancelled`. + + **options: :func:`run_process` also accepts any :ref:`general subprocess + options ` and passes them on to the + :class:`~trio.Process` constructor. This includes the + ``stdout`` and ``stderr`` options, which provide additional + redirection possibilities such as ``stderr=subprocess.STDOUT``, + ``stdout=subprocess.DEVNULL``, or file descriptors. + + Returns: + + When called normally – a `subprocess.CompletedProcess` instance + describing the return code and outputs. + + When called via `Nursery.start` – a `trio.Process` instance. + + Raises: + UnicodeError: if ``stdin`` is specified as a Unicode string, rather + than bytes + ValueError: if multiple redirections are specified for the same + stream, e.g., both ``capture_stdout=True`` and + ``stdout=subprocess.DEVNULL`` + subprocess.CalledProcessError: if ``check=False`` is not passed + and the process exits with a nonzero exit status + OSError: if an error is encountered starting or communicating with + the process + ExceptionGroup: if exceptions occur in ``deliver_cancel``, + or when exceptions occur when communicating with the subprocess. + If strict_exception_groups is set to false in the global context, + which is deprecated, then single exceptions will be collapsed. + + .. note:: The child process runs in the same process group as the parent + Trio process, so a Ctrl+C will be delivered simultaneously to both + parent and child. If you don't want this behavior, consult your + platform's documentation for starting child processes in a different + process group. + + """ + + if isinstance(stdin, str): + raise UnicodeError("process stdin must be bytes, not str") + if task_status is trio.TASK_STATUS_IGNORED: + if stdin is subprocess.PIPE: + raise ValueError( + "stdout=subprocess.PIPE is only valid with nursery.start, " + "since that's the only way to access the pipe; use nursery.start " + "or pass the data you want to write directly", + ) + if options.get("stdout") is subprocess.PIPE: + raise ValueError( + "stdout=subprocess.PIPE is only valid with nursery.start, " + "since that's the only way to access the pipe", + ) + if options.get("stderr") is subprocess.PIPE: + raise ValueError( + "stderr=subprocess.PIPE is only valid with nursery.start, " + "since that's the only way to access the pipe", + ) + if isinstance(stdin, (bytes, bytearray, memoryview)): + input_ = stdin + options["stdin"] = subprocess.PIPE + else: + # stdin should be something acceptable to Process + # (None, DEVNULL, a file descriptor, etc) and Process + # will raise if it's not + input_ = None + options["stdin"] = stdin + + if capture_stdout: + if "stdout" in options: + raise ValueError("can't specify both stdout and capture_stdout") + options["stdout"] = subprocess.PIPE + if capture_stderr: + if "stderr" in options: + raise ValueError("can't specify both stderr and capture_stderr") + options["stderr"] = subprocess.PIPE + + if deliver_cancel is None: + if os.name == "nt": + deliver_cancel = _windows_deliver_cancel + else: + assert os.name == "posix" + deliver_cancel = _posix_deliver_cancel + + stdout_chunks: list[bytes | bytearray] = [] + stderr_chunks: list[bytes | bytearray] = [] + + async def feed_input(stream: SendStream) -> None: + async with stream: + try: + assert input_ is not None + await stream.send_all(input_) + except trio.BrokenResourceError: + pass + + async def read_output( + stream: ReceiveStream, + chunks: list[bytes | bytearray], + ) -> None: + async with stream: + async for chunk in stream: + chunks.append(chunk) # noqa: PERF401 + + # Opening the process does not need to be inside the nursery, so we put it outside + # so any exceptions get directly seen by users. + proc = await _open_process(command, **options) # type: ignore[arg-type] + async with trio.open_nursery() as nursery: + try: + if input_ is not None: + assert proc.stdin is not None + nursery.start_soon(feed_input, proc.stdin) + proc.stdin = None + proc.stdio = None + if capture_stdout: + assert proc.stdout is not None + nursery.start_soon(read_output, proc.stdout, stdout_chunks) + proc.stdout = None + proc.stdio = None + if capture_stderr: + assert proc.stderr is not None + nursery.start_soon(read_output, proc.stderr, stderr_chunks) + proc.stderr = None + task_status.started(proc) + await proc.wait() + except BaseException: + with trio.CancelScope(shield=True): + killer_cscope = trio.CancelScope(shield=True) + + async def killer() -> None: + with killer_cscope: + await deliver_cancel(proc) + + nursery.start_soon(killer) + await proc.wait() + killer_cscope.cancel(reason="trio internal implementation detail") + raise + + stdout = b"".join(stdout_chunks) if capture_stdout else None + stderr = b"".join(stderr_chunks) if capture_stderr else None + + if proc.returncode and check: + raise subprocess.CalledProcessError( + proc.returncode, + proc.args, + output=stdout, + stderr=stderr, + ) + else: + assert proc.returncode is not None + return subprocess.CompletedProcess(proc.args, proc.returncode, stdout, stderr) + + +# There's a lot of duplication here because type checkers don't +# have a good way to represent overloads that differ only +# slightly. A cheat sheet: +# +# - on Windows, command is Union[str, Sequence[str]]; +# on Unix, command is str if shell=True and Sequence[str] otherwise +# +# - on Windows, there are startupinfo and creationflags options; +# on Unix, there are preexec_fn, restore_signals, start_new_session, +# pass_fds, group (3.9+), extra_groups (3.9+), user (3.9+), +# umask (3.9+), pipesize (3.10+), process_group (3.11+) +# +# - run_process() has the signature of open_process() plus arguments +# capture_stdout, capture_stderr, check, deliver_cancel, the ability +# to pass bytes as stdin, and the ability to run in `nursery.start` + + +class GeneralProcessArgs(TypedDict, total=False): + """Arguments shared between all runs.""" + + stdout: int | HasFileno | None + stderr: int | HasFileno | None + close_fds: bool + cwd: StrOrBytesPath | None + env: Mapping[str, str] | None + executable: StrOrBytesPath | None + + +if TYPE_CHECKING: + if sys.platform == "win32": + + class WindowsProcessArgs(GeneralProcessArgs, total=False): + """Arguments shared between all Windows runs.""" + + shell: bool + startupinfo: subprocess.STARTUPINFO | None + creationflags: int + + async def open_process( + command: StrOrBytesPath | Sequence[StrOrBytesPath], + *, + stdin: int | HasFileno | None = None, + **kwargs: Unpack[WindowsProcessArgs], + ) -> trio.Process: + r"""Execute a child program in a new process. + + After construction, you can interact with the child process by writing data to its + `~trio.Process.stdin` stream (a `~trio.abc.SendStream`), reading data from its + `~trio.Process.stdout` and/or `~trio.Process.stderr` streams (both + `~trio.abc.ReceiveStream`\s), sending it signals using `~trio.Process.terminate`, + `~trio.Process.kill`, or `~trio.Process.send_signal`, and waiting for it to exit + using `~trio.Process.wait`. See `trio.Process` for details. + + Each standard stream is only available if you specify that a pipe should be created + for it. For example, if you pass ``stdin=subprocess.PIPE``, you can write to the + `~trio.Process.stdin` stream, else `~trio.Process.stdin` will be ``None``. + + Unlike `trio.run_process`, this function doesn't do any kind of automatic + management of the child process. It's up to you to implement whatever semantics you + want. + + Args: + command (list or str): The command to run. Typically this is a + sequence of strings such as ``['ls', '-l', 'directory with spaces']``, + where the first element names the executable to invoke and the other + elements specify its arguments. With ``shell=True`` in the + ``**options``, or on Windows, ``command`` may alternatively + be a string, which will be parsed following platform-dependent + :ref:`quoting rules `. + stdin: Specifies what the child process's standard input + stream should connect to: output written by the parent + (``subprocess.PIPE``), nothing (``subprocess.DEVNULL``), + or an open file (pass a file descriptor or something whose + ``fileno`` method returns one). If ``stdin`` is unspecified, + the child process will have the same standard input stream + as its parent. + stdout: Like ``stdin``, but for the child process's standard output + stream. + stderr: Like ``stdin``, but for the child process's standard error + stream. An additional value ``subprocess.STDOUT`` is supported, + which causes the child's standard output and standard error + messages to be intermixed on a single standard output stream, + attached to whatever the ``stdout`` option says to attach it to. + **options: Other :ref:`general subprocess options ` + are also accepted. + + Returns: + A new `trio.Process` object. + + Raises: + OSError: if the process spawning fails, for example because the + specified command could not be found. + + """ + ... + + async def run_process( + command: StrOrBytesPath | Sequence[StrOrBytesPath], + *, + task_status: TaskStatus[Process] = trio.TASK_STATUS_IGNORED, + stdin: bytes | bytearray | memoryview | int | HasFileno | None = None, + capture_stdout: bool = False, + capture_stderr: bool = False, + check: bool = True, + deliver_cancel: Callable[[Process], Awaitable[object]] | None = None, + **kwargs: Unpack[WindowsProcessArgs], + ) -> subprocess.CompletedProcess[bytes]: + """Run ``command`` in a subprocess and wait for it to complete. + + This function can be called in two different ways. + + One option is a direct call, like:: + + completed_process_info = await trio.run_process(...) + + In this case, it returns a :class:`subprocess.CompletedProcess` instance + describing the results. Use this if you want to treat a process like a + function call. + + The other option is to run it as a task using `Nursery.start` – the enhanced version + of `~Nursery.start_soon` that lets a task pass back a value during startup:: + + process = await nursery.start(trio.run_process, ...) + + In this case, `~Nursery.start` returns a `Process` object that you can use + to interact with the process while it's running. Use this if you want to + treat a process like a background task. + + Either way, `run_process` makes sure that the process has exited before + returning, handles cancellation, optionally checks for errors, and + provides some convenient shorthands for dealing with the child's + input/output. + + **Input:** `run_process` supports all the same ``stdin=`` arguments as + `subprocess.Popen`. In addition, if you simply want to pass in some fixed + data, you can pass a plain `bytes` object, and `run_process` will take + care of setting up a pipe, feeding in the data you gave, and then sending + end-of-file. The default is ``b""``, which means that the child will receive + an empty stdin. If you want the child to instead read from the parent's + stdin, use ``stdin=None``. + + **Output:** By default, any output produced by the subprocess is + passed through to the standard output and error streams of the + parent Trio process. + + When calling `run_process` directly, you can capture the subprocess's output by + passing ``capture_stdout=True`` to capture the subprocess's standard output, and/or + ``capture_stderr=True`` to capture its standard error. Captured data is collected up + by Trio into an in-memory buffer, and then provided as the + :attr:`~subprocess.CompletedProcess.stdout` and/or + :attr:`~subprocess.CompletedProcess.stderr` attributes of the returned + :class:`~subprocess.CompletedProcess` object. The value for any stream that was not + captured will be ``None``. + + If you want to capture both stdout and stderr while keeping them + separate, pass ``capture_stdout=True, capture_stderr=True``. + + If you want to capture both stdout and stderr but mixed together + in the order they were printed, use: ``capture_stdout=True, stderr=subprocess.STDOUT``. + This directs the child's stderr into its stdout, so the combined + output will be available in the `~subprocess.CompletedProcess.stdout` + attribute. + + If you're using ``await nursery.start(trio.run_process, ...)`` and want to capture + the subprocess's output for further processing, then use ``stdout=subprocess.PIPE`` + and then make sure to read the data out of the `Process.stdout` stream. If you want + to capture stderr separately, use ``stderr=subprocess.PIPE``. If you want to capture + both, but mixed together in the correct order, use ``stdout=subprocess.PIPE, + stderr=subprocess.STDOUT``. + + **Error checking:** If the subprocess exits with a nonzero status + code, indicating failure, :func:`run_process` raises a + :exc:`subprocess.CalledProcessError` exception rather than + returning normally. The captured outputs are still available as + the :attr:`~subprocess.CalledProcessError.stdout` and + :attr:`~subprocess.CalledProcessError.stderr` attributes of that + exception. To disable this behavior, so that :func:`run_process` + returns normally even if the subprocess exits abnormally, pass ``check=False``. + + Note that this can make the ``capture_stdout`` and ``capture_stderr`` + arguments useful even when starting `run_process` as a task: if you only + care about the output if the process fails, then you can enable capturing + and then read the output off of the `~subprocess.CalledProcessError`. + + **Cancellation:** If cancelled, `run_process` sends a termination + request to the subprocess, then waits for it to fully exit. The + ``deliver_cancel`` argument lets you control how the process is terminated. + + .. note:: `run_process` is intentionally similar to the standard library + `subprocess.run`, but some of the defaults are different. Specifically, we + default to: + + - ``check=True``, because `"errors should never pass silently / unless + explicitly silenced" `__. + + - ``stdin=b""``, because it produces less-confusing results if a subprocess + unexpectedly tries to read from stdin. + + To get the `subprocess.run` semantics, use ``check=False, stdin=None``. + + Args: + command (list or str): The command to run. Typically this is a + sequence of strings such as ``['ls', '-l', 'directory with spaces']``, + where the first element names the executable to invoke and the other + elements specify its arguments. With ``shell=True`` in the + ``**options``, or on Windows, ``command`` may alternatively + be a string, which will be parsed following platform-dependent + :ref:`quoting rules `. + + stdin (:obj:`bytes`, subprocess.PIPE, file descriptor, or None): The + bytes to provide to the subprocess on its standard input stream, or + ``None`` if the subprocess's standard input should come from the + same place as the parent Trio process's standard input. As is the + case with the :mod:`subprocess` module, you can also pass a file + descriptor or an object with a ``fileno()`` method, in which case + the subprocess's standard input will come from that file. + + When starting `run_process` as a background task, you can also use + ``stdin=subprocess.PIPE``, in which case `Process.stdin` will be a + `~trio.abc.SendStream` that you can use to send data to the child. + + capture_stdout (bool): If true, capture the bytes that the subprocess + writes to its standard output stream and return them in the + `~subprocess.CompletedProcess.stdout` attribute of the returned + `subprocess.CompletedProcess` or `subprocess.CalledProcessError`. + + capture_stderr (bool): If true, capture the bytes that the subprocess + writes to its standard error stream and return them in the + `~subprocess.CompletedProcess.stderr` attribute of the returned + `~subprocess.CompletedProcess` or `subprocess.CalledProcessError`. + + check (bool): If false, don't validate that the subprocess exits + successfully. You should be sure to check the + ``returncode`` attribute of the returned object if you pass + ``check=False``, so that errors don't pass silently. + + deliver_cancel (async function or None): If `run_process` is cancelled, + then it needs to kill the child process. There are multiple ways to + do this, so we let you customize it. + + If you pass None (the default), then the behavior depends on the + platform: + + - On Windows, Trio calls ``TerminateProcess``, which should kill the + process immediately. + + - On Unix-likes, the default behavior is to send a ``SIGTERM``, wait + 5 seconds, and send a ``SIGKILL``. + + Alternatively, you can customize this behavior by passing in an + arbitrary async function, which will be called with the `Process` + object as an argument. For example, the default Unix behavior could + be implemented like this:: + + async def my_deliver_cancel(process): + process.send_signal(signal.SIGTERM) + await trio.sleep(5) + process.send_signal(signal.SIGKILL) + + When the process actually exits, the ``deliver_cancel`` function + will automatically be cancelled – so if the process exits after + ``SIGTERM``, then we'll never reach the ``SIGKILL``. + + In any case, `run_process` will always wait for the child process to + exit before raising `Cancelled`. + + **options: :func:`run_process` also accepts any :ref:`general subprocess + options ` and passes them on to the + :class:`~trio.Process` constructor. This includes the + ``stdout`` and ``stderr`` options, which provide additional + redirection possibilities such as ``stderr=subprocess.STDOUT``, + ``stdout=subprocess.DEVNULL``, or file descriptors. + + Returns: + + When called normally – a `subprocess.CompletedProcess` instance + describing the return code and outputs. + + When called via `Nursery.start` – a `trio.Process` instance. + + Raises: + UnicodeError: if ``stdin`` is specified as a Unicode string, rather + than bytes + ValueError: if multiple redirections are specified for the same + stream, e.g., both ``capture_stdout=True`` and + ``stdout=subprocess.DEVNULL`` + subprocess.CalledProcessError: if ``check=False`` is not passed + and the process exits with a nonzero exit status + OSError: if an error is encountered starting or communicating with + the process + + .. note:: The child process runs in the same process group as the parent + Trio process, so a Ctrl+C will be delivered simultaneously to both + parent and child. If you don't want this behavior, consult your + platform's documentation for starting child processes in a different + process group. + + """ + ... + + else: # Unix + # pyright doesn't give any error about overloads missing docstrings as they're + # overloads. But might still be a problem for other static analyzers / docstring + # readers (?) + + class UnixProcessArgs3_9(GeneralProcessArgs, total=False): + """Arguments shared between all Unix runs.""" + + preexec_fn: Callable[[], object] | None + restore_signals: bool + start_new_session: bool + pass_fds: Sequence[int] + + # 3.9+ + group: str | int | None + extra_groups: Iterable[str | int] | None + user: str | int | None + umask: int + + class UnixProcessArgs3_10(UnixProcessArgs3_9, total=False): + """Arguments shared between all Unix runs on 3.10+.""" + + pipesize: int + + class UnixProcessArgs3_11(UnixProcessArgs3_10, total=False): + """Arguments shared between all Unix runs on 3.11+.""" + + process_group: int | None + + class UnixRunProcessMixin(TypedDict, total=False): + """Arguments unique to run_process on Unix.""" + + task_status: TaskStatus[Process] + capture_stdout: bool + capture_stderr: bool + check: bool + deliver_cancel: Callable[[Process], Awaitable[None]] | None + + # TODO: once https://github.com/python/mypy/issues/18692 is + # fixed, move the `UnixRunProcessArgs` definition down. + if sys.version_info >= (3, 11): + UnixProcessArgs = UnixProcessArgs3_11 + + class UnixRunProcessArgs(UnixProcessArgs3_11, UnixRunProcessMixin): + """Arguments for run_process on Unix with 3.11+""" + + elif sys.version_info >= (3, 10): + UnixProcessArgs = UnixProcessArgs3_10 + + class UnixRunProcessArgs(UnixProcessArgs3_10, UnixRunProcessMixin): + """Arguments for run_process on Unix with 3.10+""" + + else: + UnixProcessArgs = UnixProcessArgs3_9 + + class UnixRunProcessArgs(UnixProcessArgs3_9, UnixRunProcessMixin): + """Arguments for run_process on Unix with 3.9+""" + + @overload # type: ignore[no-overload-impl] + async def open_process( + command: StrOrBytesPath, + *, + stdin: int | HasFileno | None = None, + shell: Literal[True], + **kwargs: Unpack[UnixProcessArgs], + ) -> trio.Process: ... + + @overload + async def open_process( + command: Sequence[StrOrBytesPath], + *, + stdin: int | HasFileno | None = None, + shell: bool = False, + **kwargs: Unpack[UnixProcessArgs], + ) -> trio.Process: ... + + @overload # type: ignore[no-overload-impl] + async def run_process( + command: StrOrBytesPath, + *, + stdin: bytes | bytearray | memoryview | int | HasFileno | None = b"", + shell: Literal[True], + **kwargs: Unpack[UnixRunProcessArgs], + ) -> subprocess.CompletedProcess[bytes]: ... + + @overload + async def run_process( + command: Sequence[StrOrBytesPath], + *, + stdin: bytes | bytearray | memoryview | int | HasFileno | None = b"", + shell: bool = False, + **kwargs: Unpack[UnixRunProcessArgs], + ) -> subprocess.CompletedProcess[bytes]: ... + +else: + # At runtime, use the actual implementations. + open_process = _open_process + open_process.__name__ = open_process.__qualname__ = "open_process" + + run_process = _run_process + run_process.__name__ = run_process.__qualname__ = "run_process" diff --git a/contrib/python/trio/trio/_subprocess_platform/__init__.py b/contrib/python/trio/trio/_subprocess_platform/__init__.py new file mode 100644 index 000000000000..daa28d8cd2d7 --- /dev/null +++ b/contrib/python/trio/trio/_subprocess_platform/__init__.py @@ -0,0 +1,123 @@ +# Platform-specific subprocess bits'n'pieces. +from __future__ import annotations + +import os +import sys +from typing import TYPE_CHECKING + +import trio + +from .. import _core, _subprocess +from .._abc import ReceiveStream, SendStream # noqa: TC001 + +_wait_child_exiting_error: ImportError | None = None +_create_child_pipe_error: ImportError | None = None + + +if TYPE_CHECKING: + # internal types for the pipe representations used in type checking only + class ClosableSendStream(SendStream): + def close(self) -> None: ... + + class ClosableReceiveStream(ReceiveStream): + def close(self) -> None: ... + + +# Fallback versions of the functions provided -- implementations +# per OS are imported atop these at the bottom of the module. +async def wait_child_exiting(process: _subprocess.Process) -> None: + """Block until the child process managed by ``process`` is exiting. + + It is invalid to call this function if the process has already + been waited on; that is, ``process.returncode`` must be None. + + When this function returns, it indicates that a call to + :meth:`subprocess.Popen.wait` will immediately be able to + return the process's exit status. The actual exit status is not + consumed by this call, since :class:`~subprocess.Popen` wants + to be able to do that itself. + """ + raise NotImplementedError from _wait_child_exiting_error # pragma: no cover + + +def create_pipe_to_child_stdin() -> tuple[ClosableSendStream, int]: + """Create a new pipe suitable for sending data from this + process to the standard input of a child we're about to spawn. + + Returns: + A pair ``(trio_end, subprocess_end)`` where ``trio_end`` is a + :class:`~trio.abc.SendStream` and ``subprocess_end`` is + something suitable for passing as the ``stdin`` argument of + :class:`subprocess.Popen`. + """ + raise NotImplementedError from _create_child_pipe_error # pragma: no cover + + +def create_pipe_from_child_output() -> tuple[ClosableReceiveStream, int]: + """Create a new pipe suitable for receiving data into this + process from the standard output or error stream of a child + we're about to spawn. + + Returns: + A pair ``(trio_end, subprocess_end)`` where ``trio_end`` is a + :class:`~trio.abc.ReceiveStream` and ``subprocess_end`` is + something suitable for passing as the ``stdin`` argument of + :class:`subprocess.Popen`. + """ + raise NotImplementedError from _create_child_pipe_error # pragma: no cover + + +try: + if sys.platform == "win32": + from .windows import wait_child_exiting + elif sys.platform != "linux" and (TYPE_CHECKING or hasattr(_core, "wait_kevent")): + from .kqueue import wait_child_exiting + else: + # as it's an exported symbol, noqa'd + from .waitid import wait_child_exiting # noqa: F401 +except ImportError as ex: # pragma: no cover + _wait_child_exiting_error = ex + +try: + if TYPE_CHECKING: + # Not worth type checking these definitions + pass + + elif os.name == "posix": + + def create_pipe_to_child_stdin() -> tuple[trio.lowlevel.FdStream, int]: + rfd, wfd = os.pipe() + return trio.lowlevel.FdStream(wfd), rfd + + def create_pipe_from_child_output() -> tuple[trio.lowlevel.FdStream, int]: + rfd, wfd = os.pipe() + return trio.lowlevel.FdStream(rfd), wfd + + elif os.name == "nt": + import msvcrt + + # This isn't exported or documented, but it's also not + # underscore-prefixed, and seems kosher to use. The asyncio docs + # for 3.5 included an example that imported socketpair from + # windows_utils (before socket.socketpair existed on Windows), and + # when asyncio.windows_utils.socketpair was removed in 3.7, the + # removal was mentioned in the release notes. + from asyncio.windows_utils import pipe as windows_pipe + + from .._windows_pipes import PipeReceiveStream, PipeSendStream + + def create_pipe_to_child_stdin() -> tuple[PipeSendStream, int]: + # for stdin, we want the write end (our end) to use overlapped I/O + rh, wh = windows_pipe(overlapped=(False, True)) + return PipeSendStream(wh), msvcrt.open_osfhandle(rh, os.O_RDONLY) + + def create_pipe_from_child_output() -> tuple[PipeReceiveStream, int]: + # for stdout/err, it's the read end that's overlapped + rh, wh = windows_pipe(overlapped=(True, False)) + return PipeReceiveStream(rh), msvcrt.open_osfhandle(wh, 0) + + else: # pragma: no cover + raise ImportError("pipes not implemented on this platform") + +except ImportError as ex: # pragma: no cover + _create_child_pipe_error = ex diff --git a/contrib/python/trio/trio/_subprocess_platform/kqueue.py b/contrib/python/trio/trio/_subprocess_platform/kqueue.py new file mode 100644 index 000000000000..2283bb5360c7 --- /dev/null +++ b/contrib/python/trio/trio/_subprocess_platform/kqueue.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +import select +import sys +from typing import TYPE_CHECKING + +from .. import _core, _subprocess + +assert (sys.platform != "win32" and sys.platform != "linux") or not TYPE_CHECKING + + +async def wait_child_exiting(process: _subprocess.Process) -> None: + kqueue = _core.current_kqueue() + try: + from select import KQ_NOTE_EXIT + except ImportError: # pragma: no cover + # pypy doesn't define KQ_NOTE_EXIT: + # https://bitbucket.org/pypy/pypy/issues/2921/ + # I verified this value against both Darwin and FreeBSD + KQ_NOTE_EXIT = 0x80000000 + + def make_event(flags: int) -> select.kevent: + return select.kevent( + process.pid, + filter=select.KQ_FILTER_PROC, + flags=flags, + fflags=KQ_NOTE_EXIT, + ) + + try: + kqueue.control([make_event(select.KQ_EV_ADD | select.KQ_EV_ONESHOT)], 0) + except ProcessLookupError: # pragma: no cover + # This can supposedly happen if the process is in the process + # of exiting, and it can even be the case that kqueue says the + # process doesn't exist before waitpid(WNOHANG) says it hasn't + # exited yet. See the discussion in https://chromium.googlesource.com/ + # chromium/src/base/+/master/process/kill_mac.cc . + # We haven't actually seen this error occur since we added + # locking to prevent multiple calls to wait_child_exiting() + # for the same process simultaneously, but given the explanation + # in Chromium it seems we should still keep the check. + return + + def abort(_: _core.RaiseCancelT) -> _core.Abort: + kqueue.control([make_event(select.KQ_EV_DELETE)], 0) + return _core.Abort.SUCCEEDED + + await _core.wait_kevent(process.pid, select.KQ_FILTER_PROC, abort) diff --git a/contrib/python/trio/trio/_subprocess_platform/waitid.py b/contrib/python/trio/trio/_subprocess_platform/waitid.py new file mode 100644 index 000000000000..ebf83b48028f --- /dev/null +++ b/contrib/python/trio/trio/_subprocess_platform/waitid.py @@ -0,0 +1,113 @@ +import errno +import math +import os +import sys +from typing import TYPE_CHECKING + +from .. import _core, _subprocess +from .._sync import CapacityLimiter, Event +from .._threads import to_thread_run_sync + +assert (sys.platform != "win32" and sys.platform != "darwin") or not TYPE_CHECKING + +try: + from os import waitid + + def sync_wait_reapable(pid: int) -> None: + waitid(os.P_PID, pid, os.WEXITED | os.WNOWAIT) + +except ImportError: + # pypy doesn't define os.waitid so we need to pull it out ourselves + # using cffi: https://bitbucket.org/pypy/pypy/issues/2922/ + import cffi + + waitid_ffi = cffi.FFI() + + # Believe it or not, siginfo_t starts with fields in the + # same layout on both Linux and Darwin. The Linux structure + # is bigger so that's what we use to size `pad`; while + # there are a few extra fields in there, most of it is + # true padding which would not be written by the syscall. + waitid_ffi.cdef( + """ +typedef struct siginfo_s { + int si_signo; + int si_errno; + int si_code; + int si_pid; + int si_uid; + int si_status; + int pad[26]; +} siginfo_t; +int waitid(int idtype, int id, siginfo_t* result, int options); +""", + ) + waitid_cffi = waitid_ffi.dlopen(None).waitid # type: ignore[attr-defined] + + def sync_wait_reapable(pid: int) -> None: + P_PID = 1 + WEXITED = 0x00000004 + if sys.platform == "darwin": # pragma: no cover + # waitid() is not exposed on Python on Darwin but does + # work through CFFI; note that we typically won't get + # here since Darwin also defines kqueue + WNOWAIT = 0x00000020 + else: + WNOWAIT = 0x01000000 + result = waitid_ffi.new("siginfo_t *") + while waitid_cffi(P_PID, pid, result, WEXITED | WNOWAIT) < 0: + got_errno = waitid_ffi.errno + if got_errno == errno.EINTR: + continue + raise OSError(got_errno, os.strerror(got_errno)) + + +# adapted from +# https://github.com/python-trio/trio/issues/4#issuecomment-398967572 + +waitid_limiter = CapacityLimiter(math.inf) + + +async def _waitid_system_task(pid: int, event: Event) -> None: + """Spawn a thread that waits for ``pid`` to exit, then wake any tasks + that were waiting on it. + """ + # abandon_on_cancel=True: if this task is cancelled, then we abandon the + # thread to keep running waitpid in the background. Since this is + # always run as a system task, this will only happen if the whole + # call to trio.run is shutting down. + + try: + await to_thread_run_sync( + sync_wait_reapable, + pid, + abandon_on_cancel=True, + limiter=waitid_limiter, + ) + except OSError: + # If waitid fails, waitpid will fail too, so it still makes + # sense to wake up the callers of wait_process_exiting(). The + # most likely reason for this error in practice is a child + # exiting when wait() is not possible because SIGCHLD is + # ignored. + pass + finally: + event.set() + + +async def wait_child_exiting(process: "_subprocess.Process") -> None: + # Logic of this function: + # - The first time we get called, we create an Event and start + # an instance of _waitid_system_task that will set the Event + # when waitid() completes. If that Event is set before + # we get cancelled, we're good. + # - Otherwise, a following call after the cancellation must + # reuse the Event created during the first call, lest we + # create an arbitrary number of threads waiting on the same + # process. + + if process._wait_for_exit_data is None: + process._wait_for_exit_data = event = Event() + _core.spawn_system_task(_waitid_system_task, process.pid, event) + assert isinstance(process._wait_for_exit_data, Event) + await process._wait_for_exit_data.wait() diff --git a/contrib/python/trio/trio/_subprocess_platform/windows.py b/contrib/python/trio/trio/_subprocess_platform/windows.py new file mode 100644 index 000000000000..81fb960e4bb5 --- /dev/null +++ b/contrib/python/trio/trio/_subprocess_platform/windows.py @@ -0,0 +1,11 @@ +from typing import TYPE_CHECKING + +from .._wait_for_object import WaitForSingleObject + +if TYPE_CHECKING: + from .. import _subprocess + + +async def wait_child_exiting(process: "_subprocess.Process") -> None: + # _handle is not in Popen stubs, though it is present on Windows. + await WaitForSingleObject(int(process._proc._handle)) # type: ignore[attr-defined] diff --git a/contrib/python/trio/trio/_sync.py b/contrib/python/trio/trio/_sync.py new file mode 100644 index 000000000000..d026f4bc37ce --- /dev/null +++ b/contrib/python/trio/trio/_sync.py @@ -0,0 +1,908 @@ +from __future__ import annotations + +import math +from typing import TYPE_CHECKING, Literal, Protocol, TypeVar + +import attrs + +import trio + +from . import _core +from ._core import ( + Abort, + ParkingLot, + RaiseCancelT, + add_parking_lot_breaker, + enable_ki_protection, + remove_parking_lot_breaker, +) +from ._deprecate import warn_deprecated +from ._util import final + +if TYPE_CHECKING: + from collections.abc import Callable + from types import TracebackType + + from typing_extensions import deprecated + + from ._core import Task + from ._core._parking_lot import ParkingLotStatistics +else: + T = TypeVar("T") + + def deprecated( + message: str, + /, + *, + category: type[Warning] | None = DeprecationWarning, + stacklevel: int = 1, + ) -> Callable[[T], T]: + def wrapper(f: T) -> T: + return f + + return wrapper + + +@attrs.frozen +class EventStatistics: + """An object containing debugging information. + + Currently the following fields are defined: + + * ``tasks_waiting``: The number of tasks blocked on this event's + :meth:`trio.Event.wait` method. + + """ + + tasks_waiting: int + + +@final +@attrs.define(repr=False, eq=False) +class Event: + """A waitable boolean value useful for inter-task synchronization, + inspired by :class:`threading.Event`. + + An event object has an internal boolean flag, representing whether + the event has happened yet. The flag is initially False, and the + :meth:`wait` method waits until the flag is True. If the flag is + already True, then :meth:`wait` returns immediately. (If the event has + already happened, there's nothing to wait for.) The :meth:`set` method + sets the flag to True, and wakes up any waiters. + + This behavior is useful because it helps avoid race conditions and + lost wakeups: it doesn't matter whether :meth:`set` gets called just + before or after :meth:`wait`. If you want a lower-level wakeup + primitive that doesn't have this protection, consider :class:`Condition` + or :class:`trio.lowlevel.ParkingLot`. + + .. note:: Unlike `threading.Event`, `trio.Event` has no + `~threading.Event.clear` method. In Trio, once an `Event` has happened, + it cannot un-happen. If you need to represent a series of events, + consider creating a new `Event` object for each one (they're cheap!), + or other synchronization methods like :ref:`channels ` or + `trio.lowlevel.ParkingLot`. + + """ + + _tasks: set[Task] = attrs.field(factory=set, init=False) + _flag: bool = attrs.field(default=False, init=False) + + def is_set(self) -> bool: + """Return the current value of the internal flag.""" + return self._flag + + @enable_ki_protection + def set(self) -> None: + """Set the internal flag value to True, and wake any waiting tasks.""" + if not self._flag: + self._flag = True + for task in self._tasks: + _core.reschedule(task) + self._tasks.clear() + + async def wait(self) -> None: + """Block until the internal flag value becomes True. + + If it's already True, then this method returns immediately. + + """ + if self._flag: + await trio.lowlevel.checkpoint() + else: + task = _core.current_task() + self._tasks.add(task) + + def abort_fn(_: RaiseCancelT) -> Abort: + self._tasks.remove(task) + return _core.Abort.SUCCEEDED + + await _core.wait_task_rescheduled(abort_fn) + + def statistics(self) -> EventStatistics: + """Return an object containing debugging information. + + Currently the following fields are defined: + + * ``tasks_waiting``: The number of tasks blocked on this event's + :meth:`wait` method. + + """ + return EventStatistics(tasks_waiting=len(self._tasks)) + + @deprecated( + "trio.Event.__bool__ is deprecated since Trio 0.31.0; use trio.Event.is_set instead (https://github.com/python-trio/trio/issues/3238)", + stacklevel=2, + ) + def __bool__(self) -> Literal[True]: + """Return True and raise warning.""" + warn_deprecated( + self.__bool__, + "0.31.0", + issue=3238, + instead=self.is_set, + ) + return True + + +class _HasAcquireRelease(Protocol): + """Only classes with acquire() and release() can use the mixin's implementations.""" + + async def acquire(self) -> object: ... + + def release(self) -> object: ... + + +class AsyncContextManagerMixin: + @enable_ki_protection + async def __aenter__(self: _HasAcquireRelease) -> None: + await self.acquire() + + @enable_ki_protection + async def __aexit__( + self: _HasAcquireRelease, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self.release() + + +@attrs.frozen +class CapacityLimiterStatistics: + """An object containing debugging information. + + Currently the following fields are defined: + + * ``borrowed_tokens``: The number of tokens currently borrowed from + the sack. + * ``total_tokens``: The total number of tokens in the sack. Usually + this will be larger than ``borrowed_tokens``, but it's possibly for + it to be smaller if :attr:`trio.CapacityLimiter.total_tokens` was recently decreased. + * ``borrowers``: A list of all tasks or other entities that currently + hold a token. + * ``tasks_waiting``: The number of tasks blocked on this + :class:`CapacityLimiter`\'s :meth:`trio.CapacityLimiter.acquire` or + :meth:`trio.CapacityLimiter.acquire_on_behalf_of` methods. + + """ + + borrowed_tokens: int + total_tokens: int | float + borrowers: list[Task | object] + tasks_waiting: int + + +# Can be a generic type with a default of Task if/when PEP 696 is released +# and implemented in type checkers. Making it fully generic would currently +# introduce a lot of unnecessary hassle. +@final +class CapacityLimiter(AsyncContextManagerMixin): + """An object for controlling access to a resource with limited capacity. + + Sometimes you need to put a limit on how many tasks can do something at + the same time. For example, you might want to use some threads to run + multiple blocking I/O operations in parallel... but if you use too many + threads at once, then your system can become overloaded and it'll actually + make things slower. One popular solution is to impose a policy like "run + up to 40 threads at the same time, but no more". But how do you implement + a policy like this? + + That's what :class:`CapacityLimiter` is for. You can think of a + :class:`CapacityLimiter` object as a sack that starts out holding some fixed + number of tokens:: + + limit = trio.CapacityLimiter(40) + + Then tasks can come along and borrow a token out of the sack:: + + # Borrow a token: + async with limit: + # We are holding a token! + await perform_expensive_operation() + # Exiting the 'async with' block puts the token back into the sack + + And crucially, if you try to borrow a token but the sack is empty, then + you have to wait for another task to finish what it's doing and put its + token back first before you can take it and continue. + + Another way to think of it: a :class:`CapacityLimiter` is like a sofa with a + fixed number of seats, and if they're all taken then you have to wait for + someone to get up before you can sit down. + + By default, :func:`trio.to_thread.run_sync` uses a + :class:`CapacityLimiter` to limit the number of threads running at once; + see `trio.to_thread.current_default_thread_limiter` for details. + + If you're familiar with semaphores, then you can think of this as a + restricted semaphore that's specialized for one common use case, with + additional error checking. For a more traditional semaphore, see + :class:`Semaphore`. + + .. note:: + + Don't confuse this with the `"leaky bucket" + `__ or `"token bucket" + `__ algorithms used to + limit bandwidth usage on networks. The basic idea of using tokens to + track a resource limit is similar, but this is a very simple sack where + tokens aren't automatically created or destroyed over time; they're + just borrowed and then put back. + + """ + + # total_tokens would ideally be int|Literal[math.inf] - but that's not valid typing + def __init__(self, total_tokens: int | float) -> None: # noqa: PYI041 + self._lot = ParkingLot() + self._borrowers: set[Task | object] = set() + # Maps tasks attempting to acquire -> borrower, to handle on-behalf-of + self._pending_borrowers: dict[Task, Task | object] = {} + # invoke the property setter for validation + self.total_tokens: int | float = total_tokens + assert self._total_tokens == total_tokens + + def __repr__(self) -> str: + return f"" + + @property + def total_tokens(self) -> int | float: + """The total capacity available. + + You can change :attr:`total_tokens` by assigning to this attribute. If + you make it larger, then the appropriate number of waiting tasks will + be woken immediately to take the new tokens. If you decrease + total_tokens below the number of tasks that are currently using the + resource, then all current tasks will be allowed to finish as normal, + but no new tasks will be allowed in until the total number of tasks + drops below the new total_tokens. + + """ + return self._total_tokens + + @total_tokens.setter + def total_tokens(self, new_total_tokens: int | float) -> None: # noqa: PYI041 + if not isinstance(new_total_tokens, int) and new_total_tokens != math.inf: + raise TypeError("total_tokens must be an int or math.inf") + if new_total_tokens < 1: + raise ValueError("total_tokens must be >= 1") + self._total_tokens = new_total_tokens + self._wake_waiters() + + def _wake_waiters(self) -> None: + available = self._total_tokens - len(self._borrowers) + for woken in self._lot.unpark(count=available): + self._borrowers.add(self._pending_borrowers.pop(woken)) + + @property + def borrowed_tokens(self) -> int: + """The amount of capacity that's currently in use.""" + return len(self._borrowers) + + @property + def available_tokens(self) -> int | float: + """The amount of capacity that's available to use.""" + return self.total_tokens - self.borrowed_tokens + + @enable_ki_protection + def acquire_nowait(self) -> None: + """Borrow a token from the sack, without blocking. + + Raises: + WouldBlock: if no tokens are available. + RuntimeError: if the current task already holds one of this sack's + tokens. + + """ + self.acquire_on_behalf_of_nowait(trio.lowlevel.current_task()) + + @enable_ki_protection + def acquire_on_behalf_of_nowait(self, borrower: Task | object) -> None: + """Borrow a token from the sack on behalf of ``borrower``, without + blocking. + + Args: + borrower: A :class:`trio.lowlevel.Task` or arbitrary opaque object + used to record who is borrowing this token. This is used by + :func:`trio.to_thread.run_sync` to allow threads to "hold + tokens", with the intention in the future of using it to `allow + deadlock detection and other useful things + `__ + + Raises: + WouldBlock: if no tokens are available. + RuntimeError: if ``borrower`` already holds one of this sack's + tokens. + + """ + if borrower in self._borrowers: + raise RuntimeError( + "this borrower is already holding one of this CapacityLimiter's tokens", + ) + if len(self._borrowers) < self._total_tokens and not self._lot: + self._borrowers.add(borrower) + else: + raise trio.WouldBlock + + @enable_ki_protection + async def acquire(self) -> None: + """Borrow a token from the sack, blocking if necessary. + + Raises: + RuntimeError: if the current task already holds one of this sack's + tokens. + + """ + await self.acquire_on_behalf_of(trio.lowlevel.current_task()) + + @enable_ki_protection + async def acquire_on_behalf_of(self, borrower: Task | object) -> None: + """Borrow a token from the sack on behalf of ``borrower``, blocking if + necessary. + + Args: + borrower: A :class:`trio.lowlevel.Task` or arbitrary opaque object + used to record who is borrowing this token; see + :meth:`acquire_on_behalf_of_nowait` for details. + + Raises: + RuntimeError: if ``borrower`` task already holds one of this sack's + tokens. + + """ + await trio.lowlevel.checkpoint_if_cancelled() + try: + self.acquire_on_behalf_of_nowait(borrower) + except trio.WouldBlock: + task = trio.lowlevel.current_task() + self._pending_borrowers[task] = borrower + try: + await self._lot.park() + except trio.Cancelled: + self._pending_borrowers.pop(task) + raise + else: + await trio.lowlevel.cancel_shielded_checkpoint() + + @enable_ki_protection + def release(self) -> None: + """Put a token back into the sack. + + Raises: + RuntimeError: if the current task has not acquired one of this + sack's tokens. + + """ + self.release_on_behalf_of(trio.lowlevel.current_task()) + + @enable_ki_protection + def release_on_behalf_of(self, borrower: Task | object) -> None: + """Put a token back into the sack on behalf of ``borrower``. + + Raises: + RuntimeError: if the given borrower has not acquired one of this + sack's tokens. + + """ + if borrower not in self._borrowers: + raise RuntimeError( + "this borrower isn't holding any of this CapacityLimiter's tokens", + ) + self._borrowers.remove(borrower) + self._wake_waiters() + + def statistics(self) -> CapacityLimiterStatistics: + """Return an object containing debugging information. + + Currently the following fields are defined: + + * ``borrowed_tokens``: The number of tokens currently borrowed from + the sack. + * ``total_tokens``: The total number of tokens in the sack. Usually + this will be larger than ``borrowed_tokens``, but it's possibly for + it to be smaller if :attr:`total_tokens` was recently decreased. + * ``borrowers``: A list of all tasks or other entities that currently + hold a token. + * ``tasks_waiting``: The number of tasks blocked on this + :class:`CapacityLimiter`\'s :meth:`acquire` or + :meth:`acquire_on_behalf_of` methods. + + """ + return CapacityLimiterStatistics( + borrowed_tokens=len(self._borrowers), + total_tokens=self._total_tokens, + # Use a list instead of a frozenset just in case we start to allow + # one borrower to hold multiple tokens in the future + borrowers=list(self._borrowers), + tasks_waiting=len(self._lot), + ) + + +@final +class Semaphore(AsyncContextManagerMixin): + """A `semaphore `__. + + A semaphore holds an integer value, which can be incremented by + calling :meth:`release` and decremented by calling :meth:`acquire` – but + the value is never allowed to drop below zero. If the value is zero, then + :meth:`acquire` will block until someone calls :meth:`release`. + + If you're looking for a :class:`Semaphore` to limit the number of tasks + that can access some resource simultaneously, then consider using a + :class:`CapacityLimiter` instead. + + This object's interface is similar to, but different from, that of + :class:`threading.Semaphore`. + + A :class:`Semaphore` object can be used as an async context manager; it + blocks on entry but not on exit. + + Args: + initial_value (int): A non-negative integer giving semaphore's initial + value. + max_value (int or None): If given, makes this a "bounded" semaphore that + raises an error if the value is about to exceed the given + ``max_value``. + + """ + + def __init__(self, initial_value: int, *, max_value: int | None = None) -> None: + if not isinstance(initial_value, int): + raise TypeError("initial_value must be an int") + if initial_value < 0: + raise ValueError("initial value must be >= 0") + if max_value is not None: + if not isinstance(max_value, int): + raise TypeError("max_value must be None or an int") + if max_value < initial_value: + raise ValueError("max_values must be >= initial_value") + + # Invariants: + # bool(self._lot) implies self._value == 0 + # (or equivalently: self._value > 0 implies not self._lot) + self._lot = trio.lowlevel.ParkingLot() + self._value = initial_value + self._max_value = max_value + + def __repr__(self) -> str: + if self._max_value is None: + max_value_str = "" + else: + max_value_str = f", max_value={self._max_value}" + return f"" + + @property + def value(self) -> int: + """The current value of the semaphore.""" + return self._value + + @property + def max_value(self) -> int | None: + """The maximum allowed value. May be None to indicate no limit.""" + return self._max_value + + @enable_ki_protection + def acquire_nowait(self) -> None: + """Attempt to decrement the semaphore value, without blocking. + + Raises: + WouldBlock: if the value is zero. + + """ + if self._value > 0: + assert not self._lot + self._value -= 1 + else: + raise trio.WouldBlock + + @enable_ki_protection + async def acquire(self) -> None: + """Decrement the semaphore value, blocking if necessary to avoid + letting it drop below zero. + + """ + await trio.lowlevel.checkpoint_if_cancelled() + try: + self.acquire_nowait() + except trio.WouldBlock: + await self._lot.park() + else: + await trio.lowlevel.cancel_shielded_checkpoint() + + @enable_ki_protection + def release(self) -> None: + """Increment the semaphore value, possibly waking a task blocked in + :meth:`acquire`. + + Raises: + ValueError: if incrementing the value would cause it to exceed + :attr:`max_value`. + + """ + if self._lot: + assert self._value == 0 + self._lot.unpark(count=1) + else: + if self._max_value is not None and self._value == self._max_value: + raise ValueError("semaphore released too many times") + self._value += 1 + + def statistics(self) -> ParkingLotStatistics: + """Return an object containing debugging information. + + Currently the following fields are defined: + + * ``tasks_waiting``: The number of tasks blocked on this semaphore's + :meth:`acquire` method. + + """ + return self._lot.statistics() + + +@attrs.frozen +class LockStatistics: + """An object containing debugging information for a Lock. + + Currently the following fields are defined: + + * ``locked`` (boolean): indicating whether the lock is held. + * ``owner``: the :class:`trio.lowlevel.Task` currently holding the lock, + or None if the lock is not held. + * ``tasks_waiting`` (int): The number of tasks blocked on this lock's + :meth:`trio.Lock.acquire` method. + + """ + + locked: bool + owner: Task | None + tasks_waiting: int + + +@attrs.define(eq=False, repr=False, slots=False) +class _LockImpl(AsyncContextManagerMixin): + _lot: ParkingLot = attrs.field(factory=ParkingLot, init=False) + _owner: Task | None = attrs.field(default=None, init=False) + + def __repr__(self) -> str: + if self.locked(): + s1 = "locked" + s2 = f" with {len(self._lot)} waiters" + else: + s1 = "unlocked" + s2 = "" + return f"<{s1} {self.__class__.__name__} object at {id(self):#x}{s2}>" + + def locked(self) -> bool: + """Check whether the lock is currently held. + + Returns: + bool: True if the lock is held, False otherwise. + + """ + return self._owner is not None + + @enable_ki_protection + def acquire_nowait(self) -> None: + """Attempt to acquire the lock, without blocking. + + Raises: + WouldBlock: if the lock is held. + + """ + + task = trio.lowlevel.current_task() + if self._owner is task: + raise RuntimeError("attempt to re-acquire an already held Lock") + elif self._owner is None and not self._lot: + # No-one owns it + self._owner = task + add_parking_lot_breaker(task, self._lot) + else: + raise trio.WouldBlock + + @enable_ki_protection + async def acquire(self) -> None: + """Acquire the lock, blocking if necessary. + + Raises: + BrokenResourceError: if the owner of the lock exits without releasing. + """ + await trio.lowlevel.checkpoint_if_cancelled() + try: + self.acquire_nowait() + except trio.WouldBlock: + try: + # NOTE: it's important that the contended acquire path is just + # "_lot.park()", because that's how Condition.wait() acquires the + # lock as well. + await self._lot.park() + except trio.BrokenResourceError: + raise trio.BrokenResourceError( + f"Owner of this lock exited without releasing: {self._owner}", + ) from None + else: + await trio.lowlevel.cancel_shielded_checkpoint() + + @enable_ki_protection + def release(self) -> None: + """Release the lock. + + Raises: + RuntimeError: if the calling task does not hold the lock. + + """ + task = trio.lowlevel.current_task() + if task is not self._owner: + raise RuntimeError("can't release a Lock you don't own") + remove_parking_lot_breaker(self._owner, self._lot) + if self._lot: + (self._owner,) = self._lot.unpark(count=1) + add_parking_lot_breaker(self._owner, self._lot) + else: + self._owner = None + + def statistics(self) -> LockStatistics: + """Return an object containing debugging information. + + Currently the following fields are defined: + + * ``locked``: boolean indicating whether the lock is held. + * ``owner``: the :class:`trio.lowlevel.Task` currently holding the lock, + or None if the lock is not held. + * ``tasks_waiting``: The number of tasks blocked on this lock's + :meth:`acquire` method. + + """ + return LockStatistics( + locked=self.locked(), + owner=self._owner, + tasks_waiting=len(self._lot), + ) + + +@final +class Lock(_LockImpl): + """A classic `mutex + `__. + + This is a non-reentrant, single-owner lock. Unlike + :class:`threading.Lock`, only the owner of the lock is allowed to release + it. + + A :class:`Lock` object can be used as an async context manager; it + blocks on entry but not on exit. + + """ + + +@final +class StrictFIFOLock(_LockImpl): + r"""A variant of :class:`Lock` where tasks are guaranteed to acquire the + lock in strict first-come-first-served order. + + An example of when this is useful is if you're implementing something like + :class:`trio.SSLStream` or an HTTP/2 server using `h2 + `__, where you have multiple concurrent + tasks that are interacting with a shared state machine, and at + unpredictable moments the state machine requests that a chunk of data be + sent over the network. (For example, when using h2 simply reading incoming + data can occasionally `create outgoing data to send + `__.) The challenge is to make + sure that these chunks are sent in the correct order, without being + garbled. + + One option would be to use a regular :class:`Lock`, and wrap it around + every interaction with the state machine:: + + # This approach is sometimes workable but often sub-optimal; see below + async with lock: + state_machine.do_something() + if state_machine.has_data_to_send(): + await conn.sendall(state_machine.get_data_to_send()) + + But this can be problematic. If you're using h2 then *usually* reading + incoming data doesn't create the need to send any data, so we don't want + to force every task that tries to read from the network to sit and wait + a potentially long time for ``sendall`` to finish. And in some situations + this could even potentially cause a deadlock, if the remote peer is + waiting for you to read some data before it accepts the data you're + sending. + + :class:`StrictFIFOLock` provides an alternative. We can rewrite our + example like:: + + # Note: no awaits between when we start using the state machine and + # when we block to take the lock! + state_machine.do_something() + if state_machine.has_data_to_send(): + # Notice that we fetch the data to send out of the state machine + # *before* sleeping, so that other tasks won't see it. + chunk = state_machine.get_data_to_send() + async with strict_fifo_lock: + await conn.sendall(chunk) + + First we do all our interaction with the state machine in a single + scheduling quantum (notice there are no ``await``\s in there), so it's + automatically atomic with respect to other tasks. And then if and only if + we have data to send, we get in line to send it – and + :class:`StrictFIFOLock` guarantees that each task will send its data in + the same order that the state machine generated it. + + Currently, :class:`StrictFIFOLock` is identical to :class:`Lock`, + but (a) this may not always be true in the future, especially if Trio ever + implements `more sophisticated scheduling policies + `__, and (b) the above code + is relying on a pretty subtle property of its lock. Using a + :class:`StrictFIFOLock` acts as an executable reminder that you're relying + on this property. + + """ + + +@attrs.frozen +class ConditionStatistics: + r"""An object containing debugging information for a Condition. + + Currently the following fields are defined: + + * ``tasks_waiting`` (int): The number of tasks blocked on this condition's + :meth:`trio.Condition.wait` method. + * ``lock_statistics``: The result of calling the underlying + :class:`Lock`\s :meth:`~Lock.statistics` method. + + """ + + tasks_waiting: int + lock_statistics: LockStatistics + + +@final +class Condition(AsyncContextManagerMixin): + """A classic `condition variable + `__, similar to + :class:`threading.Condition`. + + A :class:`Condition` object can be used as an async context manager to + acquire the underlying lock; it blocks on entry but not on exit. + + Args: + lock (Lock): the lock object to use. If given, must be a + :class:`trio.Lock`. If None, a new :class:`Lock` will be allocated + and used. + + """ + + def __init__(self, lock: Lock | None = None) -> None: + if lock is None: + lock = Lock() + if type(lock) is not Lock: + raise TypeError("lock must be a trio.Lock") + self._lock = lock + self._lot = trio.lowlevel.ParkingLot() + + def locked(self) -> bool: + """Check whether the underlying lock is currently held. + + Returns: + bool: True if the lock is held, False otherwise. + + """ + return self._lock.locked() + + def acquire_nowait(self) -> None: + """Attempt to acquire the underlying lock, without blocking. + + Raises: + WouldBlock: if the lock is currently held. + + """ + return self._lock.acquire_nowait() + + async def acquire(self) -> None: + """Acquire the underlying lock, blocking if necessary. + + Raises: + BrokenResourceError: if the owner of the underlying lock exits without releasing. + """ + await self._lock.acquire() + + def release(self) -> None: + """Release the underlying lock.""" + self._lock.release() + + @enable_ki_protection + async def wait(self) -> None: + """Wait for another task to call :meth:`notify` or + :meth:`notify_all`. + + When calling this method, you must hold the lock. It releases the lock + while waiting, and then re-acquires it before waking up. + + There is a subtlety with how this method interacts with cancellation: + when cancelled it will block to re-acquire the lock before raising + :exc:`Cancelled`. This may cause cancellation to be less prompt than + expected. The advantage is that it makes code like this work:: + + async with condition: + await condition.wait() + + If we didn't re-acquire the lock before waking up, and :meth:`wait` + were cancelled here, then we'd crash in ``condition.__aexit__`` when + we tried to release the lock we no longer held. + + Raises: + RuntimeError: if the calling task does not hold the lock. + BrokenResourceError: if the owner of the lock exits without releasing, when attempting to re-acquire. + + """ + if trio.lowlevel.current_task() is not self._lock._owner: + raise RuntimeError("must hold the lock to wait") + self.release() + # NOTE: we go to sleep on self._lot, but we'll wake up on + # self._lock._lot. That's all that's required to acquire a Lock. + try: + await self._lot.park() + except: + with trio.CancelScope(shield=True): + await self.acquire() + raise + + def notify(self, n: int = 1) -> None: + """Wake one or more tasks that are blocked in :meth:`wait`. + + Args: + n (int): The number of tasks to wake. + + Raises: + RuntimeError: if the calling task does not hold the lock. + + """ + if trio.lowlevel.current_task() is not self._lock._owner: + raise RuntimeError("must hold the lock to notify") + self._lot.repark(self._lock._lot, count=n) + + def notify_all(self) -> None: + """Wake all tasks that are currently blocked in :meth:`wait`. + + Raises: + RuntimeError: if the calling task does not hold the lock. + + """ + if trio.lowlevel.current_task() is not self._lock._owner: + raise RuntimeError("must hold the lock to notify") + self._lot.repark_all(self._lock._lot) + + def statistics(self) -> ConditionStatistics: + r"""Return an object containing debugging information. + + Currently the following fields are defined: + + * ``tasks_waiting``: The number of tasks blocked on this condition's + :meth:`wait` method. + * ``lock_statistics``: The result of calling the underlying + :class:`Lock`\s :meth:`~Lock.statistics` method. + + """ + return ConditionStatistics( + tasks_waiting=len(self._lot), + lock_statistics=self._lock.statistics(), + ) diff --git a/contrib/python/trio/trio/_threads.py b/contrib/python/trio/trio/_threads.py new file mode 100644 index 000000000000..4b1e54f54025 --- /dev/null +++ b/contrib/python/trio/trio/_threads.py @@ -0,0 +1,610 @@ +from __future__ import annotations + +import contextlib +import contextvars +import inspect +import queue as stdlib_queue +import threading +from itertools import count +from typing import TYPE_CHECKING, Generic, TypeVar + +import attrs +import outcome +from attrs import define +from sniffio import current_async_library_cvar + +import trio + +from ._core import ( + RunVar, + TrioToken, + checkpoint, + disable_ki_protection, + enable_ki_protection, + start_thread_soon, +) +from ._sync import CapacityLimiter, Event +from ._util import coroutine_or_error + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable, Generator + + from typing_extensions import TypeVarTuple, Unpack + + from trio._core._traps import RaiseCancelT + + Ts = TypeVarTuple("Ts") + +RetT = TypeVar("RetT") + + +class _ParentTaskData(threading.local): + """Global due to Threading API, thread local storage for data related to the + parent task of native Trio threads.""" + + token: TrioToken + abandon_on_cancel: bool + cancel_register: list[RaiseCancelT | None] + task_register: list[trio.lowlevel.Task | None] + + +PARENT_TASK_DATA = _ParentTaskData() + +_limiter_local: RunVar[CapacityLimiter] = RunVar("limiter") +# I pulled this number out of the air; it isn't based on anything. Probably we +# should make some kind of measurements to pick a good value. +DEFAULT_LIMIT = 40 +_thread_counter = count() + + +@define +class _ActiveThreadCount: + count: int + event: Event + + +_active_threads_local: RunVar[_ActiveThreadCount] = RunVar("active_threads") + + +@contextlib.contextmanager +def _track_active_thread() -> Generator[None, None, None]: + try: + active_threads_local = _active_threads_local.get() + except LookupError: + active_threads_local = _ActiveThreadCount(0, Event()) + _active_threads_local.set(active_threads_local) + + active_threads_local.count += 1 + try: + yield + finally: + active_threads_local.count -= 1 + if active_threads_local.count == 0: + active_threads_local.event.set() + active_threads_local.event = Event() + + +async def wait_all_threads_completed() -> None: + """Wait until no threads are still running tasks. + + This is intended to be used when testing code with trio.to_thread to + make sure no tasks are still making progress in a thread. See the + following code for a usage example:: + + async def wait_all_settled(): + while True: + await trio.testing.wait_all_threads_complete() + await trio.testing.wait_all_tasks_blocked() + if trio.testing.active_thread_count() == 0: + break + """ + + await checkpoint() + + try: + active_threads_local = _active_threads_local.get() + except LookupError: + # If there would have been active threads, the + # _active_threads_local would have been set + return + + while active_threads_local.count != 0: + await active_threads_local.event.wait() + + +def active_thread_count() -> int: + """Returns the number of threads that are currently running a task + + See `trio.testing.wait_all_threads_completed` + """ + try: + return _active_threads_local.get().count + except LookupError: + return 0 + + +def current_default_thread_limiter() -> CapacityLimiter: + """Get the default `~trio.CapacityLimiter` used by + `trio.to_thread.run_sync`. + + The most common reason to call this would be if you want to modify its + :attr:`~trio.CapacityLimiter.total_tokens` attribute. + + """ + try: + limiter = _limiter_local.get() + except LookupError: + limiter = CapacityLimiter(DEFAULT_LIMIT) + _limiter_local.set(limiter) + return limiter + + +# Eventually we might build this into a full-fledged deadlock-detection +# system; see https://github.com/python-trio/trio/issues/182 +# But for now we just need an object to stand in for the thread, so we can +# keep track of who's holding the CapacityLimiter's token. +@attrs.frozen(eq=False, slots=False) +class ThreadPlaceholder: + name: str + + +# Types for the to_thread_run_sync message loop +@attrs.frozen(eq=False, slots=False) +class Run(Generic[RetT]): # type: ignore[explicit-any] + afn: Callable[..., Awaitable[RetT]] # type: ignore[explicit-any] + args: tuple[object, ...] + context: contextvars.Context = attrs.field( + init=False, + factory=contextvars.copy_context, + ) + queue: stdlib_queue.SimpleQueue[outcome.Outcome[RetT]] = attrs.field( + init=False, + factory=stdlib_queue.SimpleQueue, + ) + + @disable_ki_protection + async def unprotected_afn(self) -> RetT: + coro = coroutine_or_error(self.afn, *self.args) + return await coro + + async def run(self) -> None: + # we use extra checkpoints to pick up and reset any context changes + task = trio.lowlevel.current_task() + old_context = task.context + task.context = self.context.copy() + await trio.lowlevel.cancel_shielded_checkpoint() + result = await outcome.acapture(self.unprotected_afn) + task.context = old_context + await trio.lowlevel.cancel_shielded_checkpoint() + self.queue.put_nowait(result) + + async def run_system(self) -> None: + result = await outcome.acapture(self.unprotected_afn) + self.queue.put_nowait(result) + + def run_in_host_task(self, token: TrioToken) -> None: + task_register = PARENT_TASK_DATA.task_register + + def in_trio_thread() -> None: + task = task_register[0] + assert task is not None, "guaranteed by abandon_on_cancel semantics" + trio.lowlevel.reschedule(task, outcome.Value(self)) + + token.run_sync_soon(in_trio_thread) + + def run_in_system_nursery(self, token: TrioToken) -> None: + def in_trio_thread() -> None: + try: + trio.lowlevel.spawn_system_task( + self.run_system, + name=self.afn, + context=self.context, + ) + except RuntimeError: # system nursery is closed + self.queue.put_nowait( + outcome.Error(trio.RunFinishedError("system nursery is closed")), + ) + + token.run_sync_soon(in_trio_thread) + + +@attrs.frozen(eq=False, slots=False) +class RunSync(Generic[RetT]): # type: ignore[explicit-any] + fn: Callable[..., RetT] # type: ignore[explicit-any] + args: tuple[object, ...] + context: contextvars.Context = attrs.field( + init=False, + factory=contextvars.copy_context, + ) + queue: stdlib_queue.SimpleQueue[outcome.Outcome[RetT]] = attrs.field( + init=False, + factory=stdlib_queue.SimpleQueue, + ) + + @disable_ki_protection + def unprotected_fn(self) -> RetT: + ret = self.context.run(self.fn, *self.args) + + if inspect.iscoroutine(ret): + # Manually close coroutine to avoid RuntimeWarnings + ret.close() + raise TypeError( + "Trio expected a synchronous function, but {!r} appears to be " + "asynchronous".format(getattr(self.fn, "__qualname__", self.fn)), + ) + + return ret + + def run_sync(self) -> None: + result = outcome.capture(self.unprotected_fn) + self.queue.put_nowait(result) + + def run_in_host_task(self, token: TrioToken) -> None: + task_register = PARENT_TASK_DATA.task_register + + def in_trio_thread() -> None: + task = task_register[0] + assert task is not None, "guaranteed by abandon_on_cancel semantics" + trio.lowlevel.reschedule(task, outcome.Value(self)) + + token.run_sync_soon(in_trio_thread) + + def run_in_system_nursery(self, token: TrioToken) -> None: + token.run_sync_soon(self.run_sync) + + +@enable_ki_protection +async def to_thread_run_sync( + sync_fn: Callable[[Unpack[Ts]], RetT], + *args: Unpack[Ts], + thread_name: str | None = None, + abandon_on_cancel: bool = False, + limiter: CapacityLimiter | None = None, +) -> RetT: + """Convert a blocking operation into an async operation using a thread. + + These two lines are equivalent:: + + sync_fn(*args) + await trio.to_thread.run_sync(sync_fn, *args) + + except that if ``sync_fn`` takes a long time, then the first line will + block the Trio loop while it runs, while the second line allows other Trio + tasks to continue working while ``sync_fn`` runs. This is accomplished by + pushing the call to ``sync_fn(*args)`` off into a worker thread. + + From inside the worker thread, you can get back into Trio using the + functions in `trio.from_thread`. + + Args: + sync_fn: An arbitrary synchronous callable. + *args: Positional arguments to pass to sync_fn. If you need keyword + arguments, use :func:`functools.partial`. + abandon_on_cancel (bool): Whether to abandon this thread upon + cancellation of this operation. See discussion below. + thread_name (str): Optional string to set the name of the thread. + Will always set `threading.Thread.name`, but only set the os name + if pthread.h is available (i.e. most POSIX installations). + pthread names are limited to 15 characters, and can be read from + ``/proc//task//comm`` or with ``ps -eT``, among others. + Defaults to ``{sync_fn.__name__|None} from {trio.lowlevel.current_task().name}``. + limiter (None, or CapacityLimiter-like object): + An object used to limit the number of simultaneous threads. Most + commonly this will be a `~trio.CapacityLimiter`, but it could be + anything providing compatible + :meth:`~trio.CapacityLimiter.acquire_on_behalf_of` and + :meth:`~trio.CapacityLimiter.release_on_behalf_of` methods. This + function will call ``acquire_on_behalf_of`` before starting the + thread, and ``release_on_behalf_of`` after the thread has finished. + + If None (the default), uses the default `~trio.CapacityLimiter`, as + returned by :func:`current_default_thread_limiter`. + + **Cancellation handling**: Cancellation is a tricky issue here, because + neither Python nor the operating systems it runs on provide any general + mechanism for cancelling an arbitrary synchronous function running in a + thread. This function will always check for cancellation on entry, before + starting the thread. But once the thread is running, there are two ways it + can handle being cancelled: + + * If ``abandon_on_cancel=False``, the function ignores the cancellation and + keeps going, just like if we had called ``sync_fn`` synchronously. This + is the default behavior. + + * If ``abandon_on_cancel=True``, then this function immediately raises + `~trio.Cancelled`. In this case **the thread keeps running in + background** – we just abandon it to do whatever it's going to do, and + silently discard any return value or errors that it raises. Only use + this if you know that the operation is safe and side-effect free. (For + example: :func:`trio.socket.getaddrinfo` uses a thread with + ``abandon_on_cancel=True``, because it doesn't really affect anything if a + stray hostname lookup keeps running in the background.) + + The ``limiter`` is only released after the thread has *actually* + finished – which in the case of cancellation may be some time after this + function has returned. If :func:`trio.run` finishes before the thread + does, then the limiter release method will never be called at all. + + .. warning:: + + You should not use this function to call long-running CPU-bound + functions! In addition to the usual GIL-related reasons why using + threads for CPU-bound work is not very effective in Python, there is an + additional problem: on CPython, `CPU-bound threads tend to "starve out" + IO-bound threads `__, so using + threads for CPU-bound work is likely to adversely affect the main + thread running Trio. If you need to do this, you're better off using a + worker process, or perhaps PyPy (which still has a GIL, but may do a + better job of fairly allocating CPU time between threads). + + Returns: + Whatever ``sync_fn(*args)`` returns. + + Raises: + Exception: Whatever ``sync_fn(*args)`` raises. + + """ + await trio.lowlevel.checkpoint_if_cancelled() + # raise early if abandon_on_cancel.__bool__ raises + # and give a new name to ensure mypy knows it's never None + abandon_bool = bool(abandon_on_cancel) + if limiter is None: + limiter = current_default_thread_limiter() + + # Holds a reference to the task that's blocked in this function waiting + # for the result – or None if this function was cancelled and we should + # discard the result. + task_register: list[trio.lowlevel.Task | None] = [trio.lowlevel.current_task()] + # Holds a reference to the raise_cancel function provided if a cancellation + # is attempted against this task - or None if no such delivery has happened. + cancel_register: list[RaiseCancelT | None] = [None] # type: ignore[assignment] + name = f"trio.to_thread.run_sync-{next(_thread_counter)}" + placeholder = ThreadPlaceholder(name) + + # This function gets scheduled into the Trio run loop to deliver the + # thread's result. + def report_back_in_trio_thread_fn(result: outcome.Outcome[RetT]) -> None: + def do_release_then_return_result() -> RetT: + # release_on_behalf_of is an arbitrary user-defined method, so it + # might raise an error. If it does, we want that error to + # replace the regular return value, and if the regular return was + # already an exception then we want them to chain. + try: + return result.unwrap() + finally: + limiter.release_on_behalf_of(placeholder) + + result = outcome.capture(do_release_then_return_result) + if task_register[0] is not None: + trio.lowlevel.reschedule(task_register[0], outcome.Value(result)) + + current_trio_token = trio.lowlevel.current_trio_token() + + if thread_name is None: + thread_name = f"{getattr(sync_fn, '__name__', None)} from {trio.lowlevel.current_task().name}" + + def worker_fn() -> RetT: + PARENT_TASK_DATA.token = current_trio_token + PARENT_TASK_DATA.abandon_on_cancel = abandon_bool + PARENT_TASK_DATA.cancel_register = cancel_register + PARENT_TASK_DATA.task_register = task_register + try: + ret = context.run(sync_fn, *args) + + if inspect.iscoroutine(ret): + # Manually close coroutine to avoid RuntimeWarnings + ret.close() + raise TypeError( + "Trio expected a sync function, but {!r} appears to be " + "asynchronous".format(getattr(sync_fn, "__qualname__", sync_fn)), + ) + + return ret + finally: + del PARENT_TASK_DATA.token + del PARENT_TASK_DATA.abandon_on_cancel + del PARENT_TASK_DATA.cancel_register + del PARENT_TASK_DATA.task_register + + context = contextvars.copy_context() + # Trio doesn't use current_async_library_cvar, but if someone + # else set it, it would now shine through since + # sniffio.thread_local isn't set in the new thread. Make sure + # the new thread sees that it's not running in async context. + context.run(current_async_library_cvar.set, None) + + def deliver_worker_fn_result(result: outcome.Outcome[RetT]) -> None: + # If the entire run finished, the task we're trying to contact is + # certainly long gone -- it must have been cancelled and abandoned + # us. Just ignore the error in this case. + with contextlib.suppress(trio.RunFinishedError): + current_trio_token.run_sync_soon(report_back_in_trio_thread_fn, result) + + await limiter.acquire_on_behalf_of(placeholder) + with _track_active_thread(): + try: + start_thread_soon(worker_fn, deliver_worker_fn_result, thread_name) + except: + limiter.release_on_behalf_of(placeholder) + raise + + def abort(raise_cancel: RaiseCancelT) -> trio.lowlevel.Abort: + # fill so from_thread_check_cancelled can raise + # 'raise_cancel' will immediately delete its reason object, so we make + # a copy in each thread + cancel_register[0] = raise_cancel + if abandon_bool: + # empty so report_back_in_trio_thread_fn cannot reschedule + task_register[0] = None + return trio.lowlevel.Abort.SUCCEEDED + else: + return trio.lowlevel.Abort.FAILED + + while True: + # wait_task_rescheduled return value cannot be typed + msg_from_thread: outcome.Outcome[RetT] | Run[object] | RunSync[object] = ( + await trio.lowlevel.wait_task_rescheduled(abort) + ) + if isinstance(msg_from_thread, outcome.Outcome): + return msg_from_thread.unwrap() + elif isinstance(msg_from_thread, Run): + await msg_from_thread.run() + elif isinstance(msg_from_thread, RunSync): + msg_from_thread.run_sync() + else: # pragma: no cover, internal debugging guard TODO: use assert_never + raise TypeError( + f"trio.to_thread.run_sync received unrecognized thread message {msg_from_thread!r}.", + ) + del msg_from_thread + + +def from_thread_check_cancelled() -> None: + """Raise `trio.Cancelled` if the associated Trio task entered a cancelled status. + + Only applicable to threads spawned by `trio.to_thread.run_sync`. Poll to allow + ``abandon_on_cancel=False`` threads to raise :exc:`~trio.Cancelled` at a suitable + place, or to end abandoned ``abandon_on_cancel=True`` threads sooner than they may + otherwise. + + Raises: + Cancelled: If the corresponding call to `trio.to_thread.run_sync` has had a + delivery of cancellation attempted against it, regardless of the value of + ``abandon_on_cancel`` supplied as an argument to it. + RuntimeError: If this thread is not spawned from `trio.to_thread.run_sync`. + + .. note:: + + To be precise, :func:`~trio.from_thread.check_cancelled` checks whether the task + running :func:`trio.to_thread.run_sync` has ever been cancelled since the last + time it was running a :func:`trio.from_thread.run` or :func:`trio.from_thread.run_sync` + function. It may raise `trio.Cancelled` even if a cancellation occurred that was + later hidden by a modification to `trio.CancelScope.shield` between the cancelled + `~trio.CancelScope` and :func:`trio.to_thread.run_sync`. This differs from the + behavior of normal Trio checkpoints, which raise `~trio.Cancelled` only if the + cancellation is still active when the checkpoint executes. The distinction here is + *exceedingly* unlikely to be relevant to your application, but we mention it + for completeness. + """ + try: + raise_cancel = PARENT_TASK_DATA.cancel_register[0] + except AttributeError: + raise RuntimeError( + "this thread wasn't created by Trio, can't check for cancellation", + ) from None + if raise_cancel is not None: + raise_cancel() + + +def _send_message_to_trio( + trio_token: TrioToken | None, + message_to_trio: Run[RetT] | RunSync[RetT], +) -> RetT: + """Shared logic of from_thread functions""" + token_provided = trio_token is not None + + if not token_provided: + try: + trio_token = PARENT_TASK_DATA.token + except AttributeError: + raise RuntimeError( + "this thread wasn't created by Trio, pass kwarg trio_token=...", + ) from None + elif not isinstance(trio_token, TrioToken): + raise RuntimeError("Passed kwarg trio_token is not of type TrioToken") + + # Avoid deadlock by making sure we're not called from Trio thread + try: + trio.lowlevel.current_task() + except RuntimeError: + pass + else: + raise RuntimeError("this is a blocking function; call it from a thread") + + if token_provided or PARENT_TASK_DATA.abandon_on_cancel: + message_to_trio.run_in_system_nursery(trio_token) + else: + message_to_trio.run_in_host_task(trio_token) + + return message_to_trio.queue.get().unwrap() + + +def from_thread_run( + afn: Callable[[Unpack[Ts]], Awaitable[RetT]], + *args: Unpack[Ts], + trio_token: TrioToken | None = None, +) -> RetT: + """Run the given async function in the parent Trio thread, blocking until it + is complete. + + Returns: + Whatever ``afn(*args)`` returns. + + Returns or raises whatever the given function returns or raises. It + can also raise exceptions of its own: + + Raises: + RunFinishedError: if the corresponding call to :func:`trio.run` has + already completed, or if the run has started its final cleanup phase + and can no longer spawn new system tasks. + Cancelled: If the original call to :func:`trio.to_thread.run_sync` is cancelled + (if *trio_token* is None) or the call to :func:`trio.run` completes + (if *trio_token* is not None) while ``afn(*args)`` is running, + then *afn* is likely to raise :exc:`trio.Cancelled`. + RuntimeError: if you try calling this from inside the Trio thread, + which would otherwise cause a deadlock, or if no ``trio_token`` was + provided, and we can't infer one from context. + TypeError: if ``afn`` is not an asynchronous function. + + **Locating a TrioToken**: There are two ways to specify which + `trio.run` loop to reenter: + + - Spawn this thread from `trio.to_thread.run_sync`. Trio will + automatically capture the relevant Trio token and use it + to re-enter the same Trio task. + - Pass a keyword argument, ``trio_token`` specifying a specific + `trio.run` loop to re-enter. This is useful in case you have a + "foreign" thread, spawned using some other framework, and still want + to enter Trio, or if you want to use a new system task to call ``afn``, + maybe to avoid the cancellation context of a corresponding + `trio.to_thread.run_sync` task. You can get this token from + :func:`trio.lowlevel.current_trio_token`. + """ + return _send_message_to_trio(trio_token, Run(afn, args)) + + +def from_thread_run_sync( + fn: Callable[[Unpack[Ts]], RetT], + *args: Unpack[Ts], + trio_token: TrioToken | None = None, +) -> RetT: + """Run the given sync function in the parent Trio thread, blocking until it + is complete. + + Returns: + Whatever ``fn(*args)`` returns. + + Returns or raises whatever the given function returns or raises. It + can also raise exceptions of its own: + + Raises: + RunFinishedError: if the corresponding call to `trio.run` has + already completed. + RuntimeError: if you try calling this from inside the Trio thread, + which would otherwise cause a deadlock or if no ``trio_token`` was + provided, and we can't infer one from context. + TypeError: if ``fn`` is an async function. + + **Locating a TrioToken**: There are two ways to specify which + `trio.run` loop to reenter: + + - Spawn this thread from `trio.to_thread.run_sync`. Trio will + automatically capture the relevant Trio token and use it when you + want to re-enter Trio. + - Pass a keyword argument, ``trio_token`` specifying a specific + `trio.run` loop to re-enter. This is useful in case you have a + "foreign" thread, spawned using some other framework, and still want + to enter Trio, or if you want to use a new system task to call ``fn``, + maybe to avoid the cancellation context of a corresponding + `trio.to_thread.run_sync` task. + """ + return _send_message_to_trio(trio_token, RunSync(fn, args)) diff --git a/contrib/python/trio/trio/_timeouts.py b/contrib/python/trio/trio/_timeouts.py new file mode 100644 index 000000000000..d95cbe4cfc2f --- /dev/null +++ b/contrib/python/trio/trio/_timeouts.py @@ -0,0 +1,197 @@ +from __future__ import annotations + +import math +import sys +from contextlib import contextmanager +from typing import TYPE_CHECKING, NoReturn + +import trio + +if TYPE_CHECKING: + from collections.abc import Generator + + +def move_on_at(deadline: float, *, shield: bool = False) -> trio.CancelScope: + """Use as a context manager to create a cancel scope with the given + absolute deadline. + + Args: + deadline (float): The deadline. + shield (bool): Initial value for the `~trio.CancelScope.shield` attribute + of the newly created cancel scope. + + Raises: + ValueError: if deadline is NaN. + + """ + # CancelScope validates that deadline isn't math.nan + return trio.CancelScope(deadline=deadline, shield=shield) + + +def move_on_after( + seconds: float, + *, + shield: bool = False, +) -> trio.CancelScope: + """Use as a context manager to create a cancel scope whose deadline is + set to now + *seconds*. + + The deadline of the cancel scope is calculated upon entering. + + Args: + seconds (float): The timeout. + shield (bool): Initial value for the `~trio.CancelScope.shield` attribute + of the newly created cancel scope. + + Raises: + ValueError: if ``seconds`` is less than zero or NaN. + + """ + # duplicate validation logic to have the correct parameter name + if seconds < 0: + raise ValueError("`seconds` must be non-negative") + if math.isnan(seconds): + raise ValueError("`seconds` must not be NaN") + return trio.CancelScope( + shield=shield, + relative_deadline=seconds, + ) + + +async def sleep_forever() -> NoReturn: + """Pause execution of the current task forever (or until cancelled). + + Equivalent to calling ``await sleep(math.inf)``, except that if manually + rescheduled this will raise a `RuntimeError`. + + Raises: + RuntimeError: if rescheduled + + """ + await trio.lowlevel.wait_task_rescheduled(lambda _: trio.lowlevel.Abort.SUCCEEDED) + raise RuntimeError("Should never have been rescheduled!") + + +async def sleep_until(deadline: float) -> None: + """Pause execution of the current task until the given time. + + The difference between :func:`sleep` and :func:`sleep_until` is that the + former takes a relative time and the latter takes an absolute time + according to Trio's internal clock (as returned by :func:`current_time`). + + Args: + deadline (float): The time at which we should wake up again. May be in + the past, in which case this function executes a checkpoint but + does not block. + + Raises: + ValueError: if deadline is NaN. + + """ + with move_on_at(deadline): + await sleep_forever() + + +async def sleep(seconds: float) -> None: + """Pause execution of the current task for the given number of seconds. + + Args: + seconds (float): The number of seconds to sleep. May be zero to + insert a checkpoint without actually blocking. + + Raises: + ValueError: if *seconds* is negative or NaN. + + """ + if seconds < 0: + raise ValueError("`seconds` must be non-negative") + if seconds == 0: + await trio.lowlevel.checkpoint() + else: + await sleep_until(trio.current_time() + seconds) + + +class TooSlowError(Exception): + """Raised by :func:`fail_after` and :func:`fail_at` if the timeout + expires. + + """ + + +@contextmanager +def fail_at( + deadline: float, + *, + shield: bool = False, +) -> Generator[trio.CancelScope, None, None]: + """Creates a cancel scope with the given deadline, and raises an error if it + is actually cancelled. + + This function and :func:`move_on_at` are similar in that both create a + cancel scope with a given absolute deadline, and if the deadline expires + then both will cause :exc:`Cancelled` to be raised within the scope. The + difference is that when the :exc:`Cancelled` exception reaches + :func:`move_on_at`, it's caught and discarded. When it reaches + :func:`fail_at`, then it's caught and :exc:`TooSlowError` is raised in its + place. + + Args: + deadline (float): The deadline. + shield (bool): Initial value for the `~trio.CancelScope.shield` attribute + of the newly created cancel scope. + + Raises: + TooSlowError: if a :exc:`Cancelled` exception is raised in this scope + and caught by the context manager. + ValueError: if deadline is NaN. + + """ + with move_on_at(deadline, shield=shield) as scope: + yield scope + if scope.cancelled_caught: + raise TooSlowError + + +@contextmanager +def fail_after( + seconds: float, + *, + shield: bool = False, +) -> Generator[trio.CancelScope, None, None]: + """Creates a cancel scope with the given timeout, and raises an error if + it is actually cancelled. + + This function and :func:`move_on_after` are similar in that both create a + cancel scope with a given timeout, and if the timeout expires then both + will cause :exc:`Cancelled` to be raised within the scope. The difference + is that when the :exc:`Cancelled` exception reaches :func:`move_on_after`, + it's caught and discarded. When it reaches :func:`fail_after`, then it's + caught and :exc:`TooSlowError` is raised in its place. + + The deadline of the cancel scope is calculated upon entering. + + Args: + seconds (float): The timeout. + shield (bool): Initial value for the `~trio.CancelScope.shield` attribute + of the newly created cancel scope. + + Raises: + TooSlowError: if a :exc:`Cancelled` exception is raised in this scope + and caught by the context manager. + ValueError: if *seconds* is less than zero or NaN. + + """ + with move_on_after(seconds, shield=shield) as scope: + yield scope + if scope.cancelled_caught: + raise TooSlowError + + +# Users don't need to know that fail_at & fail_after wraps move_on_at and move_on_after +# and there is no functional difference. So we replace the return value when generating +# documentation. +if "sphinx.ext.autodoc" in sys.modules: + import inspect + + for c in (fail_at, fail_after): + c.__signature__ = inspect.Signature.from_callable(c).replace(return_annotation=trio.CancelScope) # type: ignore[union-attr] diff --git a/contrib/python/trio/trio/_tools/__init__.py b/contrib/python/trio/trio/_tools/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/trio/trio/_tools/gen_exports.py b/contrib/python/trio/trio/_tools/gen_exports.py new file mode 100644 index 000000000000..101e0e4912d4 --- /dev/null +++ b/contrib/python/trio/trio/_tools/gen_exports.py @@ -0,0 +1,403 @@ +#! /usr/bin/env python3 +""" +Code generation script for class methods +to be exported as public API +""" +from __future__ import annotations + +import argparse +import ast +import os +import subprocess +import sys +from pathlib import Path +from textwrap import indent +from typing import TYPE_CHECKING + +import attrs + +if TYPE_CHECKING: + from collections.abc import Iterable, Iterator + + from typing_extensions import TypeGuard + +# keep these imports up to date with conditional imports in test_gen_exports +# isort: split +import astor + +PREFIX = "_generated" + +HEADER = """# *********************************************************** +# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** +# ************************************************************* +from __future__ import annotations + +import sys + +from ._ki import enable_ki_protection +from ._run import GLOBAL_RUN_CONTEXT +""" + +TEMPLATE = """try: + return{}GLOBAL_RUN_CONTEXT.{}.{} +except AttributeError: + raise RuntimeError("must be called from async context") from None +""" + + +@attrs.define +class File: + path: Path + modname: str + platform: str = attrs.field(default="", kw_only=True) + imports: str = attrs.field(default="", kw_only=True) + + +def is_function(node: ast.AST) -> TypeGuard[ast.FunctionDef | ast.AsyncFunctionDef]: + """Check if the AST node is either a function + or an async function + """ + return isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) + + +def is_public(node: ast.AST) -> TypeGuard[ast.FunctionDef | ast.AsyncFunctionDef]: + """Check if the AST node has a _public decorator""" + if is_function(node): + for decorator in node.decorator_list: + if isinstance(decorator, ast.Name) and decorator.id == "_public": + return True + return False + + +def get_public_methods( + tree: ast.AST, +) -> Iterator[ast.FunctionDef | ast.AsyncFunctionDef]: + """Return a list of methods marked as public. + The function walks the given tree and extracts + all objects that are functions which are marked + public. + """ + for node in ast.walk(tree): + if is_public(node): + yield node + + +def create_passthrough_args(funcdef: ast.FunctionDef | ast.AsyncFunctionDef) -> str: + """Given a function definition, create a string that represents taking all + the arguments from the function, and passing them through to another + invocation of the same function. + + Example input: ast.parse("def f(a, *, b): ...") + Example output: "(a, b=b)" + """ + call_args = [arg.arg for arg in funcdef.args.args] + if funcdef.args.vararg: + call_args.append("*" + funcdef.args.vararg.arg) + for arg in funcdef.args.kwonlyargs: + call_args.append(arg.arg + "=" + arg.arg) # noqa: PERF401 # clarity + if funcdef.args.kwarg: + call_args.append("**" + funcdef.args.kwarg.arg) + return "({})".format(", ".join(call_args)) + + +def run_black(file: File, source: str) -> tuple[bool, str]: + """Run black on the specified file. + + Returns: + Tuple of success and result string. + ex.: + (False, "Failed to run black!\nerror: cannot format ...") + (True, "") + + Raises: + ImportError: If black is not installed. + """ + # imported to check that `subprocess` calls will succeed + import black # noqa: F401 + + # Black has an undocumented API, but it doesn't easily allow reading configuration from + # pyproject.toml, and simultaneously pass in / receive the code as a string. + # https://github.com/psf/black/issues/779 + result = subprocess.run( + # "-" as a filename = use stdin, return on stdout. + [sys.executable, "-m", "black", "--stdin-filename", file.path, "-"], + input=source, + capture_output=True, + encoding="utf8", + ) + + if result.returncode != 0: + return False, f"Failed to run black!\n{result.stderr}" + return True, result.stdout + + +def run_ruff(file: File, source: str) -> tuple[bool, str]: + """Run ruff on the specified file. + + Returns: + Tuple of success and result string. + ex.: + (False, "Failed to run ruff!\nerror: Failed to parse ...") + (True, "") + + Raises: + ImportError: If ruff is not installed. + """ + # imported to check that `subprocess` calls will succeed + import ruff # noqa: F401 + + result = subprocess.run( + # "-" as a filename = use stdin, return on stdout. + [ + sys.executable, + "-m", + "ruff", + "check", + "--fix", + "--unsafe-fixes", + "--stdin-filename", + file.path, + "-", + ], + input=source, + capture_output=True, + encoding="utf8", + ) + + if result.returncode != 0: + return False, f"Failed to run ruff!\n{result.stderr}" + return True, result.stdout + + +def run_linters(file: File, source: str) -> str: + """Format the specified file using black and ruff. + + Returns: + Formatted source code. + + Raises: + ImportError: If either is not installed. + SystemExit: If either failed. + """ + + for fn in (run_black, run_ruff): + success, source = fn(file, source) + if not success: + print(source) + sys.exit(1) + + return source + + +def gen_public_wrappers_source(file: File) -> str: + """Scan the given .py file for @_public decorators, and generate wrapper + functions. + + """ + header = [HEADER] + header.append(file.imports) + if file.platform: + # Simple checks to avoid repeating imports. If this messes up, type checkers/tests will + # just give errors. + if "TYPE_CHECKING" not in file.imports: + header.append("from typing import TYPE_CHECKING\n") + if "import sys" not in file.imports: # pragma: no cover + header.append("import sys\n") + header.append( + f'\nassert not TYPE_CHECKING or sys.platform=="{file.platform}"\n', + ) + + generated = ["".join(header)] + + source = astor.code_to_ast.parse_file(file.path) + method_names = [] + for method in get_public_methods(source): + # Remove self from arguments + assert method.args.args[0].arg == "self" + del method.args.args[0] + method_names.append(method.name) + + for dec in method.decorator_list: # pragma: no cover + if isinstance(dec, ast.Name) and dec.id == "contextmanager": + is_cm = True + break + else: + is_cm = False + + # Remove decorators + method.decorator_list = [ast.Name("enable_ki_protection")] + + # Create pass through arguments + new_args = create_passthrough_args(method) + + # Remove method body without the docstring + if ast.get_docstring(method) is None: + del method.body[:] + else: + # The first entry is always the docstring + del method.body[1:] + + # Create the function definition including the body + func = astor.to_source(method, indent_with=" " * 4) + + if is_cm: # pragma: no cover + func = func.replace("->Iterator", "->AbstractContextManager") + + # Create export function body + template = TEMPLATE.format( + " await " if isinstance(method, ast.AsyncFunctionDef) else " ", + file.modname, + method.name + new_args, + ) + + # Assemble function definition arguments and body + snippet = func + indent(template, " " * 4) + + # Append the snippet to the corresponding module + generated.append(snippet) + + method_names.sort() + # Insert after the header, before function definitions + generated.insert(1, f"__all__ = {method_names!r}") + return "\n\n".join(generated) + + +def matches_disk_files(new_files: dict[str, str]) -> bool: + for new_path, new_source in new_files.items(): + if not os.path.exists(new_path): + return False + old_source = Path(new_path).read_text(encoding="utf-8") + if old_source != new_source: + return False + return True + + +def process(files: Iterable[File], *, do_test: bool) -> None: + new_files = {} + for file in files: + print("Scanning:", file.path) + new_source = gen_public_wrappers_source(file) + new_source = run_linters(file, new_source) + dirname, basename = os.path.split(file.path) + new_path = os.path.join(dirname, PREFIX + basename) + new_files[new_path] = new_source + matches_disk = matches_disk_files(new_files) + if do_test: + if not matches_disk: + print("Generated sources are outdated. Please regenerate.") + sys.exit(1) + else: + print("Generated sources are up to date.") + else: + for new_path, new_source in new_files.items(): + with open(new_path, "w", encoding="utf-8", newline="\n") as fp: + fp.write(new_source) + print("Regenerated sources successfully.") + if not matches_disk: # TODO: test this branch + # With pre-commit integration, show that we edited files. + sys.exit(1) + + +# This is in fact run in CI, but only in the formatting check job, which +# doesn't collect coverage. +def main() -> None: # pragma: no cover + parser = argparse.ArgumentParser( + description="Generate python code for public api wrappers", + ) + parser.add_argument( + "--test", + "-t", + action="store_true", + help="test if code is still up to date", + ) + parsed_args = parser.parse_args() + + source_root = Path.cwd() + # Double-check we found the right directory + assert (source_root / "LICENSE").exists() + core = source_root / "src/trio/_core" + to_wrap = [ + File(core / "_run.py", "runner", imports=IMPORTS_RUN), + File( + core / "_instrumentation.py", + "runner.instruments", + imports=IMPORTS_INSTRUMENT, + ), + File( + core / "_io_windows.py", + "runner.io_manager", + platform="win32", + imports=IMPORTS_WINDOWS, + ), + File( + core / "_io_epoll.py", + "runner.io_manager", + platform="linux", + imports=IMPORTS_EPOLL, + ), + File( + core / "_io_kqueue.py", + "runner.io_manager", + platform="darwin", + imports=IMPORTS_KQUEUE, + ), + ] + + process(to_wrap, do_test=parsed_args.test) + + +IMPORTS_RUN = """\ +from collections.abc import Awaitable, Callable +from typing import Any, TYPE_CHECKING + +from outcome import Outcome +import contextvars + +from ._run import _NO_SEND, RunStatistics, Task +from ._entry_queue import TrioToken +from .._abc import Clock + +if TYPE_CHECKING: + from typing_extensions import Unpack + from ._run import PosArgT +""" +IMPORTS_INSTRUMENT = """\ +from ._instrumentation import Instrument +""" + +IMPORTS_EPOLL = """\ +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from .._file_io import _HasFileNo +""" + +IMPORTS_KQUEUE = """\ +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + import select + from collections.abc import Callable + from contextlib import AbstractContextManager + + from .. import _core + from .._file_io import _HasFileNo + from ._traps import Abort, RaiseCancelT +""" + +IMPORTS_WINDOWS = """\ +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from contextlib import AbstractContextManager + + from typing_extensions import Buffer + + from .._file_io import _HasFileNo + from ._unbounded_queue import UnboundedQueue + from ._windows_cffi import Handle, CData +""" + + +if __name__ == "__main__": + main() diff --git a/contrib/python/trio/trio/_tools/mypy_annotate.py b/contrib/python/trio/trio/_tools/mypy_annotate.py new file mode 100644 index 000000000000..1d625ad7aeee --- /dev/null +++ b/contrib/python/trio/trio/_tools/mypy_annotate.py @@ -0,0 +1,126 @@ +"""Translates Mypy's output into GitHub's error/warning annotation syntax. + +See: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions + +This first is run with Mypy's output piped in, to collect messages in +mypy_annotate.dat. After all platforms run, we run this again, which prints the +messages in GitHub's format but with cross-platform failures deduplicated. +""" + +from __future__ import annotations + +import argparse +import pickle +import re +import sys + +import attrs + +# Example: 'package/filename.py:42:1:46:3: error: Type error here [code]' +report_re = re.compile( + r""" + ([^:]+): # Filename (anything but ":") + ([0-9]+): # Line number (start) + (?:([0-9]+): # Optional column number + (?:([0-9]+):([0-9]+):)? # then also optionally, 2 more numbers for end columns + )? + \s*(error|warn|note): # Kind, prefixed with space + (.+) # Message + """, + re.VERBOSE, +) + +mypy_to_github = { + "error": "error", + "warn": "warning", + "note": "notice", +} + + +@attrs.frozen(kw_only=True) +class Result: + """Accumulated results, used as a dict key to deduplicate.""" + + filename: str + start_line: int + kind: str + message: str + start_col: int | None = None + end_line: int | None = None + end_col: int | None = None + + +def process_line(line: str) -> Result | None: + if match := report_re.fullmatch(line.rstrip()): + filename, st_line, st_col, end_line, end_col, kind, message = match.groups() + return Result( + filename=filename, + start_line=int(st_line), + start_col=int(st_col) if st_col is not None else None, + end_line=int(end_line) if end_line is not None else None, + end_col=int(end_col) if end_col is not None else None, + kind=mypy_to_github[kind], + message=message, + ) + else: + return None + + +def export(results: dict[Result, list[str]]) -> None: + """Display the collected results.""" + for res, platforms in results.items(): + print(f"::{res.kind} file={res.filename},line={res.start_line},", end="") + if res.start_col is not None: + print(f"col={res.start_col},", end="") + if res.end_col is not None and res.end_line is not None: + print(f"endLine={res.end_line},endColumn={res.end_col},", end="") + message = f"({res.start_line}:{res.start_col} - {res.end_line}:{res.end_col}):{res.message}" + else: + message = f"({res.start_line}:{res.start_col}):{res.message}" + else: + message = f"{res.start_line}:{res.message}" + print(f"title=Mypy-{'+'.join(platforms)}::{res.filename}:{message}") + + +def main(argv: list[str]) -> None: + """Look for error messages, and convert the format.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--dumpfile", + help="File to write pickled messages to.", + required=True, + ) + parser.add_argument( + "--platform", + help="OS name, if set Mypy should be piped to stdin.", + default=None, + ) + cmd_line = parser.parse_args(argv) + + results: dict[Result, list[str]] + try: + with open(cmd_line.dumpfile, "rb") as f: + results = pickle.load(f) + except (FileNotFoundError, pickle.UnpicklingError): + # If we fail to load, assume it's an old result. + results = {} + + if cmd_line.platform is None: + # Write out the results. + export(results) + else: + platform: str = cmd_line.platform + for line in sys.stdin: + parsed = process_line(line) + if parsed is not None: + try: + results[parsed].append(platform) + except KeyError: + results[parsed] = [platform] + sys.stdout.write(line) + with open(cmd_line.dumpfile, "wb") as f: + pickle.dump(results, f) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/contrib/python/trio/trio/_tools/sync_requirements.py b/contrib/python/trio/trio/_tools/sync_requirements.py new file mode 100644 index 000000000000..43337e29dcd7 --- /dev/null +++ b/contrib/python/trio/trio/_tools/sync_requirements.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 + +"""Sync Requirements - Automatically upgrade test requirements pinned +versions from pre-commit config file.""" + +from __future__ import annotations + +import sys +from pathlib import Path +from typing import TYPE_CHECKING + +from yaml import load as load_yaml + +if TYPE_CHECKING: + from collections.abc import Generator + + from yaml import CLoader as _CLoader, Loader as _Loader + + Loader: type[_CLoader | _Loader] + +try: + from yaml import CLoader as Loader +except ImportError: + from yaml import Loader + + +def yield_pre_commit_version_data( + pre_commit_text: str, +) -> Generator[tuple[str, str], None, None]: + """Yield (name, rev) tuples from pre-commit config file.""" + pre_commit_config = load_yaml(pre_commit_text, Loader) + for repo in pre_commit_config["repos"]: + if "repo" not in repo or "rev" not in repo: + continue + url = repo["repo"] + name = url.rsplit("/", 1)[-1] + rev = repo["rev"].removeprefix("v") + yield name, rev + + +def update_requirements( + requirements: Path, + version_data: dict[str, str], +) -> bool: + """Return if updated requirements file. + + Update requirements file to match versions in version_data.""" + changed = False + old_lines = requirements.read_text(encoding="utf-8").splitlines(True) + + with requirements.open("w", encoding="utf-8") as file: + for line in old_lines: + # If comment or not version mark line, ignore. + if line.startswith("#") or "==" not in line: + file.write(line) + continue + name, rest = line.split("==", 1) + # Maintain extra markers if they exist + old_version = rest.strip() + extra = "\n" + if ";" in rest: + old_version, extra = rest.split(";", 1) + old_version = old_version.strip() + extra = " ;" + extra + version = version_data.get(name) + # If does not exist, skip + if version is None: + file.write(line) + continue + # Otherwise might have changed + new_line = f"{name}=={version}{extra}" + if new_line != line: + if not changed: + changed = True + print("Changed test requirements version to match pre-commit") + print(f"{name}=={old_version} -> {name}=={version}") + file.write(new_line) + return changed + + +if __name__ == "__main__": + source_root = Path.cwd().absolute() + + # Double-check we found the right directory + assert (source_root / "LICENSE").exists() + pre_commit = source_root / ".pre-commit-config.yaml" + test_requirements = source_root / "test-requirements.txt" + + pre_commit_text = pre_commit.read_text(encoding="utf-8") + + # Get tool versions from pre-commit + # Get correct names + pre_commit_versions = { + name.removesuffix("-mirror").removesuffix("-pre-commit"): version + for name, version in yield_pre_commit_version_data(pre_commit_text) + } + changed = update_requirements(test_requirements, pre_commit_versions) + sys.exit(int(changed)) diff --git a/contrib/python/trio/trio/_tools/windows_ffi_build.py b/contrib/python/trio/trio/_tools/windows_ffi_build.py new file mode 100644 index 000000000000..a9a39410876d --- /dev/null +++ b/contrib/python/trio/trio/_tools/windows_ffi_build.py @@ -0,0 +1,220 @@ +# builder for CFFI out-of-line mode, for reduced import time. +# run this to generate `trio._core._generated_windows_ffi`. +import re + +import cffi + +LIB = """ +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx +typedef int BOOL; +typedef unsigned char BYTE; +typedef unsigned char UCHAR; +typedef BYTE BOOLEAN; +typedef void* PVOID; +typedef PVOID HANDLE; +typedef unsigned long DWORD; +typedef unsigned long ULONG; +typedef unsigned int NTSTATUS; +typedef unsigned long u_long; +typedef ULONG *PULONG; +typedef const void *LPCVOID; +typedef void *LPVOID; +typedef const wchar_t *LPCWSTR; +typedef DWORD* LPDWORD; + +typedef uintptr_t ULONG_PTR; +typedef uintptr_t UINT_PTR; + +typedef UINT_PTR SOCKET; + +typedef struct _OVERLAPPED { + ULONG_PTR Internal; + ULONG_PTR InternalHigh; + union { + struct { + DWORD Offset; + DWORD OffsetHigh; + } DUMMYSTRUCTNAME; + PVOID Pointer; + } DUMMYUNIONNAME; + + HANDLE hEvent; +} OVERLAPPED, *LPOVERLAPPED; + +typedef OVERLAPPED WSAOVERLAPPED; +typedef LPOVERLAPPED LPWSAOVERLAPPED; +typedef PVOID LPSECURITY_ATTRIBUTES; +typedef PVOID LPCSTR; + +typedef struct _OVERLAPPED_ENTRY { + ULONG_PTR lpCompletionKey; + LPOVERLAPPED lpOverlapped; + ULONG_PTR Internal; + DWORD dwNumberOfBytesTransferred; +} OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; + +// kernel32.dll +HANDLE WINAPI CreateIoCompletionPort( + _In_ HANDLE FileHandle, + _In_opt_ HANDLE ExistingCompletionPort, + _In_ ULONG_PTR CompletionKey, + _In_ DWORD NumberOfConcurrentThreads +); + +BOOL SetFileCompletionNotificationModes( + HANDLE FileHandle, + UCHAR Flags +); + +HANDLE CreateFileW( + LPCWSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile +); + +BOOL WINAPI CloseHandle( + _In_ HANDLE hObject +); + +BOOL WINAPI PostQueuedCompletionStatus( + _In_ HANDLE CompletionPort, + _In_ DWORD dwNumberOfBytesTransferred, + _In_ ULONG_PTR dwCompletionKey, + _In_opt_ LPOVERLAPPED lpOverlapped +); + +BOOL WINAPI GetQueuedCompletionStatusEx( + _In_ HANDLE CompletionPort, + _Out_ LPOVERLAPPED_ENTRY lpCompletionPortEntries, + _In_ ULONG ulCount, + _Out_ PULONG ulNumEntriesRemoved, + _In_ DWORD dwMilliseconds, + _In_ BOOL fAlertable +); + +BOOL WINAPI CancelIoEx( + _In_ HANDLE hFile, + _In_opt_ LPOVERLAPPED lpOverlapped +); + +BOOL WriteFile( + HANDLE hFile, + LPCVOID lpBuffer, + DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, + LPOVERLAPPED lpOverlapped +); + +BOOL ReadFile( + HANDLE hFile, + LPVOID lpBuffer, + DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, + LPOVERLAPPED lpOverlapped +); + +BOOL WINAPI SetConsoleCtrlHandler( + _In_opt_ void* HandlerRoutine, + _In_ BOOL Add +); + +HANDLE CreateEventA( + LPSECURITY_ATTRIBUTES lpEventAttributes, + BOOL bManualReset, + BOOL bInitialState, + LPCSTR lpName +); + +BOOL SetEvent( + HANDLE hEvent +); + +BOOL ResetEvent( + HANDLE hEvent +); + +DWORD WaitForSingleObject( + HANDLE hHandle, + DWORD dwMilliseconds +); + +DWORD WaitForMultipleObjects( + DWORD nCount, + HANDLE *lpHandles, + BOOL bWaitAll, + DWORD dwMilliseconds +); + +ULONG RtlNtStatusToDosError( + NTSTATUS Status +); + +int WSAIoctl( + SOCKET s, + DWORD dwIoControlCode, + LPVOID lpvInBuffer, + DWORD cbInBuffer, + LPVOID lpvOutBuffer, + DWORD cbOutBuffer, + LPDWORD lpcbBytesReturned, + LPWSAOVERLAPPED lpOverlapped, + // actually LPWSAOVERLAPPED_COMPLETION_ROUTINE + void* lpCompletionRoutine +); + +int WSAGetLastError(); + +BOOL DeviceIoControl( + HANDLE hDevice, + DWORD dwIoControlCode, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesReturned, + LPOVERLAPPED lpOverlapped +); + +// From https://github.com/piscisaureus/wepoll/blob/master/src/afd.h +typedef struct _AFD_POLL_HANDLE_INFO { + HANDLE Handle; + ULONG Events; + NTSTATUS Status; +} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; + +// This is really defined as a messy union to allow stuff like +// i.DUMMYSTRUCTNAME.LowPart, but we don't need those complications. +// Under all that it's just an int64. +typedef int64_t LARGE_INTEGER; + +typedef struct _AFD_POLL_INFO { + LARGE_INTEGER Timeout; + ULONG NumberOfHandles; + ULONG Exclusive; + AFD_POLL_HANDLE_INFO Handles[1]; +} AFD_POLL_INFO, *PAFD_POLL_INFO; + +""" + +# cribbed from pywincffi +# programmatically strips out those annotations MSDN likes, like _In_ +LIB = re.sub(r"\b(_In_|_Inout_|_Out_|_Outptr_|_Reserved_)(opt_)?\b", " ", LIB) + +# Other fixups: +# - get rid of FAR, cffi doesn't like it +LIB = re.sub(r"\bFAR\b", " ", LIB) +# - PASCAL is apparently an alias for __stdcall (on modern compilers - modern +# being _MSC_VER >= 800) +LIB = re.sub(r"\bPASCAL\b", "__stdcall", LIB) + +ffibuilder = cffi.FFI() +# a bit hacky but, it works +ffibuilder.set_source("trio._core._generated_windows_ffi", None) +ffibuilder.cdef(LIB) + +if __name__ == "__main__": + ffibuilder.compile("src") diff --git a/contrib/python/trio/trio/_unix_pipes.py b/contrib/python/trio/trio/_unix_pipes.py new file mode 100644 index 000000000000..dbe4358b4c5e --- /dev/null +++ b/contrib/python/trio/trio/_unix_pipes.py @@ -0,0 +1,205 @@ +from __future__ import annotations + +import errno +import os +import sys +from typing import TYPE_CHECKING + +import trio + +from ._abc import Stream +from ._util import ConflictDetector, final + +if TYPE_CHECKING: + from typing import Final as FinalType + +assert not TYPE_CHECKING or sys.platform != "win32" + +# XX TODO: is this a good number? who knows... it does match the default Linux +# pipe capacity though. +DEFAULT_RECEIVE_SIZE: FinalType = 65536 + + +class _FdHolder: + # This class holds onto a raw file descriptor, in non-blocking mode, and + # is responsible for managing its lifecycle. In particular, it's + # responsible for making sure it gets closed, and also for tracking + # whether it's been closed. + # + # The way we track closure is to set the .fd field to -1, discarding the + # original value. You might think that this is a strange idea, since it + # overloads the same field to do two different things. Wouldn't it be more + # natural to have a dedicated .closed field? But that would be more + # error-prone. Fds are represented by small integers, and once an fd is + # closed, its integer value may be reused immediately. If we accidentally + # used the old fd after being closed, we might end up doing something to + # another unrelated fd that happened to get assigned the same integer + # value. By throwing away the integer value immediately, it becomes + # impossible to make this mistake – we'll just get an EBADF. + # + # (This trick was copied from the stdlib socket module.) + fd: int + + def __init__(self, fd: int) -> None: + # make sure self.fd is always initialized to *something*, because even + # if we error out here then __del__ will run and access it. + self.fd = -1 + if not isinstance(fd, int): + raise TypeError("file descriptor must be an int") + self.fd = fd + # Store original state, and ensure non-blocking mode is enabled + self._original_is_blocking = os.get_blocking(fd) + os.set_blocking(fd, False) + + @property + def closed(self) -> bool: + return self.fd == -1 + + def _raw_close(self) -> None: + # This doesn't assume it's in a Trio context, so it can be called from + # __del__. You should never call it from Trio context, because it + # skips calling notify_fd_close. But from __del__, skipping that is + # OK, because notify_fd_close just wakes up other tasks that are + # waiting on this fd, and those tasks hold a reference to this object. + # So if __del__ is being called, we know there aren't any tasks that + # need to be woken. + if self.closed: + return + fd = self.fd + self.fd = -1 + os.set_blocking(fd, self._original_is_blocking) + os.close(fd) + + def __del__(self) -> None: + self._raw_close() + + def close(self) -> None: + if not self.closed: + trio.lowlevel.notify_closing(self.fd) + self._raw_close() + + +@final +class FdStream(Stream): + """Represents a stream given the file descriptor to a pipe, TTY, etc. + + *fd* must refer to a file that is open for reading and/or writing and + supports non-blocking I/O (pipes and TTYs will work, on-disk files probably + not). The returned stream takes ownership of the fd, so closing the stream + will close the fd too. As with `os.fdopen`, you should not directly use + an fd after you have wrapped it in a stream using this function. + + To be used as a Trio stream, an open file must be placed in non-blocking + mode. Unfortunately, this impacts all I/O that goes through the + underlying open file, including I/O that uses a different + file descriptor than the one that was passed to Trio. If other threads + or processes are using file descriptors that are related through `os.dup` + or inheritance across `os.fork` to the one that Trio is using, they are + unlikely to be prepared to have non-blocking I/O semantics suddenly + thrust upon them. For example, you can use + ``FdStream(os.dup(sys.stdin.fileno()))`` to obtain a stream for reading + from standard input, but it is only safe to do so with heavy caveats: your + stdin must not be shared by any other processes, and you must not make any + calls to synchronous methods of `sys.stdin` until the stream returned by + `FdStream` is closed. See `issue #174 + `__ for a discussion of the + challenges involved in relaxing this restriction. + + .. warning:: one specific consequence of non-blocking mode + applying to the entire open file description is that when + your program is run with multiple standard streams connected to + a TTY (as in a terminal emulator), all of the streams become + non-blocking when you construct an `FdStream` for any of them. + For example, if you construct an `FdStream` for standard input, + you might observe Python loggers begin to fail with + `BlockingIOError`. + + Args: + fd (int): The fd to be wrapped. + + Returns: + A new `FdStream` object. + """ + + def __init__(self, fd: int) -> None: + self._fd_holder = _FdHolder(fd) + self._send_conflict_detector = ConflictDetector( + "another task is using this stream for send", + ) + self._receive_conflict_detector = ConflictDetector( + "another task is using this stream for receive", + ) + + async def send_all(self, data: bytes) -> None: + with self._send_conflict_detector: + # have to check up front, because send_all(b"") on a closed pipe + # should raise + if self._fd_holder.closed: + raise trio.ClosedResourceError("file was already closed") + await trio.lowlevel.checkpoint() + length = len(data) + # adapted from the SocketStream code + with memoryview(data) as view: + sent = 0 + while sent < length: + with view[sent:] as remaining: + try: + sent += os.write(self._fd_holder.fd, remaining) + except BlockingIOError: + await trio.lowlevel.wait_writable(self._fd_holder.fd) + except OSError as e: + if e.errno == errno.EBADF: + raise trio.ClosedResourceError( + "file was already closed", + ) from None + else: + raise trio.BrokenResourceError from e + + async def wait_send_all_might_not_block(self) -> None: + with self._send_conflict_detector: + if self._fd_holder.closed: + raise trio.ClosedResourceError("file was already closed") + try: + await trio.lowlevel.wait_writable(self._fd_holder.fd) + except BrokenPipeError as e: + # kqueue: raises EPIPE on wait_writable instead + # of sending, which is annoying + raise trio.BrokenResourceError from e + + async def receive_some(self, max_bytes: int | None = None) -> bytes: + with self._receive_conflict_detector: + if max_bytes is None: + max_bytes = DEFAULT_RECEIVE_SIZE + else: + if not isinstance(max_bytes, int): + raise TypeError("max_bytes must be integer >= 1") + if max_bytes < 1: + raise ValueError("max_bytes must be integer >= 1") + + await trio.lowlevel.checkpoint() + while True: + try: + data = os.read(self._fd_holder.fd, max_bytes) + except BlockingIOError: + await trio.lowlevel.wait_readable(self._fd_holder.fd) + except OSError as exc: + if exc.errno == errno.EBADF: + raise trio.ClosedResourceError( + "file was already closed", + ) from None + else: + raise trio.BrokenResourceError from exc + else: + break + + return data + + def close(self) -> None: + self._fd_holder.close() + + async def aclose(self) -> None: + self.close() + await trio.lowlevel.checkpoint() + + def fileno(self) -> int: + return self._fd_holder.fd diff --git a/contrib/python/trio/trio/_util.py b/contrib/python/trio/trio/_util.py new file mode 100644 index 000000000000..54d324cab36f --- /dev/null +++ b/contrib/python/trio/trio/_util.py @@ -0,0 +1,421 @@ +# Little utilities we use internally +from __future__ import annotations + +import collections.abc +import inspect +import signal +from abc import ABCMeta +from collections.abc import Awaitable, Callable, Sequence +from functools import update_wrapper +from typing import ( + TYPE_CHECKING, + Any, + Generic, + NoReturn, + TypeVar, + final as std_final, +) + +from sniffio import thread_local as sniffio_loop + +import trio + +# Explicit "Any" is not allowed +CallT = TypeVar("CallT", bound=Callable[..., Any]) # type: ignore[explicit-any] +T = TypeVar("T") +RetT = TypeVar("RetT") + +if TYPE_CHECKING: + import sys + from types import AsyncGeneratorType, TracebackType + + from typing_extensions import Self, TypeVarTuple, Unpack + + if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup + + PosArgsT = TypeVarTuple("PosArgsT") + + +# See: #461 as to why this is needed. +# The gist is that threading.main_thread() has the capability to lie to us +# if somebody else edits the threading ident cache to replace the main +# thread; causing threading.current_thread() to return a _DummyThread, +# causing the C-c check to fail, and so on. +# Trying to use signal out of the main thread will fail, so we can then +# reliably check if this is the main thread without relying on a +# potentially modified threading. +def is_main_thread() -> bool: + """Attempt to reliably check if we are in the main thread.""" + try: + signal.signal(signal.SIGINT, signal.getsignal(signal.SIGINT)) + return True + except (TypeError, ValueError): + return False + + +###### +# Call the function and get the coroutine object, while giving helpful +# errors for common mistakes. Returns coroutine object. +###### +def coroutine_or_error( + async_fn: Callable[[Unpack[PosArgsT]], Awaitable[RetT]], + *args: Unpack[PosArgsT], +) -> collections.abc.Coroutine[object, NoReturn, RetT]: + def _return_value_looks_like_wrong_library(value: object) -> bool: + # Returned by legacy @asyncio.coroutine functions, which includes + # a surprising proportion of asyncio builtins. + if isinstance(value, collections.abc.Generator): + return True + # The protocol for detecting an asyncio Future-like object + if getattr(value, "_asyncio_future_blocking", None) is not None: + return True + # This janky check catches tornado Futures and twisted Deferreds. + # By the time we're calling this function, we already know + # something has gone wrong, so a heuristic is pretty safe. + return value.__class__.__name__ in ("Future", "Deferred") + + # Make sure a sync-fn-that-returns-coroutine still sees itself as being + # in trio context + prev_loop, sniffio_loop.name = sniffio_loop.name, "trio" + + try: + coro = async_fn(*args) + + except TypeError: + # Give good error for: nursery.start_soon(trio.sleep(1)) + if isinstance(async_fn, collections.abc.Coroutine): + # explicitly close coroutine to avoid RuntimeWarning + async_fn.close() + + raise TypeError( + "Trio was expecting an async function, but instead it got " + f"a coroutine object {async_fn!r}\n" + "\n" + "Probably you did something like:\n" + "\n" + f" trio.run({async_fn.__name__}(...)) # incorrect!\n" + f" nursery.start_soon({async_fn.__name__}(...)) # incorrect!\n" + "\n" + "Instead, you want (notice the parentheses!):\n" + "\n" + f" trio.run({async_fn.__name__}, ...) # correct!\n" + f" nursery.start_soon({async_fn.__name__}, ...) # correct!", + ) from None + + # Give good error for: nursery.start_soon(future) + if _return_value_looks_like_wrong_library(async_fn): + raise TypeError( + "Trio was expecting an async function, but instead it got " + f"{async_fn!r} – are you trying to use a library written for " + "asyncio/twisted/tornado or similar? That won't work " + "without some sort of compatibility shim.", + ) from None + + raise + + finally: + sniffio_loop.name = prev_loop + + # We can't check iscoroutinefunction(async_fn), because that will fail + # for things like functools.partial objects wrapping an async + # function. So we have to just call it and then check whether the + # return value is a coroutine object. + # Note: will not be necessary on python>=3.8, see https://bugs.python.org/issue34890 + # TODO: python3.7 support is now dropped, so the above can be addressed. + if not isinstance(coro, collections.abc.Coroutine): + # Give good error for: nursery.start_soon(func_returning_future) + if _return_value_looks_like_wrong_library(coro): + raise TypeError( + f"Trio got unexpected {coro!r} – are you trying to use a " + "library written for asyncio/twisted/tornado or similar? " + "That won't work without some sort of compatibility shim.", + ) + + if inspect.isasyncgen(coro): + raise TypeError( + "start_soon expected an async function but got an async " + f"generator {coro!r}", + ) + + # Give good error for: nursery.start_soon(some_sync_fn) + raise TypeError( + "Trio expected an async function, but {!r} appears to be " + "synchronous".format(getattr(async_fn, "__qualname__", async_fn)), + ) + + return coro + + +class ConflictDetector: + """Detect when two tasks are about to perform operations that would + conflict. + + Use as a synchronous context manager; if two tasks enter it at the same + time then the second one raises an error. You can use it when there are + two pieces of code that *would* collide and need a lock if they ever were + called at the same time, but that should never happen. + + We use this in particular for things like, making sure that two different + tasks don't call sendall simultaneously on the same stream. + + """ + + def __init__(self, msg: str) -> None: + self._msg = msg + self._held = False + + def __enter__(self) -> None: + if self._held: + raise trio.BusyResourceError(self._msg) + else: + self._held = True + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self._held = False + + +def async_wraps( # type: ignore[explicit-any] + cls: type[object], + wrapped_cls: type[object], + attr_name: str, +) -> Callable[[CallT], CallT]: + """Similar to wraps, but for async wrappers of non-async functions.""" + + def decorator(func: CallT) -> CallT: # type: ignore[explicit-any] + func.__name__ = attr_name + func.__qualname__ = f"{cls.__qualname__}.{attr_name}" + + func.__doc__ = f"Like :meth:`~{wrapped_cls.__module__}.{wrapped_cls.__qualname__}.{attr_name}`, but async." + + return func + + return decorator + + +def fixup_module_metadata( + module_name: str, + namespace: collections.abc.Mapping[str, object], +) -> None: + seen_ids: set[int] = set() + + def fix_one(qualname: str, name: str, obj: object) -> None: + # avoid infinite recursion (relevant when using + # typing.Generic, for example) + if id(obj) in seen_ids: + return + seen_ids.add(id(obj)) + + mod = getattr(obj, "__module__", None) + if mod is not None and mod.startswith("trio."): + obj.__module__ = module_name + # Modules, unlike everything else in Python, put fully-qualified + # names into their __name__ attribute. We check for "." to avoid + # rewriting these. + if hasattr(obj, "__name__") and "." not in obj.__name__: + obj.__name__ = name + if hasattr(obj, "__qualname__"): + obj.__qualname__ = qualname + if isinstance(obj, type): + for attr_name, attr_value in obj.__dict__.items(): + fix_one(objname + "." + attr_name, attr_name, attr_value) + + for objname, obj in namespace.items(): + if not objname.startswith("_"): # ignore private attributes + fix_one(objname, objname, obj) + + +# We need ParamSpec to type this "properly", but that requires a runtime typing_extensions import +# to use as a class base. This is only used at runtime and isn't correct for type checkers anyway, +# so don't bother. +class generic_function(Generic[RetT]): + """Decorator that makes a function indexable, to communicate + non-inferable generic type parameters to a static type checker. + + If you write:: + + @generic_function + def open_memory_channel(max_buffer_size: int) -> Tuple[ + SendChannel[T], ReceiveChannel[T] + ]: ... + + it is valid at runtime to say ``open_memory_channel[bytes](5)``. + This behaves identically to ``open_memory_channel(5)`` at runtime, + and currently won't type-check without a mypy plugin or clever stubs, + but at least it becomes possible to write those. + """ + + def __init__( # type: ignore[explicit-any] + self, + fn: Callable[..., RetT], + ) -> None: + update_wrapper(self, fn) + self._fn = fn + + def __call__(self, *args: object, **kwargs: object) -> RetT: + return self._fn(*args, **kwargs) + + def __getitem__(self, subscript: object) -> Self: + return self + + +def _init_final_cls(cls: type[object]) -> NoReturn: + """Raises an exception when a final class is subclassed.""" + raise TypeError(f"{cls.__module__}.{cls.__qualname__} does not support subclassing") + + +def _final_impl(decorated: type[T]) -> type[T]: + """Decorator that enforces a class to be final (i.e., subclass not allowed). + + If a class uses this metaclass like this:: + + @final + class SomeClass: + pass + + The metaclass will ensure that no subclass can be created. + + Raises + ------ + - TypeError if a subclass is created + """ + # Override the method blindly. We're always going to raise, so it doesn't + # matter what the original did (if anything). + decorated.__init_subclass__ = classmethod(_init_final_cls) # type: ignore[assignment] + # Apply the typing decorator, in 3.11+ it adds a __final__ marker attribute. + return std_final(decorated) + + +if TYPE_CHECKING: + from typing import final +else: + final = _final_impl + + +@final # No subclassing of NoPublicConstructor itself. +class NoPublicConstructor(ABCMeta): + """Metaclass that ensures a private constructor. + + If a class uses this metaclass like this:: + + @final + class SomeClass(metaclass=NoPublicConstructor): + pass + + The metaclass will ensure that no instance can be initialized. This should always be + used with @final. + + If you try to instantiate your class (SomeClass()), a TypeError will be thrown. Use + _create() instead in the class's implementation. + + Raises + ------ + - TypeError if an instance is created. + """ + + def __call__(cls, *args: object, **kwargs: object) -> None: + raise TypeError( + f"{cls.__module__}.{cls.__qualname__} has no public constructor", + ) + + def _create(cls: type[T], *args: object, **kwargs: object) -> T: + return super().__call__(*args, **kwargs) # type: ignore + + +def name_asyncgen(agen: AsyncGeneratorType[object, NoReturn]) -> str: + """Return the fully-qualified name of the async generator function + that produced the async generator iterator *agen*. + """ + if not hasattr(agen, "ag_code"): # pragma: no cover + return repr(agen) + try: + module = agen.ag_frame.f_globals["__name__"] + except (AttributeError, KeyError): + module = f"<{agen.ag_code.co_filename}>" + try: + qualname = agen.__qualname__ + except AttributeError: + qualname = agen.ag_code.co_name + return f"{module}.{qualname}" + + +# work around a pyright error +if TYPE_CHECKING: + Fn = TypeVar("Fn", bound=Callable[..., object]) # type: ignore[explicit-any] + + def wraps( # type: ignore[explicit-any] + wrapped: Callable[..., object], + assigned: Sequence[str] = ..., + updated: Sequence[str] = ..., + ) -> Callable[[Fn], Fn]: ... + +else: + from functools import wraps # noqa: F401 # this is re-exported + + +def raise_saving_context(exc: BaseException) -> NoReturn: + """This helper allows re-raising an exception without __context__ being set.""" + # cause does not need special handling, we simply avoid using `raise .. from ..` + # __suppress_context__ also does not need handling, it's only set if modifying cause + __tracebackhide__ = True + context = exc.__context__ + try: + raise exc + finally: + exc.__context__ = context + del exc, context + + +class MultipleExceptionError(Exception): + """Raised by raise_single_exception_from_group if encountering multiple + non-cancelled exceptions.""" + + +def raise_single_exception_from_group( + eg: BaseExceptionGroup[BaseException], +) -> NoReturn: + """This function takes an exception group that is assumed to have at most + one non-cancelled exception, which it reraises as a standalone exception. + + This exception may be an exceptiongroup itself, in which case it will not be unwrapped. + + If a :exc:`KeyboardInterrupt` is encountered, a new KeyboardInterrupt is immediately + raised with the entire group as cause. + + If the group only contains :exc:`Cancelled` it reraises the first one encountered. + + It will retain context and cause of the contained exception, and entirely discard + the cause/context of the group(s). + + If multiple non-cancelled exceptions are encountered, it raises + :exc:`AssertionError`. + """ + # immediately bail out if there's any KI or SystemExit + for e in eg.exceptions: + if isinstance(e, (KeyboardInterrupt, SystemExit)): + raise type(e)(*e.args) from eg + + cancelled_exception: trio.Cancelled | None = None + noncancelled_exception: BaseException | None = None + + for e in eg.exceptions: + if isinstance(e, trio.Cancelled): + if cancelled_exception is None: + cancelled_exception = e + elif noncancelled_exception is None: + noncancelled_exception = e + else: + raise MultipleExceptionError( + "Attempted to unwrap exceptiongroup with multiple non-cancelled exceptions. This is often caused by a bug in the caller." + ) from eg + + if noncancelled_exception is not None: + raise_saving_context(noncancelled_exception) + + assert cancelled_exception is not None, "group can't be empty" + raise_saving_context(cancelled_exception) diff --git a/contrib/python/trio/trio/_version.py b/contrib/python/trio/trio/_version.py new file mode 100644 index 000000000000..03116ed1c975 --- /dev/null +++ b/contrib/python/trio/trio/_version.py @@ -0,0 +1,3 @@ +# This file is imported from __init__.py and parsed by setuptools + +__version__ = "0.31.0" diff --git a/contrib/python/trio/trio/_wait_for_object.py b/contrib/python/trio/trio/_wait_for_object.py new file mode 100644 index 000000000000..53832513a34e --- /dev/null +++ b/contrib/python/trio/trio/_wait_for_object.py @@ -0,0 +1,67 @@ +from __future__ import annotations + +import math + +import trio + +from ._core._windows_cffi import ( + CData, + ErrorCodes, + _handle, + ffi, + handle_array, + kernel32, + raise_winerror, +) + + +async def WaitForSingleObject(obj: int | CData) -> None: + """Async and cancellable variant of WaitForSingleObject. Windows only. + + Args: + handle: A Win32 handle, as a Python integer. + + Raises: + OSError: If the handle is invalid, e.g. when it is already closed. + + """ + # Allow ints or whatever we can convert to a win handle + handle = _handle(obj) + + # Quick check; we might not even need to spawn a thread. The zero + # means a zero timeout; this call never blocks. We also exit here + # if the handle is already closed for some reason. + retcode = kernel32.WaitForSingleObject(handle, 0) + if retcode == ErrorCodes.WAIT_FAILED: + raise_winerror() + elif retcode != ErrorCodes.WAIT_TIMEOUT: + return + + # Wait for a thread that waits for two handles: the handle plus a handle + # that we can use to cancel the thread. + cancel_handle = kernel32.CreateEventA(ffi.NULL, True, False, ffi.NULL) + try: + await trio.to_thread.run_sync( + WaitForMultipleObjects_sync, + handle, + cancel_handle, + abandon_on_cancel=True, + limiter=trio.CapacityLimiter(math.inf), + ) + finally: + # Clean up our cancel handle. In case we get here because this task was + # cancelled, we also want to set the cancel_handle to stop the thread. + kernel32.SetEvent(cancel_handle) + kernel32.CloseHandle(cancel_handle) + + +def WaitForMultipleObjects_sync(*handles: int | CData) -> None: + """Wait for any of the given Windows handles to be signaled.""" + n = len(handles) + handle_arr = handle_array(n) + for i in range(n): + handle_arr[i] = handles[i] + timeout = 0xFFFFFFFF # INFINITE + retcode = kernel32.WaitForMultipleObjects(n, handle_arr, False, timeout) # blocking + if retcode == ErrorCodes.WAIT_FAILED: + raise_winerror() diff --git a/contrib/python/trio/trio/_windows_pipes.py b/contrib/python/trio/trio/_windows_pipes.py new file mode 100644 index 000000000000..e1eea1e72d63 --- /dev/null +++ b/contrib/python/trio/trio/_windows_pipes.py @@ -0,0 +1,144 @@ +from __future__ import annotations + +import sys +from typing import TYPE_CHECKING + +from . import _core +from ._abc import ReceiveStream, SendStream +from ._core._windows_cffi import _handle, kernel32, raise_winerror +from ._util import ConflictDetector, final + +assert sys.platform == "win32" or not TYPE_CHECKING + +# XX TODO: don't just make this up based on nothing. +DEFAULT_RECEIVE_SIZE = 65536 + + +# See the comments on _unix_pipes._FdHolder for discussion of why we set the +# handle to -1 when it's closed. +class _HandleHolder: + def __init__(self, handle: int) -> None: + self.handle = -1 + if not isinstance(handle, int): + raise TypeError("handle must be an int") + self.handle = handle + _core.register_with_iocp(self.handle) + + @property + def closed(self) -> bool: + return self.handle == -1 + + def close(self) -> None: + if self.closed: + return + handle = self.handle + self.handle = -1 + if not kernel32.CloseHandle(_handle(handle)): + raise_winerror() + + def __del__(self) -> None: + self.close() + + +@final +class PipeSendStream(SendStream): + """Represents a send stream over a Windows named pipe that has been + opened in OVERLAPPED mode. + """ + + def __init__(self, handle: int) -> None: + self._handle_holder = _HandleHolder(handle) + self._conflict_detector = ConflictDetector( + "another task is currently using this pipe", + ) + + async def send_all(self, data: bytes) -> None: + with self._conflict_detector: + if self._handle_holder.closed: + raise _core.ClosedResourceError("this pipe is already closed") + + if not data: + await _core.checkpoint() + return + + try: + written = await _core.write_overlapped(self._handle_holder.handle, data) + except BrokenPipeError as ex: + raise _core.BrokenResourceError from ex + # By my reading of MSDN, this assert is guaranteed to pass so long + # as the pipe isn't in nonblocking mode, but... let's just + # double-check. + assert written == len(data) + + async def wait_send_all_might_not_block(self) -> None: + with self._conflict_detector: + if self._handle_holder.closed: + raise _core.ClosedResourceError("This pipe is already closed") + + # not implemented yet, and probably not needed + await _core.checkpoint() + + def close(self) -> None: + self._handle_holder.close() + + async def aclose(self) -> None: + self.close() + await _core.checkpoint() + + +@final +class PipeReceiveStream(ReceiveStream): + """Represents a receive stream over an os.pipe object.""" + + def __init__(self, handle: int) -> None: + self._handle_holder = _HandleHolder(handle) + self._conflict_detector = ConflictDetector( + "another task is currently using this pipe", + ) + + async def receive_some(self, max_bytes: int | None = None) -> bytes: + with self._conflict_detector: + if self._handle_holder.closed: + raise _core.ClosedResourceError("this pipe is already closed") + + if max_bytes is None: + max_bytes = DEFAULT_RECEIVE_SIZE + else: + if not isinstance(max_bytes, int): + raise TypeError("max_bytes must be integer >= 1") + if max_bytes < 1: + raise ValueError("max_bytes must be integer >= 1") + + buffer = bytearray(max_bytes) + try: + size = await _core.readinto_overlapped( + self._handle_holder.handle, + buffer, + ) + except BrokenPipeError: + if self._handle_holder.closed: + raise _core.ClosedResourceError( + "another task closed this pipe", + ) from None + + # Windows raises BrokenPipeError on one end of a pipe + # whenever the other end closes, regardless of direction. + # Convert this to the Unix behavior of returning EOF to the + # reader when the writer closes. + # + # And since we're not raising an exception, we have to + # checkpoint. But readinto_overlapped did raise an exception, + # so it might not have checkpointed for us. So we have to + # checkpoint manually. + await _core.checkpoint() + return b"" + else: + del buffer[size:] + return buffer + + def close(self) -> None: + self._handle_holder.close() + + async def aclose(self) -> None: + self.close() + await _core.checkpoint() diff --git a/contrib/python/trio/trio/abc.py b/contrib/python/trio/trio/abc.py new file mode 100644 index 000000000000..439995640e79 --- /dev/null +++ b/contrib/python/trio/trio/abc.py @@ -0,0 +1,23 @@ +# This is a public namespace, so we don't want to expose any non-underscored +# attributes that aren't actually part of our public API. But it's very +# annoying to carefully always use underscored names for module-level +# temporaries, imports, etc. when implementing the module. So we put the +# implementation in an underscored module, and then re-export the public parts +# here. + +# Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) +from ._abc import ( + AsyncResource as AsyncResource, + Channel as Channel, + Clock as Clock, + HalfCloseableStream as HalfCloseableStream, + HostnameResolver as HostnameResolver, + Instrument as Instrument, + Listener as Listener, + ReceiveChannel as ReceiveChannel, + ReceiveStream as ReceiveStream, + SendChannel as SendChannel, + SendStream as SendStream, + SocketFactory as SocketFactory, + Stream as Stream, +) diff --git a/contrib/python/trio/trio/from_thread.py b/contrib/python/trio/trio/from_thread.py new file mode 100644 index 000000000000..50f3bac28bf5 --- /dev/null +++ b/contrib/python/trio/trio/from_thread.py @@ -0,0 +1,13 @@ +""" +This namespace represents special functions that can call back into Trio from +an external thread by means of a Trio Token present in Thread Local Storage +""" + +from ._threads import ( + from_thread_check_cancelled as check_cancelled, + from_thread_run as run, + from_thread_run_sync as run_sync, +) + +# need to use __all__ for pyright --verifytypes to see re-exports when renaming them +__all__ = ["check_cancelled", "run", "run_sync"] diff --git a/contrib/python/trio/trio/lowlevel.py b/contrib/python/trio/trio/lowlevel.py new file mode 100644 index 000000000000..b6621d47edda --- /dev/null +++ b/contrib/python/trio/trio/lowlevel.py @@ -0,0 +1,95 @@ +""" +This namespace represents low-level functionality not intended for daily use, +but useful for extending Trio's functionality. +""" + +# imports are renamed with leading underscores to indicate they are not part of the public API +import select as _select + +# static checkers don't understand if importing this as _sys, so it's deleted later +import sys +import typing as _t + +# Generally available symbols +from ._core import ( + Abort as Abort, + ParkingLot as ParkingLot, + ParkingLotStatistics as ParkingLotStatistics, + RaiseCancelT as RaiseCancelT, + RunStatistics as RunStatistics, + RunVar as RunVar, + RunVarToken as RunVarToken, + Task as Task, + TrioToken as TrioToken, + UnboundedQueue as UnboundedQueue, + UnboundedQueueStatistics as UnboundedQueueStatistics, + add_instrument as add_instrument, + add_parking_lot_breaker as add_parking_lot_breaker, + cancel_shielded_checkpoint as cancel_shielded_checkpoint, + checkpoint as checkpoint, + checkpoint_if_cancelled as checkpoint_if_cancelled, + current_clock as current_clock, + current_root_task as current_root_task, + current_statistics as current_statistics, + current_task as current_task, + current_trio_token as current_trio_token, + currently_ki_protected as currently_ki_protected, + disable_ki_protection as disable_ki_protection, + enable_ki_protection as enable_ki_protection, + in_trio_run as in_trio_run, + in_trio_task as in_trio_task, + notify_closing as notify_closing, + permanently_detach_coroutine_object as permanently_detach_coroutine_object, + reattach_detached_coroutine_object as reattach_detached_coroutine_object, + remove_instrument as remove_instrument, + remove_parking_lot_breaker as remove_parking_lot_breaker, + reschedule as reschedule, + spawn_system_task as spawn_system_task, + start_guest_run as start_guest_run, + start_thread_soon as start_thread_soon, + temporarily_detach_coroutine_object as temporarily_detach_coroutine_object, + wait_readable as wait_readable, + wait_task_rescheduled as wait_task_rescheduled, + wait_writable as wait_writable, +) +from ._subprocess import open_process as open_process + +# This is the union of a subset of trio/_core/ and some things from trio/*.py. +# See comments in trio/__init__.py for details. + +# Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) + +if sys.platform == "win32" or ( + not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules +): + # Windows symbols + from ._core import ( + current_iocp as current_iocp, + monitor_completion_key as monitor_completion_key, + readinto_overlapped as readinto_overlapped, + register_with_iocp as register_with_iocp, + wait_overlapped as wait_overlapped, + write_overlapped as write_overlapped, + ) + + # don't let documentation import the actual implementation + if sys.platform == "win32": # pragma: no branch + from ._wait_for_object import WaitForSingleObject as WaitForSingleObject + +if sys.platform != "win32" or ( + not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules +): + # Unix symbols + from ._unix_pipes import FdStream as FdStream + + # Kqueue-specific symbols + if ( + sys.platform != "linux" and (_t.TYPE_CHECKING or not hasattr(_select, "epoll")) + ) or (not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules): + from ._core import ( + current_kqueue as current_kqueue, + monitor_kevent as monitor_kevent, + wait_kevent as wait_kevent, + ) + +del sys diff --git a/contrib/python/trio/trio/py.typed b/contrib/python/trio/trio/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/trio/trio/socket.py b/contrib/python/trio/trio/socket.py new file mode 100644 index 000000000000..cfcb9943c83f --- /dev/null +++ b/contrib/python/trio/trio/socket.py @@ -0,0 +1,602 @@ +from __future__ import annotations + +# This is a public namespace, so we don't want to expose any non-underscored +# attributes that aren't actually part of our public API. But it's very +# annoying to carefully always use underscored names for module-level +# temporaries, imports, etc. when implementing the module. So we put the +# implementation in an underscored module, and then re-export the public parts +# here. +# We still have some underscore names though but only a few. +import socket as _stdlib_socket + +# static checkers don't understand if importing this as _sys, so it's deleted later +import sys +import typing as _t + +from . import _socket + +_bad_symbols: set[str] = set() +if sys.platform == "win32": + # See https://github.com/python-trio/trio/issues/39 + # Do not import for windows platform + # (you can still get it from stdlib socket, of course, if you want it) + _bad_symbols.add("SO_REUSEADDR") + +# Dynamically re-export whatever constants this particular Python happens to +# have: +globals().update( + { + _name: getattr(_stdlib_socket, _name) + for _name in _stdlib_socket.__all__ + if _name.isupper() and _name not in _bad_symbols + }, +) + +# import the overwrites +from contextlib import suppress as _suppress + +# Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) +from ._socket import ( + SocketType as SocketType, + from_stdlib_socket as from_stdlib_socket, + fromfd as fromfd, + getaddrinfo as getaddrinfo, + getnameinfo as getnameinfo, + getprotobyname as getprotobyname, + set_custom_hostname_resolver as set_custom_hostname_resolver, + set_custom_socket_factory as set_custom_socket_factory, + socket as socket, + socketpair as socketpair, +) + +# not always available so expose only if +if sys.platform == "win32" or not _t.TYPE_CHECKING: + with _suppress(ImportError): + from ._socket import fromshare as fromshare + +# expose these functions to trio.socket +from socket import ( + gaierror as gaierror, + gethostname as gethostname, + herror as herror, + htonl as htonl, + htons as htons, + inet_aton as inet_aton, + inet_ntoa as inet_ntoa, + inet_ntop as inet_ntop, + inet_pton as inet_pton, + ntohs as ntohs, +) + +if sys.implementation.name == "cpython": + from socket import ( + if_indextoname as if_indextoname, + if_nametoindex as if_nametoindex, + ) + + # For android devices, if_nameindex support was introduced in API 24, + # so it doesn't exist for any version prior. + with _suppress(ImportError): + from socket import ( + if_nameindex as if_nameindex, + ) + + +# not always available so expose only if +if sys.platform != "win32" or not _t.TYPE_CHECKING: + with _suppress(ImportError): + from socket import ( + sethostname as sethostname, + ) + +if _t.TYPE_CHECKING: + IP_BIND_ADDRESS_NO_PORT: int +else: + try: + IP_BIND_ADDRESS_NO_PORT # noqa: B018 # "useless expression" + except NameError: + if sys.platform == "linux": + IP_BIND_ADDRESS_NO_PORT = 24 + +del sys + + +# The socket module exports a bunch of platform-specific constants. We want to +# re-export them. Since the exact set of constants varies depending on Python +# version, platform, the libc installed on the system where Python was built, +# etc., we figure out which constants to re-export dynamically at runtime (see +# above). But that confuses static analysis tools like jedi and mypy. So this +# import statement statically lists every constant that *could* be +# exported. There's a test in test_exports.py to make sure that the list is +# kept up to date. +if _t.TYPE_CHECKING: + from socket import ( # type: ignore[attr-defined] + AF_ALG as AF_ALG, + AF_APPLETALK as AF_APPLETALK, + AF_ASH as AF_ASH, + AF_ATMPVC as AF_ATMPVC, + AF_ATMSVC as AF_ATMSVC, + AF_AX25 as AF_AX25, + AF_BLUETOOTH as AF_BLUETOOTH, + AF_BRIDGE as AF_BRIDGE, + AF_CAN as AF_CAN, + AF_ECONET as AF_ECONET, + AF_HYPERV as AF_HYPERV, + AF_INET as AF_INET, + AF_INET6 as AF_INET6, + AF_IPX as AF_IPX, + AF_IRDA as AF_IRDA, + AF_KEY as AF_KEY, + AF_LINK as AF_LINK, + AF_LLC as AF_LLC, + AF_NETBEUI as AF_NETBEUI, + AF_NETLINK as AF_NETLINK, + AF_NETROM as AF_NETROM, + AF_PACKET as AF_PACKET, + AF_PPPOX as AF_PPPOX, + AF_QIPCRTR as AF_QIPCRTR, + AF_RDS as AF_RDS, + AF_ROSE as AF_ROSE, + AF_ROUTE as AF_ROUTE, + AF_SECURITY as AF_SECURITY, + AF_SNA as AF_SNA, + AF_SYSTEM as AF_SYSTEM, + AF_TIPC as AF_TIPC, + AF_UNIX as AF_UNIX, + AF_UNSPEC as AF_UNSPEC, + AF_VSOCK as AF_VSOCK, + AF_WANPIPE as AF_WANPIPE, + AF_X25 as AF_X25, + AI_ADDRCONFIG as AI_ADDRCONFIG, + AI_ALL as AI_ALL, + AI_CANONNAME as AI_CANONNAME, + AI_DEFAULT as AI_DEFAULT, + AI_MASK as AI_MASK, + AI_NUMERICHOST as AI_NUMERICHOST, + AI_NUMERICSERV as AI_NUMERICSERV, + AI_PASSIVE as AI_PASSIVE, + AI_V4MAPPED as AI_V4MAPPED, + AI_V4MAPPED_CFG as AI_V4MAPPED_CFG, + ALG_OP_DECRYPT as ALG_OP_DECRYPT, + ALG_OP_ENCRYPT as ALG_OP_ENCRYPT, + ALG_OP_SIGN as ALG_OP_SIGN, + ALG_OP_VERIFY as ALG_OP_VERIFY, + ALG_SET_AEAD_ASSOCLEN as ALG_SET_AEAD_ASSOCLEN, + ALG_SET_AEAD_AUTHSIZE as ALG_SET_AEAD_AUTHSIZE, + ALG_SET_IV as ALG_SET_IV, + ALG_SET_KEY as ALG_SET_KEY, + ALG_SET_OP as ALG_SET_OP, + ALG_SET_PUBKEY as ALG_SET_PUBKEY, + BDADDR_ANY as BDADDR_ANY, + BDADDR_LOCAL as BDADDR_LOCAL, + BTPROTO_HCI as BTPROTO_HCI, + BTPROTO_L2CAP as BTPROTO_L2CAP, + BTPROTO_RFCOMM as BTPROTO_RFCOMM, + BTPROTO_SCO as BTPROTO_SCO, + CAN_BCM as CAN_BCM, + CAN_BCM_CAN_FD_FRAME as CAN_BCM_CAN_FD_FRAME, + CAN_BCM_RX_ANNOUNCE_RESUME as CAN_BCM_RX_ANNOUNCE_RESUME, + CAN_BCM_RX_CHANGED as CAN_BCM_RX_CHANGED, + CAN_BCM_RX_CHECK_DLC as CAN_BCM_RX_CHECK_DLC, + CAN_BCM_RX_DELETE as CAN_BCM_RX_DELETE, + CAN_BCM_RX_FILTER_ID as CAN_BCM_RX_FILTER_ID, + CAN_BCM_RX_NO_AUTOTIMER as CAN_BCM_RX_NO_AUTOTIMER, + CAN_BCM_RX_READ as CAN_BCM_RX_READ, + CAN_BCM_RX_RTR_FRAME as CAN_BCM_RX_RTR_FRAME, + CAN_BCM_RX_SETUP as CAN_BCM_RX_SETUP, + CAN_BCM_RX_STATUS as CAN_BCM_RX_STATUS, + CAN_BCM_RX_TIMEOUT as CAN_BCM_RX_TIMEOUT, + CAN_BCM_SETTIMER as CAN_BCM_SETTIMER, + CAN_BCM_STARTTIMER as CAN_BCM_STARTTIMER, + CAN_BCM_TX_ANNOUNCE as CAN_BCM_TX_ANNOUNCE, + CAN_BCM_TX_COUNTEVT as CAN_BCM_TX_COUNTEVT, + CAN_BCM_TX_CP_CAN_ID as CAN_BCM_TX_CP_CAN_ID, + CAN_BCM_TX_DELETE as CAN_BCM_TX_DELETE, + CAN_BCM_TX_EXPIRED as CAN_BCM_TX_EXPIRED, + CAN_BCM_TX_READ as CAN_BCM_TX_READ, + CAN_BCM_TX_RESET_MULTI_IDX as CAN_BCM_TX_RESET_MULTI_IDX, + CAN_BCM_TX_SEND as CAN_BCM_TX_SEND, + CAN_BCM_TX_SETUP as CAN_BCM_TX_SETUP, + CAN_BCM_TX_STATUS as CAN_BCM_TX_STATUS, + CAN_EFF_FLAG as CAN_EFF_FLAG, + CAN_EFF_MASK as CAN_EFF_MASK, + CAN_ERR_FLAG as CAN_ERR_FLAG, + CAN_ERR_MASK as CAN_ERR_MASK, + CAN_ISOTP as CAN_ISOTP, + CAN_J1939 as CAN_J1939, + CAN_RAW as CAN_RAW, + CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER, + CAN_RAW_FD_FRAMES as CAN_RAW_FD_FRAMES, + CAN_RAW_FILTER as CAN_RAW_FILTER, + CAN_RAW_JOIN_FILTERS as CAN_RAW_JOIN_FILTERS, + CAN_RAW_LOOPBACK as CAN_RAW_LOOPBACK, + CAN_RAW_RECV_OWN_MSGS as CAN_RAW_RECV_OWN_MSGS, + CAN_RTR_FLAG as CAN_RTR_FLAG, + CAN_SFF_MASK as CAN_SFF_MASK, + CAPI as CAPI, + CMSG_LEN as CMSG_LEN, + CMSG_SPACE as CMSG_SPACE, + EAGAIN as EAGAIN, + EAI_ADDRFAMILY as EAI_ADDRFAMILY, + EAI_AGAIN as EAI_AGAIN, + EAI_BADFLAGS as EAI_BADFLAGS, + EAI_BADHINTS as EAI_BADHINTS, + EAI_FAIL as EAI_FAIL, + EAI_FAMILY as EAI_FAMILY, + EAI_MAX as EAI_MAX, + EAI_MEMORY as EAI_MEMORY, + EAI_NODATA as EAI_NODATA, + EAI_NONAME as EAI_NONAME, + EAI_OVERFLOW as EAI_OVERFLOW, + EAI_PROTOCOL as EAI_PROTOCOL, + EAI_SERVICE as EAI_SERVICE, + EAI_SOCKTYPE as EAI_SOCKTYPE, + EAI_SYSTEM as EAI_SYSTEM, + EBADF as EBADF, + ETH_P_ALL as ETH_P_ALL, + ETHERTYPE_ARP as ETHERTYPE_ARP, + ETHERTYPE_IP as ETHERTYPE_IP, + ETHERTYPE_IPV6 as ETHERTYPE_IPV6, + ETHERTYPE_VLAN as ETHERTYPE_VLAN, + EWOULDBLOCK as EWOULDBLOCK, + FD_ACCEPT as FD_ACCEPT, + FD_CLOSE as FD_CLOSE, + FD_CLOSE_BIT as FD_CLOSE_BIT, + FD_CONNECT as FD_CONNECT, + FD_CONNECT_BIT as FD_CONNECT_BIT, + FD_READ as FD_READ, + FD_SETSIZE as FD_SETSIZE, + FD_WRITE as FD_WRITE, + HCI_DATA_DIR as HCI_DATA_DIR, + HCI_FILTER as HCI_FILTER, + HCI_TIME_STAMP as HCI_TIME_STAMP, + HV_GUID_BROADCAST as HV_GUID_BROADCAST, + HV_GUID_CHILDREN as HV_GUID_CHILDREN, + HV_GUID_LOOPBACK as HV_GUID_LOOPBACK, + HV_GUID_PARENT as HV_GUID_PARENT, + HV_GUID_WILDCARD as HV_GUID_WILDCARD, + HV_GUID_ZERO as HV_GUID_ZERO, + HV_PROTOCOL_RAW as HV_PROTOCOL_RAW, + HVSOCKET_ADDRESS_FLAG_PASSTHRU as HVSOCKET_ADDRESS_FLAG_PASSTHRU, + HVSOCKET_CONNECT_TIMEOUT as HVSOCKET_CONNECT_TIMEOUT, + HVSOCKET_CONNECT_TIMEOUT_MAX as HVSOCKET_CONNECT_TIMEOUT_MAX, + HVSOCKET_CONNECTED_SUSPEND as HVSOCKET_CONNECTED_SUSPEND, + INADDR_ALLHOSTS_GROUP as INADDR_ALLHOSTS_GROUP, + INADDR_ANY as INADDR_ANY, + INADDR_BROADCAST as INADDR_BROADCAST, + INADDR_LOOPBACK as INADDR_LOOPBACK, + INADDR_MAX_LOCAL_GROUP as INADDR_MAX_LOCAL_GROUP, + INADDR_NONE as INADDR_NONE, + INADDR_UNSPEC_GROUP as INADDR_UNSPEC_GROUP, + INFINITE as INFINITE, + IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID, + IP_ADD_MEMBERSHIP as IP_ADD_MEMBERSHIP, + IP_ADD_SOURCE_MEMBERSHIP as IP_ADD_SOURCE_MEMBERSHIP, + IP_BLOCK_SOURCE as IP_BLOCK_SOURCE, + IP_DEFAULT_MULTICAST_LOOP as IP_DEFAULT_MULTICAST_LOOP, + IP_DEFAULT_MULTICAST_TTL as IP_DEFAULT_MULTICAST_TTL, + IP_DROP_MEMBERSHIP as IP_DROP_MEMBERSHIP, + IP_DROP_SOURCE_MEMBERSHIP as IP_DROP_SOURCE_MEMBERSHIP, + IP_FREEBIND as IP_FREEBIND, + IP_HDRINCL as IP_HDRINCL, + IP_MAX_MEMBERSHIPS as IP_MAX_MEMBERSHIPS, + IP_MULTICAST_IF as IP_MULTICAST_IF, + IP_MULTICAST_LOOP as IP_MULTICAST_LOOP, + IP_MULTICAST_TTL as IP_MULTICAST_TTL, + IP_OPTIONS as IP_OPTIONS, + IP_PKTINFO as IP_PKTINFO, + IP_RECVDSTADDR as IP_RECVDSTADDR, + IP_RECVERR as IP_RECVERR, + IP_RECVOPTS as IP_RECVOPTS, + IP_RECVORIGDSTADDR as IP_RECVORIGDSTADDR, + IP_RECVRETOPTS as IP_RECVRETOPTS, + IP_RECVTOS as IP_RECVTOS, + IP_RECVTTL as IP_RECVTTL, + IP_RETOPTS as IP_RETOPTS, + IP_TOS as IP_TOS, + IP_TRANSPARENT as IP_TRANSPARENT, + IP_TTL as IP_TTL, + IP_UNBLOCK_SOURCE as IP_UNBLOCK_SOURCE, + IPPORT_RESERVED as IPPORT_RESERVED, + IPPORT_USERRESERVED as IPPORT_USERRESERVED, + IPPROTO_AH as IPPROTO_AH, + IPPROTO_CBT as IPPROTO_CBT, + IPPROTO_DSTOPTS as IPPROTO_DSTOPTS, + IPPROTO_EGP as IPPROTO_EGP, + IPPROTO_EON as IPPROTO_EON, + IPPROTO_ESP as IPPROTO_ESP, + IPPROTO_FRAGMENT as IPPROTO_FRAGMENT, + IPPROTO_GGP as IPPROTO_GGP, + IPPROTO_GRE as IPPROTO_GRE, + IPPROTO_HELLO as IPPROTO_HELLO, + IPPROTO_HOPOPTS as IPPROTO_HOPOPTS, + IPPROTO_ICLFXBM as IPPROTO_ICLFXBM, + IPPROTO_ICMP as IPPROTO_ICMP, + IPPROTO_ICMPV6 as IPPROTO_ICMPV6, + IPPROTO_IDP as IPPROTO_IDP, + IPPROTO_IGMP as IPPROTO_IGMP, + IPPROTO_IGP as IPPROTO_IGP, + IPPROTO_IP as IPPROTO_IP, + IPPROTO_IPCOMP as IPPROTO_IPCOMP, + IPPROTO_IPIP as IPPROTO_IPIP, + IPPROTO_IPV4 as IPPROTO_IPV4, + IPPROTO_IPV6 as IPPROTO_IPV6, + IPPROTO_L2TP as IPPROTO_L2TP, + IPPROTO_MAX as IPPROTO_MAX, + IPPROTO_MOBILE as IPPROTO_MOBILE, + IPPROTO_MPTCP as IPPROTO_MPTCP, + IPPROTO_ND as IPPROTO_ND, + IPPROTO_NONE as IPPROTO_NONE, + IPPROTO_PGM as IPPROTO_PGM, + IPPROTO_PIM as IPPROTO_PIM, + IPPROTO_PUP as IPPROTO_PUP, + IPPROTO_RAW as IPPROTO_RAW, + IPPROTO_RDP as IPPROTO_RDP, + IPPROTO_ROUTING as IPPROTO_ROUTING, + IPPROTO_RSVP as IPPROTO_RSVP, + IPPROTO_SCTP as IPPROTO_SCTP, + IPPROTO_ST as IPPROTO_ST, + IPPROTO_TCP as IPPROTO_TCP, + IPPROTO_TP as IPPROTO_TP, + IPPROTO_UDP as IPPROTO_UDP, + IPPROTO_UDPLITE as IPPROTO_UDPLITE, + IPPROTO_XTP as IPPROTO_XTP, + IPV6_CHECKSUM as IPV6_CHECKSUM, + IPV6_DONTFRAG as IPV6_DONTFRAG, + IPV6_DSTOPTS as IPV6_DSTOPTS, + IPV6_HOPLIMIT as IPV6_HOPLIMIT, + IPV6_HOPOPTS as IPV6_HOPOPTS, + IPV6_JOIN_GROUP as IPV6_JOIN_GROUP, + IPV6_LEAVE_GROUP as IPV6_LEAVE_GROUP, + IPV6_MULTICAST_HOPS as IPV6_MULTICAST_HOPS, + IPV6_MULTICAST_IF as IPV6_MULTICAST_IF, + IPV6_MULTICAST_LOOP as IPV6_MULTICAST_LOOP, + IPV6_NEXTHOP as IPV6_NEXTHOP, + IPV6_PATHMTU as IPV6_PATHMTU, + IPV6_PKTINFO as IPV6_PKTINFO, + IPV6_RECVDSTOPTS as IPV6_RECVDSTOPTS, + IPV6_RECVERR as IPV6_RECVERR, + IPV6_RECVHOPLIMIT as IPV6_RECVHOPLIMIT, + IPV6_RECVHOPOPTS as IPV6_RECVHOPOPTS, + IPV6_RECVPATHMTU as IPV6_RECVPATHMTU, + IPV6_RECVPKTINFO as IPV6_RECVPKTINFO, + IPV6_RECVRTHDR as IPV6_RECVRTHDR, + IPV6_RECVTCLASS as IPV6_RECVTCLASS, + IPV6_RTHDR as IPV6_RTHDR, + IPV6_RTHDR_TYPE_0 as IPV6_RTHDR_TYPE_0, + IPV6_RTHDRDSTOPTS as IPV6_RTHDRDSTOPTS, + IPV6_TCLASS as IPV6_TCLASS, + IPV6_UNICAST_HOPS as IPV6_UNICAST_HOPS, + IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU, + IPV6_V6ONLY as IPV6_V6ONLY, + J1939_EE_INFO_NONE as J1939_EE_INFO_NONE, + J1939_EE_INFO_TX_ABORT as J1939_EE_INFO_TX_ABORT, + J1939_FILTER_MAX as J1939_FILTER_MAX, + J1939_IDLE_ADDR as J1939_IDLE_ADDR, + J1939_MAX_UNICAST_ADDR as J1939_MAX_UNICAST_ADDR, + J1939_NLA_BYTES_ACKED as J1939_NLA_BYTES_ACKED, + J1939_NLA_PAD as J1939_NLA_PAD, + J1939_NO_ADDR as J1939_NO_ADDR, + J1939_NO_NAME as J1939_NO_NAME, + J1939_NO_PGN as J1939_NO_PGN, + J1939_PGN_ADDRESS_CLAIMED as J1939_PGN_ADDRESS_CLAIMED, + J1939_PGN_ADDRESS_COMMANDED as J1939_PGN_ADDRESS_COMMANDED, + J1939_PGN_MAX as J1939_PGN_MAX, + J1939_PGN_PDU1_MAX as J1939_PGN_PDU1_MAX, + J1939_PGN_REQUEST as J1939_PGN_REQUEST, + LOCAL_PEERCRED as LOCAL_PEERCRED, + MSG_BCAST as MSG_BCAST, + MSG_CMSG_CLOEXEC as MSG_CMSG_CLOEXEC, + MSG_CONFIRM as MSG_CONFIRM, + MSG_CTRUNC as MSG_CTRUNC, + MSG_DONTROUTE as MSG_DONTROUTE, + MSG_DONTWAIT as MSG_DONTWAIT, + MSG_EOF as MSG_EOF, + MSG_EOR as MSG_EOR, + MSG_ERRQUEUE as MSG_ERRQUEUE, + MSG_FASTOPEN as MSG_FASTOPEN, + MSG_MCAST as MSG_MCAST, + MSG_MORE as MSG_MORE, + MSG_NOSIGNAL as MSG_NOSIGNAL, + MSG_NOTIFICATION as MSG_NOTIFICATION, + MSG_OOB as MSG_OOB, + MSG_PEEK as MSG_PEEK, + MSG_TRUNC as MSG_TRUNC, + MSG_WAITALL as MSG_WAITALL, + NETLINK_CRYPTO as NETLINK_CRYPTO, + NETLINK_DNRTMSG as NETLINK_DNRTMSG, + NETLINK_FIREWALL as NETLINK_FIREWALL, + NETLINK_IP6_FW as NETLINK_IP6_FW, + NETLINK_NFLOG as NETLINK_NFLOG, + NETLINK_ROUTE as NETLINK_ROUTE, + NETLINK_USERSOCK as NETLINK_USERSOCK, + NETLINK_XFRM as NETLINK_XFRM, + NI_DGRAM as NI_DGRAM, + NI_IDN as NI_IDN, + NI_MAXHOST as NI_MAXHOST, + NI_MAXSERV as NI_MAXSERV, + NI_NAMEREQD as NI_NAMEREQD, + NI_NOFQDN as NI_NOFQDN, + NI_NUMERICHOST as NI_NUMERICHOST, + NI_NUMERICSERV as NI_NUMERICSERV, + PACKET_BROADCAST as PACKET_BROADCAST, + PACKET_FASTROUTE as PACKET_FASTROUTE, + PACKET_HOST as PACKET_HOST, + PACKET_LOOPBACK as PACKET_LOOPBACK, + PACKET_MULTICAST as PACKET_MULTICAST, + PACKET_OTHERHOST as PACKET_OTHERHOST, + PACKET_OUTGOING as PACKET_OUTGOING, + PF_CAN as PF_CAN, + PF_PACKET as PF_PACKET, + PF_RDS as PF_RDS, + PF_SYSTEM as PF_SYSTEM, + POLLERR as POLLERR, + POLLHUP as POLLHUP, + POLLIN as POLLIN, + POLLMSG as POLLMSG, + POLLNVAL as POLLNVAL, + POLLOUT as POLLOUT, + POLLPRI as POLLPRI, + POLLRDBAND as POLLRDBAND, + POLLRDNORM as POLLRDNORM, + POLLWRNORM as POLLWRNORM, + RCVALL_MAX as RCVALL_MAX, + RCVALL_OFF as RCVALL_OFF, + RCVALL_ON as RCVALL_ON, + RCVALL_SOCKETLEVELONLY as RCVALL_SOCKETLEVELONLY, + SCM_CREDENTIALS as SCM_CREDENTIALS, + SCM_CREDS as SCM_CREDS, + SCM_J1939_DEST_ADDR as SCM_J1939_DEST_ADDR, + SCM_J1939_DEST_NAME as SCM_J1939_DEST_NAME, + SCM_J1939_ERRQUEUE as SCM_J1939_ERRQUEUE, + SCM_J1939_PRIO as SCM_J1939_PRIO, + SCM_RIGHTS as SCM_RIGHTS, + SHUT_RD as SHUT_RD, + SHUT_RDWR as SHUT_RDWR, + SHUT_WR as SHUT_WR, + SIO_KEEPALIVE_VALS as SIO_KEEPALIVE_VALS, + SIO_LOOPBACK_FAST_PATH as SIO_LOOPBACK_FAST_PATH, + SIO_RCVALL as SIO_RCVALL, + SIOCGIFINDEX as SIOCGIFINDEX, + SIOCGIFNAME as SIOCGIFNAME, + SO_ACCEPTCONN as SO_ACCEPTCONN, + SO_BINDTODEVICE as SO_BINDTODEVICE, + SO_BINDTOIFINDEX as SO_BINDTOIFINDEX, + SO_BROADCAST as SO_BROADCAST, + SO_BTH_ENCRYPT as SO_BTH_ENCRYPT, + SO_BTH_MTU as SO_BTH_MTU, + SO_BTH_MTU_MAX as SO_BTH_MTU_MAX, + SO_BTH_MTU_MIN as SO_BTH_MTU_MIN, + SO_DEBUG as SO_DEBUG, + SO_DOMAIN as SO_DOMAIN, + SO_DONTROUTE as SO_DONTROUTE, + SO_ERROR as SO_ERROR, + SO_EXCLUSIVEADDRUSE as SO_EXCLUSIVEADDRUSE, + SO_INCOMING_CPU as SO_INCOMING_CPU, + SO_J1939_ERRQUEUE as SO_J1939_ERRQUEUE, + SO_J1939_FILTER as SO_J1939_FILTER, + SO_J1939_PROMISC as SO_J1939_PROMISC, + SO_J1939_SEND_PRIO as SO_J1939_SEND_PRIO, + SO_KEEPALIVE as SO_KEEPALIVE, + SO_LINGER as SO_LINGER, + SO_MARK as SO_MARK, + SO_OOBINLINE as SO_OOBINLINE, + SO_ORIGINAL_DST as SO_ORIGINAL_DST, + SO_PASSCRED as SO_PASSCRED, + SO_PASSSEC as SO_PASSSEC, + SO_PEERCRED as SO_PEERCRED, + SO_PEERSEC as SO_PEERSEC, + SO_PRIORITY as SO_PRIORITY, + SO_PROTOCOL as SO_PROTOCOL, + SO_RCVBUF as SO_RCVBUF, + SO_RCVLOWAT as SO_RCVLOWAT, + SO_RCVTIMEO as SO_RCVTIMEO, + SO_REUSEADDR as SO_REUSEADDR, + SO_REUSEPORT as SO_REUSEPORT, + SO_SETFIB as SO_SETFIB, + SO_SNDBUF as SO_SNDBUF, + SO_SNDLOWAT as SO_SNDLOWAT, + SO_SNDTIMEO as SO_SNDTIMEO, + SO_TYPE as SO_TYPE, + SO_USELOOPBACK as SO_USELOOPBACK, + SO_VM_SOCKETS_BUFFER_MAX_SIZE as SO_VM_SOCKETS_BUFFER_MAX_SIZE, + SO_VM_SOCKETS_BUFFER_MIN_SIZE as SO_VM_SOCKETS_BUFFER_MIN_SIZE, + SO_VM_SOCKETS_BUFFER_SIZE as SO_VM_SOCKETS_BUFFER_SIZE, + SOCK_CLOEXEC as SOCK_CLOEXEC, + SOCK_DGRAM as SOCK_DGRAM, + SOCK_NONBLOCK as SOCK_NONBLOCK, + SOCK_RAW as SOCK_RAW, + SOCK_RDM as SOCK_RDM, + SOCK_SEQPACKET as SOCK_SEQPACKET, + SOCK_STREAM as SOCK_STREAM, + SOL_ALG as SOL_ALG, + SOL_CAN_BASE as SOL_CAN_BASE, + SOL_CAN_RAW as SOL_CAN_RAW, + SOL_HCI as SOL_HCI, + SOL_IP as SOL_IP, + SOL_RDS as SOL_RDS, + SOL_RFCOMM as SOL_RFCOMM, + SOL_SOCKET as SOL_SOCKET, + SOL_TCP as SOL_TCP, + SOL_TIPC as SOL_TIPC, + SOL_UDP as SOL_UDP, + SOMAXCONN as SOMAXCONN, + SYSPROTO_CONTROL as SYSPROTO_CONTROL, + TCP_CC_INFO as TCP_CC_INFO, + TCP_CONGESTION as TCP_CONGESTION, + TCP_CONNECTION_INFO as TCP_CONNECTION_INFO, + TCP_CORK as TCP_CORK, + TCP_DEFER_ACCEPT as TCP_DEFER_ACCEPT, + TCP_FASTOPEN as TCP_FASTOPEN, + TCP_FASTOPEN_CONNECT as TCP_FASTOPEN_CONNECT, + TCP_FASTOPEN_KEY as TCP_FASTOPEN_KEY, + TCP_FASTOPEN_NO_COOKIE as TCP_FASTOPEN_NO_COOKIE, + TCP_INFO as TCP_INFO, + TCP_INQ as TCP_INQ, + TCP_KEEPALIVE as TCP_KEEPALIVE, + TCP_KEEPCNT as TCP_KEEPCNT, + TCP_KEEPIDLE as TCP_KEEPIDLE, + TCP_KEEPINTVL as TCP_KEEPINTVL, + TCP_LINGER2 as TCP_LINGER2, + TCP_MAXSEG as TCP_MAXSEG, + TCP_MD5SIG as TCP_MD5SIG, + TCP_MD5SIG_EXT as TCP_MD5SIG_EXT, + TCP_NODELAY as TCP_NODELAY, + TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT, + TCP_QUEUE_SEQ as TCP_QUEUE_SEQ, + TCP_QUICKACK as TCP_QUICKACK, + TCP_REPAIR as TCP_REPAIR, + TCP_REPAIR_OPTIONS as TCP_REPAIR_OPTIONS, + TCP_REPAIR_QUEUE as TCP_REPAIR_QUEUE, + TCP_REPAIR_WINDOW as TCP_REPAIR_WINDOW, + TCP_SAVE_SYN as TCP_SAVE_SYN, + TCP_SAVED_SYN as TCP_SAVED_SYN, + TCP_SYNCNT as TCP_SYNCNT, + TCP_THIN_DUPACK as TCP_THIN_DUPACK, + TCP_THIN_LINEAR_TIMEOUTS as TCP_THIN_LINEAR_TIMEOUTS, + TCP_TIMESTAMP as TCP_TIMESTAMP, + TCP_TX_DELAY as TCP_TX_DELAY, + TCP_ULP as TCP_ULP, + TCP_USER_TIMEOUT as TCP_USER_TIMEOUT, + TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP, + TCP_ZEROCOPY_RECEIVE as TCP_ZEROCOPY_RECEIVE, + TIPC_ADDR_ID as TIPC_ADDR_ID, + TIPC_ADDR_NAME as TIPC_ADDR_NAME, + TIPC_ADDR_NAMESEQ as TIPC_ADDR_NAMESEQ, + TIPC_CFG_SRV as TIPC_CFG_SRV, + TIPC_CLUSTER_SCOPE as TIPC_CLUSTER_SCOPE, + TIPC_CONN_TIMEOUT as TIPC_CONN_TIMEOUT, + TIPC_CRITICAL_IMPORTANCE as TIPC_CRITICAL_IMPORTANCE, + TIPC_DEST_DROPPABLE as TIPC_DEST_DROPPABLE, + TIPC_HIGH_IMPORTANCE as TIPC_HIGH_IMPORTANCE, + TIPC_IMPORTANCE as TIPC_IMPORTANCE, + TIPC_LOW_IMPORTANCE as TIPC_LOW_IMPORTANCE, + TIPC_MEDIUM_IMPORTANCE as TIPC_MEDIUM_IMPORTANCE, + TIPC_NODE_SCOPE as TIPC_NODE_SCOPE, + TIPC_PUBLISHED as TIPC_PUBLISHED, + TIPC_SRC_DROPPABLE as TIPC_SRC_DROPPABLE, + TIPC_SUB_CANCEL as TIPC_SUB_CANCEL, + TIPC_SUB_PORTS as TIPC_SUB_PORTS, + TIPC_SUB_SERVICE as TIPC_SUB_SERVICE, + TIPC_SUBSCR_TIMEOUT as TIPC_SUBSCR_TIMEOUT, + TIPC_TOP_SRV as TIPC_TOP_SRV, + TIPC_WAIT_FOREVER as TIPC_WAIT_FOREVER, + TIPC_WITHDRAWN as TIPC_WITHDRAWN, + TIPC_ZONE_SCOPE as TIPC_ZONE_SCOPE, + UDPLITE_RECV_CSCOV as UDPLITE_RECV_CSCOV, + UDPLITE_SEND_CSCOV as UDPLITE_SEND_CSCOV, + VM_SOCKETS_INVALID_VERSION as VM_SOCKETS_INVALID_VERSION, + VMADDR_CID_ANY as VMADDR_CID_ANY, + VMADDR_CID_HOST as VMADDR_CID_HOST, + VMADDR_CID_LOCAL as VMADDR_CID_LOCAL, + VMADDR_PORT_ANY as VMADDR_PORT_ANY, + WSA_FLAG_OVERLAPPED as WSA_FLAG_OVERLAPPED, + WSA_INVALID_HANDLE as WSA_INVALID_HANDLE, + WSA_INVALID_PARAMETER as WSA_INVALID_PARAMETER, + WSA_IO_INCOMPLETE as WSA_IO_INCOMPLETE, + WSA_IO_PENDING as WSA_IO_PENDING, + WSA_NOT_ENOUGH_MEMORY as WSA_NOT_ENOUGH_MEMORY, + WSA_OPERATION_ABORTED as WSA_OPERATION_ABORTED, + WSA_WAIT_FAILED as WSA_WAIT_FAILED, + WSA_WAIT_TIMEOUT as WSA_WAIT_TIMEOUT, + ) diff --git a/contrib/python/trio/trio/testing/__init__.py b/contrib/python/trio/trio/testing/__init__.py new file mode 100644 index 000000000000..d93d33aab7d9 --- /dev/null +++ b/contrib/python/trio/trio/testing/__init__.py @@ -0,0 +1,39 @@ +# Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) + +from .._core import ( + MockClock as MockClock, + wait_all_tasks_blocked as wait_all_tasks_blocked, +) +from .._threads import ( + active_thread_count as active_thread_count, + wait_all_threads_completed as wait_all_threads_completed, +) +from .._util import fixup_module_metadata +from ._check_streams import ( + check_half_closeable_stream as check_half_closeable_stream, + check_one_way_stream as check_one_way_stream, + check_two_way_stream as check_two_way_stream, +) +from ._checkpoints import ( + assert_checkpoints as assert_checkpoints, + assert_no_checkpoints as assert_no_checkpoints, +) +from ._memory_streams import ( + MemoryReceiveStream as MemoryReceiveStream, + MemorySendStream as MemorySendStream, + lockstep_stream_one_way_pair as lockstep_stream_one_way_pair, + lockstep_stream_pair as lockstep_stream_pair, + memory_stream_one_way_pair as memory_stream_one_way_pair, + memory_stream_pair as memory_stream_pair, + memory_stream_pump as memory_stream_pump, +) +from ._network import open_stream_to_socket_listener as open_stream_to_socket_listener +from ._raises_group import Matcher as Matcher, RaisesGroup as RaisesGroup +from ._sequencer import Sequencer as Sequencer +from ._trio_test import trio_test as trio_test + +################################################################ + + +fixup_module_metadata(__name__, globals()) +del fixup_module_metadata diff --git a/contrib/python/trio/trio/testing/_check_streams.py b/contrib/python/trio/trio/testing/_check_streams.py new file mode 100644 index 000000000000..e58e2ddfed2f --- /dev/null +++ b/contrib/python/trio/trio/testing/_check_streams.py @@ -0,0 +1,569 @@ +# Generic stream tests +from __future__ import annotations + +import random +import sys +from collections.abc import Awaitable, Callable, Generator +from contextlib import contextmanager, suppress +from typing import ( + TYPE_CHECKING, + Generic, + TypeVar, +) + +from .. import CancelScope, _core +from .._abc import AsyncResource, HalfCloseableStream, ReceiveStream, SendStream, Stream +from .._highlevel_generic import aclose_forcefully +from ._checkpoints import assert_checkpoints + +if TYPE_CHECKING: + from types import TracebackType + + from typing_extensions import ParamSpec, TypeAlias + + ArgsT = ParamSpec("ArgsT") + +if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup + +Res1 = TypeVar("Res1", bound=AsyncResource) +Res2 = TypeVar("Res2", bound=AsyncResource) +StreamMaker: TypeAlias = Callable[[], Awaitable[tuple[Res1, Res2]]] + + +class _ForceCloseBoth(Generic[Res1, Res2]): + def __init__(self, both: tuple[Res1, Res2]) -> None: + self._first, self._second = both + + async def __aenter__(self) -> tuple[Res1, Res2]: + return self._first, self._second + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + try: + await aclose_forcefully(self._first) + finally: + await aclose_forcefully(self._second) + + +# This is used in this file instead of pytest.raises in order to avoid a dependency +# on pytest, as the check_* functions are publicly exported. +@contextmanager +def _assert_raises( + expected_exc: type[BaseException], + wrapped: bool = False, +) -> Generator[None, None, None]: + __tracebackhide__ = True + try: + yield + except BaseExceptionGroup as exc: + assert wrapped, "caught exceptiongroup, but expected an unwrapped exception" + # assert in except block ignored below + assert len(exc.exceptions) == 1 # noqa: PT017 + assert isinstance(exc.exceptions[0], expected_exc) # noqa: PT017 + except expected_exc: + assert not wrapped, "caught exception, but expected an exceptiongroup" + else: + raise AssertionError(f"expected exception: {expected_exc}") + + +async def check_one_way_stream( + stream_maker: StreamMaker[SendStream, ReceiveStream], + clogged_stream_maker: StreamMaker[SendStream, ReceiveStream] | None, +) -> None: + """Perform a number of generic tests on a custom one-way stream + implementation. + + Args: + stream_maker: An async (!) function which returns a connected + (:class:`~trio.abc.SendStream`, :class:`~trio.abc.ReceiveStream`) + pair. + clogged_stream_maker: Either None, or an async function similar to + stream_maker, but with the extra property that the returned stream + is in a state where ``send_all`` and + ``wait_send_all_might_not_block`` will block until ``receive_some`` + has been called. This allows for more thorough testing of some edge + cases, especially around ``wait_send_all_might_not_block``. + + Raises: + AssertionError: if a test fails. + + """ + async with _ForceCloseBoth(await stream_maker()) as (s, r): + assert isinstance(s, SendStream) + assert isinstance(r, ReceiveStream) + + async def do_send_all(data: bytes | bytearray | memoryview) -> None: + with assert_checkpoints(): # We're testing that it doesn't return anything. + assert await s.send_all(data) is None # type: ignore[func-returns-value] + + async def do_receive_some(max_bytes: int | None = None) -> bytes | bytearray: + with assert_checkpoints(): + return await r.receive_some(max_bytes) + + async def checked_receive_1(expected: bytes) -> None: + assert await do_receive_some(1) == expected + + async def do_aclose(resource: AsyncResource) -> None: + with assert_checkpoints(): + await resource.aclose() + + # Simple sending/receiving + async with _core.open_nursery() as nursery: + nursery.start_soon(do_send_all, b"x") + nursery.start_soon(checked_receive_1, b"x") + + async def send_empty_then_y() -> None: + # Streams should tolerate sending b"" without giving it any + # special meaning. + await do_send_all(b"") + await do_send_all(b"y") + + async with _core.open_nursery() as nursery: + nursery.start_soon(send_empty_then_y) + nursery.start_soon(checked_receive_1, b"y") + + # ---- Checking various argument types ---- + + # send_all accepts bytearray and memoryview + async with _core.open_nursery() as nursery: + nursery.start_soon(do_send_all, bytearray(b"1")) + nursery.start_soon(checked_receive_1, b"1") + + async with _core.open_nursery() as nursery: + nursery.start_soon(do_send_all, memoryview(b"2")) + nursery.start_soon(checked_receive_1, b"2") + + # max_bytes must be a positive integer + with _assert_raises(ValueError): + await r.receive_some(-1) + with _assert_raises(ValueError): + await r.receive_some(0) + with _assert_raises(TypeError): + await r.receive_some(1.5) # type: ignore[arg-type] + # it can also be missing or None + async with _core.open_nursery() as nursery: + nursery.start_soon(do_send_all, b"x") + assert await do_receive_some() == b"x" + async with _core.open_nursery() as nursery: + nursery.start_soon(do_send_all, b"x") + assert await do_receive_some(None) == b"x" + + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(do_receive_some, 1) + nursery.start_soon(do_receive_some, 1) + + # Method always has to exist, and an empty stream with a blocked + # receive_some should *always* allow send_all. (Technically it's legal + # for send_all to wait until receive_some is called to run, though; a + # stream doesn't *have* to have any internal buffering. That's why we + # start a concurrent receive_some call, then cancel it.) + async def simple_check_wait_send_all_might_not_block( + scope: CancelScope, + ) -> None: + with assert_checkpoints(): + await s.wait_send_all_might_not_block() + scope.cancel() + + async with _core.open_nursery() as nursery: + nursery.start_soon( + simple_check_wait_send_all_might_not_block, + nursery.cancel_scope, + ) + nursery.start_soon(do_receive_some, 1) + + # closing the r side leads to BrokenResourceError on the s side + # (eventually) + async def expect_broken_stream_on_send() -> None: + with _assert_raises(_core.BrokenResourceError): + while True: + await do_send_all(b"x" * 100) + + async with _core.open_nursery() as nursery: + nursery.start_soon(expect_broken_stream_on_send) + nursery.start_soon(do_aclose, r) + + # once detected, the stream stays broken + with _assert_raises(_core.BrokenResourceError): + await do_send_all(b"x" * 100) + + # r closed -> ClosedResourceError on the receive side + with _assert_raises(_core.ClosedResourceError): + await do_receive_some(4096) + + # we can close the same stream repeatedly, it's fine + await do_aclose(r) + await do_aclose(r) + + # closing the sender side + await do_aclose(s) + + # now trying to send raises ClosedResourceError + with _assert_raises(_core.ClosedResourceError): + await do_send_all(b"x" * 100) + + # even if it's an empty send + with _assert_raises(_core.ClosedResourceError): + await do_send_all(b"") + + # ditto for wait_send_all_might_not_block + with _assert_raises(_core.ClosedResourceError): + with assert_checkpoints(): + await s.wait_send_all_might_not_block() + + # and again, repeated closing is fine + await do_aclose(s) + await do_aclose(s) + + async with _ForceCloseBoth(await stream_maker()) as (s, r): + # if send-then-graceful-close, receiver gets data then b"" + async def send_then_close() -> None: + await do_send_all(b"y") + await do_aclose(s) + + async def receive_send_then_close() -> None: + # We want to make sure that if the sender closes the stream before + # we read anything, then we still get all the data. But some + # streams might block on the do_send_all call. So we let the + # sender get as far as it can, then we receive. + await _core.wait_all_tasks_blocked() + await checked_receive_1(b"y") + await checked_receive_1(b"") + await do_aclose(r) + + async with _core.open_nursery() as nursery: + nursery.start_soon(send_then_close) + nursery.start_soon(receive_send_then_close) + + async with _ForceCloseBoth(await stream_maker()) as (s, r): + await aclose_forcefully(r) + + with _assert_raises(_core.BrokenResourceError): + while True: + await do_send_all(b"x" * 100) + + with _assert_raises(_core.ClosedResourceError): + await do_receive_some(4096) + + async with _ForceCloseBoth(await stream_maker()) as (s, r): + await aclose_forcefully(s) + + with _assert_raises(_core.ClosedResourceError): + await do_send_all(b"123") + + # after the sender does a forceful close, the receiver might either + # get BrokenResourceError or a clean b""; either is OK. Not OK would be + # if it freezes, or returns data. + with suppress(_core.BrokenResourceError): + await checked_receive_1(b"") + + # cancelled aclose still closes + async with _ForceCloseBoth(await stream_maker()) as (s, r): + with _core.CancelScope() as scope: + scope.cancel() + await r.aclose() + + with _core.CancelScope() as scope: + scope.cancel() + await s.aclose() + + with _assert_raises(_core.ClosedResourceError): + await do_send_all(b"123") + + with _assert_raises(_core.ClosedResourceError): + await do_receive_some(4096) + + # Check that we can still gracefully close a stream after an operation has + # been cancelled. This can be challenging if cancellation can leave the + # stream internals in an inconsistent state, e.g. for + # SSLStream. Unfortunately this test isn't very thorough; the really + # challenging case for something like SSLStream is it gets cancelled + # *while* it's sending data on the underlying, not before. But testing + # that requires some special-case handling of the particular stream setup; + # we can't do it here. Maybe we could do a bit better with + # https://github.com/python-trio/trio/issues/77 + async with _ForceCloseBoth(await stream_maker()) as (s, r): + + async def expect_cancelled( + afn: Callable[ArgsT, Awaitable[object]], + *args: ArgsT.args, + **kwargs: ArgsT.kwargs, + ) -> None: + with _assert_raises(_core.Cancelled): + await afn(*args, **kwargs) + + with _core.CancelScope() as scope: + scope.cancel() + async with _core.open_nursery() as nursery: + nursery.start_soon(expect_cancelled, do_send_all, b"x") + nursery.start_soon(expect_cancelled, do_receive_some, 1) + + async with _core.open_nursery() as nursery: + nursery.start_soon(do_aclose, s) + nursery.start_soon(do_aclose, r) + + # Check that if a task is blocked in receive_some, then closing the + # receive stream causes it to wake up. + async with _ForceCloseBoth(await stream_maker()) as (s, r): + + async def receive_expecting_closed() -> None: + with _assert_raises(_core.ClosedResourceError): + await r.receive_some(10) + + async with _core.open_nursery() as nursery: + nursery.start_soon(receive_expecting_closed) + await _core.wait_all_tasks_blocked() + await aclose_forcefully(r) + + # check wait_send_all_might_not_block, if we can + if clogged_stream_maker is not None: + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + record: list[str] = [] + + async def waiter(cancel_scope: CancelScope) -> None: + record.append("waiter sleeping") + with assert_checkpoints(): + await s.wait_send_all_might_not_block() + record.append("waiter wokeup") + cancel_scope.cancel() + + async def receiver() -> None: + # give wait_send_all_might_not_block a chance to block + await _core.wait_all_tasks_blocked() + record.append("receiver starting") + while True: + await r.receive_some(16834) + + async with _core.open_nursery() as nursery: + nursery.start_soon(waiter, nursery.cancel_scope) + await _core.wait_all_tasks_blocked() + nursery.start_soon(receiver) + + assert record == [ + "waiter sleeping", + "receiver starting", + "waiter wokeup", + ] + + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + # simultaneous wait_send_all_might_not_block fails + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(s.wait_send_all_might_not_block) + nursery.start_soon(s.wait_send_all_might_not_block) + + # and simultaneous send_all and wait_send_all_might_not_block (NB + # this test might destroy the stream b/c we end up cancelling + # send_all and e.g. SSLStream can't handle that, so we have to + # recreate afterwards) + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(s.wait_send_all_might_not_block) + nursery.start_soon(s.send_all, b"123") + + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + # send_all and send_all blocked simultaneously should also raise + # (but again this might destroy the stream) + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(s.send_all, b"123") + nursery.start_soon(s.send_all, b"123") + + # closing the receiver causes wait_send_all_might_not_block to return, + # with or without an exception + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + + async def sender() -> None: + try: + with assert_checkpoints(): + await s.wait_send_all_might_not_block() + except _core.BrokenResourceError: # pragma: no cover + pass + + async def receiver() -> None: + await _core.wait_all_tasks_blocked() + await aclose_forcefully(r) + + async with _core.open_nursery() as nursery: + nursery.start_soon(sender) + nursery.start_soon(receiver) + + # and again with the call starting after the close + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + await aclose_forcefully(r) + try: + with assert_checkpoints(): + await s.wait_send_all_might_not_block() + except _core.BrokenResourceError: # pragma: no cover + pass + + # Check that if a task is blocked in a send-side method, then closing + # the send stream causes it to wake up. + async def close_soon(s: SendStream) -> None: + await _core.wait_all_tasks_blocked() + await aclose_forcefully(s) + + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + async with _core.open_nursery() as nursery: + nursery.start_soon(close_soon, s) + with _assert_raises(_core.ClosedResourceError): + await s.send_all(b"xyzzy") + + async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + async with _core.open_nursery() as nursery: + nursery.start_soon(close_soon, s) + with _assert_raises(_core.ClosedResourceError): + await s.wait_send_all_might_not_block() + + +async def check_two_way_stream( + stream_maker: StreamMaker[Stream, Stream], + clogged_stream_maker: StreamMaker[Stream, Stream] | None, +) -> None: + """Perform a number of generic tests on a custom two-way stream + implementation. + + This is similar to :func:`check_one_way_stream`, except that the maker + functions are expected to return objects implementing the + :class:`~trio.abc.Stream` interface. + + This function tests a *superset* of what :func:`check_one_way_stream` + checks – if you call this, then you don't need to also call + :func:`check_one_way_stream`. + + """ + await check_one_way_stream(stream_maker, clogged_stream_maker) + + async def flipped_stream_maker() -> tuple[Stream, Stream]: + return (await stream_maker())[::-1] + + flipped_clogged_stream_maker: Callable[[], Awaitable[tuple[Stream, Stream]]] | None + + if clogged_stream_maker is not None: + + async def flipped_clogged_stream_maker() -> tuple[Stream, Stream]: + return (await clogged_stream_maker())[::-1] + + else: + flipped_clogged_stream_maker = None + await check_one_way_stream(flipped_stream_maker, flipped_clogged_stream_maker) + + async with _ForceCloseBoth(await stream_maker()) as (s1, s2): + assert isinstance(s1, Stream) + assert isinstance(s2, Stream) + + # Duplex can be a bit tricky, might as well check it as well + DUPLEX_TEST_SIZE = 2**20 + CHUNK_SIZE_MAX = 2**14 + + r = random.Random(0) + i = r.getrandbits(8 * DUPLEX_TEST_SIZE) + test_data = i.to_bytes(DUPLEX_TEST_SIZE, "little") + + async def sender( + s: Stream, + data: bytes | bytearray | memoryview, + seed: int, + ) -> None: + r = random.Random(seed) + m = memoryview(data) + while m: + chunk_size = r.randint(1, CHUNK_SIZE_MAX) + await s.send_all(m[:chunk_size]) + m = m[chunk_size:] + + async def receiver(s: Stream, data: bytes | bytearray, seed: int) -> None: + r = random.Random(seed) + got = bytearray() + while len(got) < len(data): + chunk = await s.receive_some(r.randint(1, CHUNK_SIZE_MAX)) + assert chunk + got += chunk + assert got == data + + async with _core.open_nursery() as nursery: + nursery.start_soon(sender, s1, test_data, 0) + nursery.start_soon(sender, s2, test_data[::-1], 1) + nursery.start_soon(receiver, s1, test_data[::-1], 2) + nursery.start_soon(receiver, s2, test_data, 3) + + async def expect_receive_some_empty() -> None: + assert await s2.receive_some(10) == b"" + await s2.aclose() + + async with _core.open_nursery() as nursery: + nursery.start_soon(expect_receive_some_empty) + nursery.start_soon(s1.aclose) + + +async def check_half_closeable_stream( + stream_maker: StreamMaker[HalfCloseableStream, HalfCloseableStream], + clogged_stream_maker: StreamMaker[HalfCloseableStream, HalfCloseableStream] | None, +) -> None: + """Perform a number of generic tests on a custom half-closeable stream + implementation. + + This is similar to :func:`check_two_way_stream`, except that the maker + functions are expected to return objects that implement the + :class:`~trio.abc.HalfCloseableStream` interface. + + This function tests a *superset* of what :func:`check_two_way_stream` + checks – if you call this, then you don't need to also call + :func:`check_two_way_stream`. + + """ + await check_two_way_stream(stream_maker, clogged_stream_maker) + + async with _ForceCloseBoth(await stream_maker()) as (s1, s2): + assert isinstance(s1, HalfCloseableStream) + assert isinstance(s2, HalfCloseableStream) + + async def send_x_then_eof(s: HalfCloseableStream) -> None: + await s.send_all(b"x") + with assert_checkpoints(): + await s.send_eof() + + async def expect_x_then_eof(r: HalfCloseableStream) -> None: + await _core.wait_all_tasks_blocked() + assert await r.receive_some(10) == b"x" + assert await r.receive_some(10) == b"" + + async with _core.open_nursery() as nursery: + nursery.start_soon(send_x_then_eof, s1) + nursery.start_soon(expect_x_then_eof, s2) + + # now sending is disallowed + with _assert_raises(_core.ClosedResourceError): + await s1.send_all(b"y") + + # but we can do send_eof again + with assert_checkpoints(): + await s1.send_eof() + + # and we can still send stuff back the other way + async with _core.open_nursery() as nursery: + nursery.start_soon(send_x_then_eof, s2) + nursery.start_soon(expect_x_then_eof, s1) + + if clogged_stream_maker is not None: + async with _ForceCloseBoth(await clogged_stream_maker()) as (s1, s2): + # send_all and send_eof simultaneously is not ok + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(s1.send_all, b"x") + await _core.wait_all_tasks_blocked() + nursery.start_soon(s1.send_eof) + + async with _ForceCloseBoth(await clogged_stream_maker()) as (s1, s2): + # wait_send_all_might_not_block and send_eof simultaneously is not + # ok either + with _assert_raises(_core.BusyResourceError, wrapped=True): + async with _core.open_nursery() as nursery: + nursery.start_soon(s1.wait_send_all_might_not_block) + await _core.wait_all_tasks_blocked() + nursery.start_soon(s1.send_eof) diff --git a/contrib/python/trio/trio/testing/_checkpoints.py b/contrib/python/trio/trio/testing/_checkpoints.py new file mode 100644 index 000000000000..e51463f0713c --- /dev/null +++ b/contrib/python/trio/trio/testing/_checkpoints.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from contextlib import AbstractContextManager, contextmanager +from typing import TYPE_CHECKING + +from .. import _core + +if TYPE_CHECKING: + from collections.abc import Generator + + +@contextmanager +def _assert_yields_or_not(expected: bool) -> Generator[None, None, None]: + """Check if checkpoints are executed in a block of code.""" + __tracebackhide__ = True + task = _core.current_task() + orig_cancel = task._cancel_points + orig_schedule = task._schedule_points + try: + yield + if expected and ( + task._cancel_points == orig_cancel or task._schedule_points == orig_schedule + ): + raise AssertionError("assert_checkpoints block did not yield!") + finally: + if not expected and ( + task._cancel_points != orig_cancel or task._schedule_points != orig_schedule + ): + raise AssertionError("assert_no_checkpoints block yielded!") + + +def assert_checkpoints() -> AbstractContextManager[None]: + """Use as a context manager to check that the code inside the ``with`` + block either exits with an exception or executes at least one + :ref:`checkpoint `. + + Raises: + AssertionError: if no checkpoint was executed. + + Example: + Check that :func:`trio.sleep` is a checkpoint, even if it doesn't + block:: + + with trio.testing.assert_checkpoints(): + await trio.sleep(0) + + """ + __tracebackhide__ = True + return _assert_yields_or_not(True) + + +def assert_no_checkpoints() -> AbstractContextManager[None]: + """Use as a context manager to check that the code inside the ``with`` + block does not execute any :ref:`checkpoints `. + + Raises: + AssertionError: if a checkpoint was executed. + + Example: + Synchronous code never contains any checkpoints, but we can double-check + that:: + + send_channel, receive_channel = trio.open_memory_channel(10) + with trio.testing.assert_no_checkpoints(): + send_channel.send_nowait(None) + + """ + __tracebackhide__ = True + return _assert_yields_or_not(False) diff --git a/contrib/python/trio/trio/testing/_fake_net.py b/contrib/python/trio/trio/testing/_fake_net.py new file mode 100644 index 000000000000..5d63112e17ca --- /dev/null +++ b/contrib/python/trio/trio/testing/_fake_net.py @@ -0,0 +1,590 @@ +# This should eventually be cleaned up and become public, but for right now I'm just +# implementing enough to test DTLS. + +# TODO: +# - user-defined routers +# - TCP +# - UDP broadcast + +from __future__ import annotations + +import contextlib +import errno +import ipaddress +import os +import socket +import sys +from typing import ( + TYPE_CHECKING, + Any, + NoReturn, + Union, + overload, +) + +import attrs + +import trio +from trio._util import NoPublicConstructor, final + +if TYPE_CHECKING: + import builtins + from collections.abc import Iterable + from socket import AddressFamily, SocketKind + from types import TracebackType + + from typing_extensions import Buffer, Self, TypeAlias + + from trio._socket import AddressFormat + +IPAddress: TypeAlias = Union[ipaddress.IPv4Address, ipaddress.IPv6Address] + + +def _family_for(ip: IPAddress) -> int: + if isinstance(ip, ipaddress.IPv4Address): + return trio.socket.AF_INET + elif isinstance(ip, ipaddress.IPv6Address): + return trio.socket.AF_INET6 + raise NotImplementedError("Unhandled IPAddress instance type") # pragma: no cover + + +def _wildcard_ip_for(family: int) -> IPAddress: + if family == trio.socket.AF_INET: + return ipaddress.ip_address("0.0.0.0") + elif family == trio.socket.AF_INET6: + return ipaddress.ip_address("::") + raise NotImplementedError("Unhandled ip address family") # pragma: no cover + + +# not used anywhere +def _localhost_ip_for(family: int) -> IPAddress: # pragma: no cover + if family == trio.socket.AF_INET: + return ipaddress.ip_address("127.0.0.1") + elif family == trio.socket.AF_INET6: + return ipaddress.ip_address("::1") + raise NotImplementedError("Unhandled ip address family") + + +def _fake_err(code: int) -> NoReturn: + raise OSError(code, os.strerror(code)) + + +def _scatter(data: bytes, buffers: Iterable[Buffer]) -> int: + written = 0 + for buf in buffers: # pragma: no branch + next_piece = data[written : written + memoryview(buf).nbytes] + with memoryview(buf) as mbuf: + mbuf[: len(next_piece)] = next_piece + written += len(next_piece) + if written == len(data): # pragma: no branch + break + return written + + +@attrs.frozen +class UDPEndpoint: + ip: IPAddress + port: int + + def as_python_sockaddr(self) -> tuple[str, int] | tuple[str, int, int, int]: + sockaddr: tuple[str, int] | tuple[str, int, int, int] = ( + self.ip.compressed, + self.port, + ) + if isinstance(self.ip, ipaddress.IPv6Address): + sockaddr += (0, 0) # type: ignore[assignment] + return sockaddr + + @classmethod + def from_python_sockaddr( + cls, + sockaddr: tuple[str, int] | tuple[str, int, int, int], + ) -> UDPEndpoint: + ip, port = sockaddr[:2] + return cls(ip=ipaddress.ip_address(ip), port=port) + + +@attrs.frozen +class UDPBinding: + local: UDPEndpoint + # remote: UDPEndpoint # ?? + + +@attrs.frozen +class UDPPacket: + source: UDPEndpoint + destination: UDPEndpoint + payload: bytes = attrs.field(repr=lambda p: p.hex()) + + # not used/tested anywhere + def reply(self, payload: bytes) -> UDPPacket: # pragma: no cover + return UDPPacket( + source=self.destination, + destination=self.source, + payload=payload, + ) + + +@attrs.frozen +class FakeSocketFactory(trio.abc.SocketFactory): + fake_net: FakeNet + + def socket(self, family: int, type_: int, proto: int) -> FakeSocket: # type: ignore[override] + return FakeSocket._create(self.fake_net, family, type_, proto) + + +@attrs.frozen +class FakeHostnameResolver(trio.abc.HostnameResolver): + fake_net: FakeNet + + async def getaddrinfo( + self, + host: bytes | None, + port: bytes | str | int | None, + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, + ) -> list[ + tuple[ + AddressFamily, + SocketKind, + int, + str, + tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], + ] + ]: + raise NotImplementedError("FakeNet doesn't do fake DNS yet") + + async def getnameinfo( + self, + sockaddr: tuple[str, int] | tuple[str, int, int, int], + flags: int, + ) -> tuple[str, str]: + raise NotImplementedError("FakeNet doesn't do fake DNS yet") + + +@final +class FakeNet: + def __init__(self) -> None: + # When we need to pick an arbitrary unique ip address/port, use these: + self._auto_ipv4_iter = ipaddress.IPv4Network("1.0.0.0/8").hosts() # untested + self._auto_ipv6_iter = ipaddress.IPv6Network("1::/16").hosts() # untested + self._auto_port_iter = iter(range(50000, 65535)) + + self._bound: dict[UDPBinding, FakeSocket] = {} + + self.route_packet = None + + def _bind(self, binding: UDPBinding, socket: FakeSocket) -> None: + if binding in self._bound: + _fake_err(errno.EADDRINUSE) + self._bound[binding] = socket + + def enable(self) -> None: + trio.socket.set_custom_socket_factory(FakeSocketFactory(self)) + trio.socket.set_custom_hostname_resolver(FakeHostnameResolver(self)) + + def send_packet(self, packet: UDPPacket) -> None: + if self.route_packet is None: + self.deliver_packet(packet) + else: + self.route_packet(packet) + + def deliver_packet(self, packet: UDPPacket) -> None: + binding = UDPBinding(local=packet.destination) + if binding in self._bound: + self._bound[binding]._deliver_packet(packet) + else: + # No valid destination, so drop it + pass + + +@final +class FakeSocket(trio.socket.SocketType, metaclass=NoPublicConstructor): + def __init__( + self, + fake_net: FakeNet, + family: AddressFamily, + type: SocketKind, + proto: int, + ) -> None: + self._fake_net = fake_net + + if not family: # pragma: no cover + family = trio.socket.AF_INET + if not type: # pragma: no cover + type = trio.socket.SOCK_STREAM # noqa: A001 # name shadowing builtin + + if family not in (trio.socket.AF_INET, trio.socket.AF_INET6): + raise NotImplementedError(f"FakeNet doesn't (yet) support family={family}") + if type != trio.socket.SOCK_DGRAM: + raise NotImplementedError(f"FakeNet doesn't (yet) support type={type}") + + self._family = family + self._type = type + self._proto = proto + + self._closed = False + + self._packet_sender, self._packet_receiver = trio.open_memory_channel[ + UDPPacket + ](float("inf")) + + # This is the source-of-truth for what port etc. this socket is bound to + self._binding: UDPBinding | None = None + + @property + def type(self) -> SocketKind: + return self._type + + @property + def family(self) -> AddressFamily: + return self._family + + @property + def proto(self) -> int: + return self._proto + + def _check_closed(self) -> None: + if self._closed: + _fake_err(errno.EBADF) + + def close(self) -> None: + if self._closed: + return + self._closed = True + if self._binding is not None: + del self._fake_net._bound[self._binding] + self._packet_receiver.close() + + async def _resolve_address_nocp( + self, + address: object, + *, + local: bool, + ) -> tuple[str, int]: + return await trio._socket._resolve_address_nocp( # type: ignore[no-any-return] + self.type, + self.family, + self.proto, + address=address, + ipv6_v6only=False, + local=local, + ) + + def _deliver_packet(self, packet: UDPPacket) -> None: + # sending to a closed socket -- UDP packets get dropped + with contextlib.suppress(trio.BrokenResourceError): + self._packet_sender.send_nowait(packet) + + ################################################################ + # Actual IO operation implementations + ################################################################ + + async def bind(self, addr: object) -> None: + self._check_closed() + if self._binding is not None: + _fake_err(errno.EINVAL) + await trio.lowlevel.checkpoint() + ip_str, port, *_ = await self._resolve_address_nocp(addr, local=True) + assert _ == [], "TODO: handle other values?" + + ip = ipaddress.ip_address(ip_str) + assert _family_for(ip) == self.family + # We convert binds to INET_ANY into binds to localhost + if ip == ipaddress.ip_address("0.0.0.0"): + ip = ipaddress.ip_address("127.0.0.1") + elif ip == ipaddress.ip_address("::"): + ip = ipaddress.ip_address("::1") + if port == 0: + port = next(self._fake_net._auto_port_iter) + binding = UDPBinding(local=UDPEndpoint(ip, port)) + self._fake_net._bind(binding, self) + self._binding = binding + + async def connect(self, peer: object) -> NoReturn: + raise NotImplementedError("FakeNet does not (yet) support connected sockets") + + async def _sendmsg( + self, + buffers: Iterable[Buffer], + ancdata: Iterable[tuple[int, int, Buffer]] = (), + flags: int = 0, + address: AddressFormat | None = None, + ) -> int: + self._check_closed() + + await trio.lowlevel.checkpoint() + + if address is not None: + address = await self._resolve_address_nocp(address, local=False) + if ancdata: + raise NotImplementedError("FakeNet doesn't support ancillary data") + if flags: + raise NotImplementedError(f"FakeNet send flags must be 0, not {flags}") + + if address is None: + _fake_err(errno.ENOTCONN) + + destination = UDPEndpoint.from_python_sockaddr(address) + + if self._binding is None: + await self.bind((_wildcard_ip_for(self.family).compressed, 0)) + + payload = b"".join(buffers) + + assert self._binding is not None + packet = UDPPacket( + source=self._binding.local, + destination=destination, + payload=payload, + ) + + self._fake_net.send_packet(packet) + + return len(payload) + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(socket.socket, "sendmsg") + ): + sendmsg = _sendmsg + + async def _recvmsg_into( + self, + buffers: Iterable[Buffer], + ancbufsize: int = 0, + flags: int = 0, + ) -> tuple[ + int, + list[tuple[int, int, bytes]], + int, + tuple[str, int] | tuple[str, int, int, int], + ]: + if ancbufsize != 0: + raise NotImplementedError("FakeNet doesn't support ancillary data") + if flags != 0: + raise NotImplementedError("FakeNet doesn't support any recv flags") + if self._binding is None: + # I messed this up a few times when writing tests ... but it also never happens + # in any of the existing tests, so maybe it could be intentional... + raise NotImplementedError( + "The code will most likely hang if you try to receive on a fakesocket " + "without a binding. If that is not the case, or you explicitly want to " + "test that, remove this warning.", + ) + + self._check_closed() + + ancdata: list[tuple[int, int, bytes]] = [] + msg_flags = 0 + + packet = await self._packet_receiver.receive() + address = packet.source.as_python_sockaddr() + written = _scatter(packet.payload, buffers) + if written < len(packet.payload): + msg_flags |= trio.socket.MSG_TRUNC + return written, ancdata, msg_flags, address + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(socket.socket, "sendmsg") + ): + recvmsg_into = _recvmsg_into + + ################################################################ + # Simple state query stuff + ################################################################ + + def getsockname(self) -> tuple[str, int] | tuple[str, int, int, int]: + self._check_closed() + if self._binding is not None: + return self._binding.local.as_python_sockaddr() + elif self.family == trio.socket.AF_INET: + return ("0.0.0.0", 0) + else: + assert self.family == trio.socket.AF_INET6 + return ("::", 0) + + # TODO: This method is not tested, and seems to make incorrect assumptions. It should maybe raise NotImplementedError. + def getpeername(self) -> tuple[str, int] | tuple[str, int, int, int]: + self._check_closed() + if self._binding is not None: + assert hasattr( + self._binding, + "remote", + ), "This method seems to assume that self._binding has a remote UDPEndpoint" + if self._binding.remote is not None: # pragma: no cover + assert isinstance( + self._binding.remote, + UDPEndpoint, + ), "Self._binding.remote should be a UDPEndpoint" + return self._binding.remote.as_python_sockaddr() + _fake_err(errno.ENOTCONN) + + @overload + def getsockopt(self, /, level: int, optname: int) -> int: ... + + @overload + def getsockopt(self, /, level: int, optname: int, buflen: int) -> bytes: ... + + def getsockopt( + self, + /, + level: int, + optname: int, + buflen: int | None = None, + ) -> int | bytes: + self._check_closed() + raise OSError(f"FakeNet doesn't implement getsockopt({level}, {optname})") + + @overload + def setsockopt(self, /, level: int, optname: int, value: int | Buffer) -> None: ... + + @overload + def setsockopt( + self, + /, + level: int, + optname: int, + value: None, + optlen: int, + ) -> None: ... + + def setsockopt( + self, + /, + level: int, + optname: int, + value: int | Buffer | None, + optlen: int | None = None, + ) -> None: + self._check_closed() + + if (level, optname) == ( + trio.socket.IPPROTO_IPV6, + trio.socket.IPV6_V6ONLY, + ) and not value: + raise NotImplementedError("FakeNet always has IPV6_V6ONLY=True") + + raise OSError(f"FakeNet doesn't implement setsockopt({level}, {optname}, ...)") + + ################################################################ + # Various boilerplate and trivial stubs + ################################################################ + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: builtins.type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: + self.close() + + async def send(self, data: Buffer, flags: int = 0) -> int: + return await self.sendto(data, flags, None) + + # __ prefixed arguments because typeshed uses that and typechecker issues + @overload + async def sendto( + self, + __data: Buffer, # noqa: PYI063 + __address: tuple[object, ...] | str | Buffer, + ) -> int: ... + + # __ prefixed arguments because typeshed uses that and typechecker issues + @overload + async def sendto( + self, + __data: Buffer, # noqa: PYI063 + __flags: int, + __address: tuple[object, ...] | str | Buffer | None, + ) -> int: ... + + async def sendto( # type: ignore[explicit-any] + self, + *args: Any, + ) -> int: + data: Buffer + flags: int + address: tuple[object, ...] | str | Buffer + if len(args) == 2: + data, address = args + flags = 0 + elif len(args) == 3: + data, flags, address = args + else: + raise TypeError("wrong number of arguments") + return await self._sendmsg([data], [], flags, address) + + async def recv(self, bufsize: int, flags: int = 0) -> bytes: + data, _address = await self.recvfrom(bufsize, flags) + return data + + async def recv_into(self, buf: Buffer, nbytes: int = 0, flags: int = 0) -> int: + got_bytes, _address = await self.recvfrom_into(buf, nbytes, flags) + return got_bytes + + async def recvfrom( + self, + bufsize: int, + flags: int = 0, + ) -> tuple[bytes, AddressFormat]: + data, _ancdata, _msg_flags, address = await self._recvmsg(bufsize, flags) + return data, address + + async def recvfrom_into( + self, + buf: Buffer, + nbytes: int = 0, + flags: int = 0, + ) -> tuple[int, AddressFormat]: + if nbytes != 0 and nbytes != memoryview(buf).nbytes: + raise NotImplementedError("partial recvfrom_into") + got_nbytes, _ancdata, _msg_flags, address = await self._recvmsg_into( + [buf], + 0, + flags, + ) + return got_nbytes, address + + async def _recvmsg( + self, + bufsize: int, + ancbufsize: int = 0, + flags: int = 0, + ) -> tuple[bytes, list[tuple[int, int, bytes]], int, AddressFormat]: + buf = bytearray(bufsize) + got_nbytes, ancdata, msg_flags, address = await self._recvmsg_into( + [buf], + ancbufsize, + flags, + ) + return (bytes(buf[:got_nbytes]), ancdata, msg_flags, address) + + if sys.platform != "win32" or ( + not TYPE_CHECKING and hasattr(socket.socket, "sendmsg") + ): + recvmsg = _recvmsg + + def fileno(self) -> int: + raise NotImplementedError("can't get fileno() for FakeNet sockets") + + def detach(self) -> int: + raise NotImplementedError("can't detach() a FakeNet socket") + + def get_inheritable(self) -> bool: + return False + + def set_inheritable(self, inheritable: bool) -> None: + if inheritable: + raise NotImplementedError("FakeNet can't make inheritable sockets") + + if sys.platform == "win32" or ( + not TYPE_CHECKING and hasattr(socket.socket, "share") + ): + + def share(self, process_id: int) -> bytes: + raise NotImplementedError("FakeNet can't share sockets") diff --git a/contrib/python/trio/trio/testing/_memory_streams.py b/contrib/python/trio/trio/testing/_memory_streams.py new file mode 100644 index 000000000000..547d8afbe96c --- /dev/null +++ b/contrib/python/trio/trio/testing/_memory_streams.py @@ -0,0 +1,637 @@ +from __future__ import annotations + +import operator +from collections.abc import Awaitable, Callable +from typing import TYPE_CHECKING, TypeVar + +from .. import _core, _util +from .._highlevel_generic import StapledStream +from ..abc import ReceiveStream, SendStream + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + + +AsyncHook: TypeAlias = Callable[[], Awaitable[object]] +# Would be nice to exclude awaitable here, but currently not possible. +SyncHook: TypeAlias = Callable[[], object] +SendStreamT = TypeVar("SendStreamT", bound=SendStream) +ReceiveStreamT = TypeVar("ReceiveStreamT", bound=ReceiveStream) + + +################################################################ +# In-memory streams - Unbounded buffer version +################################################################ + + +class _UnboundedByteQueue: + def __init__(self) -> None: + self._data = bytearray() + self._closed = False + self._lot = _core.ParkingLot() + self._fetch_lock = _util.ConflictDetector( + "another task is already fetching data", + ) + + # This object treats "close" as being like closing the send side of a + # channel: so after close(), calling put() raises ClosedResourceError, and + # calling the get() variants drains the buffer and then returns an empty + # bytearray. + def close(self) -> None: + self._closed = True + self._lot.unpark_all() + + def close_and_wipe(self) -> None: + self._data = bytearray() + self.close() + + def put(self, data: bytes | bytearray | memoryview) -> None: + if self._closed: + raise _core.ClosedResourceError("virtual connection closed") + self._data += data + self._lot.unpark_all() + + def _check_max_bytes(self, max_bytes: int | None) -> None: + if max_bytes is None: + return + max_bytes = operator.index(max_bytes) + if max_bytes < 1: + raise ValueError("max_bytes must be >= 1") + + def _get_impl(self, max_bytes: int | None) -> bytearray: + assert self._closed or self._data + if max_bytes is None: + max_bytes = len(self._data) + if self._data: + chunk = self._data[:max_bytes] + del self._data[:max_bytes] + assert chunk + return chunk + else: + return bytearray() + + def get_nowait(self, max_bytes: int | None = None) -> bytearray: + with self._fetch_lock: + self._check_max_bytes(max_bytes) + if not self._closed and not self._data: + raise _core.WouldBlock + return self._get_impl(max_bytes) + + async def get(self, max_bytes: int | None = None) -> bytearray: + with self._fetch_lock: + self._check_max_bytes(max_bytes) + if not self._closed and not self._data: + await self._lot.park() + else: + await _core.checkpoint() + return self._get_impl(max_bytes) + + +@_util.final +class MemorySendStream(SendStream): + """An in-memory :class:`~trio.abc.SendStream`. + + Args: + send_all_hook: An async function, or None. Called from + :meth:`send_all`. Can do whatever you like. + wait_send_all_might_not_block_hook: An async function, or None. Called + from :meth:`wait_send_all_might_not_block`. Can do whatever you + like. + close_hook: A synchronous function, or None. Called from :meth:`close` + and :meth:`aclose`. Can do whatever you like. + + .. attribute:: send_all_hook + wait_send_all_might_not_block_hook + close_hook + + All of these hooks are also exposed as attributes on the object, and + you can change them at any time. + + """ + + def __init__( + self, + send_all_hook: AsyncHook | None = None, + wait_send_all_might_not_block_hook: AsyncHook | None = None, + close_hook: SyncHook | None = None, + ) -> None: + self._conflict_detector = _util.ConflictDetector( + "another task is using this stream", + ) + self._outgoing = _UnboundedByteQueue() + self.send_all_hook = send_all_hook + self.wait_send_all_might_not_block_hook = wait_send_all_might_not_block_hook + self.close_hook = close_hook + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + """Places the given data into the object's internal buffer, and then + calls the :attr:`send_all_hook` (if any). + + """ + # Execute two checkpoints so we have more of a chance to detect + # buggy user code that calls this twice at the same time. + with self._conflict_detector: + await _core.checkpoint() + await _core.checkpoint() + self._outgoing.put(data) + if self.send_all_hook is not None: + await self.send_all_hook() + + async def wait_send_all_might_not_block(self) -> None: + """Calls the :attr:`wait_send_all_might_not_block_hook` (if any), and + then returns immediately. + + """ + # Execute two checkpoints so that we have more of a chance to detect + # buggy user code that calls this twice at the same time. + with self._conflict_detector: + await _core.checkpoint() + await _core.checkpoint() + # check for being closed: + self._outgoing.put(b"") + if self.wait_send_all_might_not_block_hook is not None: + await self.wait_send_all_might_not_block_hook() + + def close(self) -> None: + """Marks this stream as closed, and then calls the :attr:`close_hook` + (if any). + + """ + # XXX should this cancel any pending calls to the send_all_hook and + # wait_send_all_might_not_block_hook? Those are the only places where + # send_all and wait_send_all_might_not_block can be blocked. + # + # The way we set things up, send_all_hook is memory_stream_pump, and + # wait_send_all_might_not_block_hook is unset. memory_stream_pump is + # synchronous. So normally, send_all and wait_send_all_might_not_block + # cannot block at all. + self._outgoing.close() + if self.close_hook is not None: + self.close_hook() + + async def aclose(self) -> None: + """Same as :meth:`close`, but async.""" + self.close() + await _core.checkpoint() + + async def get_data(self, max_bytes: int | None = None) -> bytearray: + """Retrieves data from the internal buffer, blocking if necessary. + + Args: + max_bytes (int or None): The maximum amount of data to + retrieve. None (the default) means to retrieve all the data + that's present (but still blocks until at least one byte is + available). + + Returns: + If this stream has been closed, an empty bytearray. Otherwise, the + requested data. + + """ + return await self._outgoing.get(max_bytes) + + def get_data_nowait(self, max_bytes: int | None = None) -> bytearray: + """Retrieves data from the internal buffer, but doesn't block. + + See :meth:`get_data` for details. + + Raises: + trio.WouldBlock: if no data is available to retrieve. + + """ + return self._outgoing.get_nowait(max_bytes) + + +@_util.final +class MemoryReceiveStream(ReceiveStream): + """An in-memory :class:`~trio.abc.ReceiveStream`. + + Args: + receive_some_hook: An async function, or None. Called from + :meth:`receive_some`. Can do whatever you like. + close_hook: A synchronous function, or None. Called from :meth:`close` + and :meth:`aclose`. Can do whatever you like. + + .. attribute:: receive_some_hook + close_hook + + Both hooks are also exposed as attributes on the object, and you can + change them at any time. + + """ + + def __init__( + self, + receive_some_hook: AsyncHook | None = None, + close_hook: SyncHook | None = None, + ) -> None: + self._conflict_detector = _util.ConflictDetector( + "another task is using this stream", + ) + self._incoming = _UnboundedByteQueue() + self._closed = False + self.receive_some_hook = receive_some_hook + self.close_hook = close_hook + + async def receive_some(self, max_bytes: int | None = None) -> bytearray: + """Calls the :attr:`receive_some_hook` (if any), and then retrieves + data from the internal buffer, blocking if necessary. + + """ + # Execute two checkpoints so we have more of a chance to detect + # buggy user code that calls this twice at the same time. + with self._conflict_detector: + await _core.checkpoint() + await _core.checkpoint() + if self._closed: + raise _core.ClosedResourceError + if self.receive_some_hook is not None: + await self.receive_some_hook() + # self._incoming's closure state tracks whether we got an EOF. + # self._closed tracks whether we, ourselves, are closed. + # self.close() sends an EOF to wake us up and sets self._closed, + # so after we wake up we have to check self._closed again. + data = await self._incoming.get(max_bytes) + if self._closed: + raise _core.ClosedResourceError + return data + + def close(self) -> None: + """Discards any pending data from the internal buffer, and marks this + stream as closed. + + """ + self._closed = True + self._incoming.close_and_wipe() + if self.close_hook is not None: + self.close_hook() + + async def aclose(self) -> None: + """Same as :meth:`close`, but async.""" + self.close() + await _core.checkpoint() + + def put_data(self, data: bytes | bytearray | memoryview) -> None: + """Appends the given data to the internal buffer.""" + self._incoming.put(data) + + def put_eof(self) -> None: + """Adds an end-of-file marker to the internal buffer.""" + self._incoming.close() + + +# TODO: investigate why this is necessary for the docs +MemorySendStream.__module__ = MemorySendStream.__module__.replace( + "._memory_streams", "" +) +MemoryReceiveStream.__module__ = MemoryReceiveStream.__module__.replace( + "._memory_streams", "" +) + + +def memory_stream_pump( + memory_send_stream: MemorySendStream, + memory_receive_stream: MemoryReceiveStream, + *, + max_bytes: int | None = None, +) -> bool: + """Take data out of the given :class:`MemorySendStream`'s internal buffer, + and put it into the given :class:`MemoryReceiveStream`'s internal buffer. + + Args: + memory_send_stream (MemorySendStream): The stream to get data from. + memory_receive_stream (MemoryReceiveStream): The stream to put data into. + max_bytes (int or None): The maximum amount of data to transfer in this + call, or None to transfer all available data. + + Returns: + True if it successfully transferred some data, or False if there was no + data to transfer. + + This is used to implement :func:`memory_stream_one_way_pair` and + :func:`memory_stream_pair`; see the latter's docstring for an example + of how you might use it yourself. + + """ + try: + data = memory_send_stream.get_data_nowait(max_bytes) + except _core.WouldBlock: + return False + try: + if not data: + memory_receive_stream.put_eof() + else: + memory_receive_stream.put_data(data) + except _core.ClosedResourceError: + raise _core.BrokenResourceError("MemoryReceiveStream was closed") from None + return True + + +def memory_stream_one_way_pair() -> tuple[MemorySendStream, MemoryReceiveStream]: + """Create a connected, pure-Python, unidirectional stream with infinite + buffering and flexible configuration options. + + You can think of this as being a no-operating-system-involved + Trio-streamsified version of :func:`os.pipe` (except that :func:`os.pipe` + returns the streams in the wrong order – we follow the superior convention + that data flows from left to right). + + Returns: + A tuple (:class:`MemorySendStream`, :class:`MemoryReceiveStream`), where + the :class:`MemorySendStream` has its hooks set up so that it calls + :func:`memory_stream_pump` from its + :attr:`~MemorySendStream.send_all_hook` and + :attr:`~MemorySendStream.close_hook`. + + The end result is that data automatically flows from the + :class:`MemorySendStream` to the :class:`MemoryReceiveStream`. But you're + also free to rearrange things however you like. For example, you can + temporarily set the :attr:`~MemorySendStream.send_all_hook` to None if you + want to simulate a stall in data transmission. Or see + :func:`memory_stream_pair` for a more elaborate example. + + """ + send_stream = MemorySendStream() + recv_stream = MemoryReceiveStream() + + def pump_from_send_stream_to_recv_stream() -> None: + memory_stream_pump(send_stream, recv_stream) + + # await not used + async def async_pump_from_send_stream_to_recv_stream() -> None: # noqa: RUF029 + pump_from_send_stream_to_recv_stream() + + send_stream.send_all_hook = async_pump_from_send_stream_to_recv_stream + send_stream.close_hook = pump_from_send_stream_to_recv_stream + return send_stream, recv_stream + + +def _make_stapled_pair( + one_way_pair: Callable[[], tuple[SendStreamT, ReceiveStreamT]], +) -> tuple[ + StapledStream[SendStreamT, ReceiveStreamT], + StapledStream[SendStreamT, ReceiveStreamT], +]: + pipe1_send, pipe1_recv = one_way_pair() + pipe2_send, pipe2_recv = one_way_pair() + stream1 = StapledStream(pipe1_send, pipe2_recv) + stream2 = StapledStream(pipe2_send, pipe1_recv) + return stream1, stream2 + + +def memory_stream_pair() -> tuple[ + StapledStream[MemorySendStream, MemoryReceiveStream], + StapledStream[MemorySendStream, MemoryReceiveStream], +]: + """Create a connected, pure-Python, bidirectional stream with infinite + buffering and flexible configuration options. + + This is a convenience function that creates two one-way streams using + :func:`memory_stream_one_way_pair`, and then uses + :class:`~trio.StapledStream` to combine them into a single bidirectional + stream. + + This is like a no-operating-system-involved, Trio-streamsified version of + :func:`socket.socketpair`. + + Returns: + A pair of :class:`~trio.StapledStream` objects that are connected so + that data automatically flows from one to the other in both directions. + + After creating a stream pair, you can send data back and forth, which is + enough for simple tests:: + + left, right = memory_stream_pair() + await left.send_all(b"123") + assert await right.receive_some() == b"123" + await right.send_all(b"456") + assert await left.receive_some() == b"456" + + But if you read the docs for :class:`~trio.StapledStream` and + :func:`memory_stream_one_way_pair`, you'll see that all the pieces + involved in wiring this up are public APIs, so you can adjust to suit the + requirements of your tests. For example, here's how to tweak a stream so + that data flowing from left to right trickles in one byte at a time (but + data flowing from right to left proceeds at full speed):: + + left, right = memory_stream_pair() + async def trickle(): + # left is a StapledStream, and left.send_stream is a MemorySendStream + # right is a StapledStream, and right.recv_stream is a MemoryReceiveStream + while memory_stream_pump(left.send_stream, right.recv_stream, max_bytes=1): + # Pause between each byte + await trio.sleep(1) + # Normally this send_all_hook calls memory_stream_pump directly without + # passing in a max_bytes. We replace it with our custom version: + left.send_stream.send_all_hook = trickle + + And here's a simple test using our modified stream objects:: + + async def sender(): + await left.send_all(b"12345") + await left.send_eof() + + async def receiver(): + async for data in right: + print(data) + + async with trio.open_nursery() as nursery: + nursery.start_soon(sender) + nursery.start_soon(receiver) + + By default, this will print ``b"12345"`` and then immediately exit; with + our trickle stream it instead sleeps 1 second, then prints ``b"1"``, then + sleeps 1 second, then prints ``b"2"``, etc. + + Pro-tip: you can insert sleep calls (like in our example above) to + manipulate the flow of data across tasks... and then use + :class:`MockClock` and its :attr:`~MockClock.autojump_threshold` + functionality to keep your test suite running quickly. + + If you want to stress test a protocol implementation, one nice trick is to + use the :mod:`random` module (preferably with a fixed seed) to move random + numbers of bytes at a time, and insert random sleeps in between them. You + can also set up a custom :attr:`~MemoryReceiveStream.receive_some_hook` if + you want to manipulate things on the receiving side, and not just the + sending side. + + """ + return _make_stapled_pair(memory_stream_one_way_pair) + + +################################################################ +# In-memory streams - Lockstep version +################################################################ + + +class _LockstepByteQueue: + def __init__(self) -> None: + self._data = bytearray() + self._sender_closed = False + self._receiver_closed = False + self._receiver_waiting = False + self._waiters = _core.ParkingLot() + self._send_conflict_detector = _util.ConflictDetector( + "another task is already sending", + ) + self._receive_conflict_detector = _util.ConflictDetector( + "another task is already receiving", + ) + + def _something_happened(self) -> None: + self._waiters.unpark_all() + + # Always wakes up when one side is closed, because everyone always reacts + # to that. + async def _wait_for(self, fn: Callable[[], bool]) -> None: + while True: + if fn(): + break + if self._sender_closed or self._receiver_closed: + break + await self._waiters.park() + await _core.checkpoint() + + def close_sender(self) -> None: + self._sender_closed = True + self._something_happened() + + def close_receiver(self) -> None: + self._receiver_closed = True + self._something_happened() + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + with self._send_conflict_detector: + if self._sender_closed: + raise _core.ClosedResourceError + if self._receiver_closed: + raise _core.BrokenResourceError + assert not self._data + self._data += data + self._something_happened() + await self._wait_for(lambda: self._data == b"") + if self._sender_closed: + raise _core.ClosedResourceError + if self._data and self._receiver_closed: + raise _core.BrokenResourceError + + async def wait_send_all_might_not_block(self) -> None: + with self._send_conflict_detector: + if self._sender_closed: + raise _core.ClosedResourceError + if self._receiver_closed: + await _core.checkpoint() + return + await self._wait_for(lambda: self._receiver_waiting) + if self._sender_closed: + raise _core.ClosedResourceError + + async def receive_some(self, max_bytes: int | None = None) -> bytes | bytearray: + with self._receive_conflict_detector: + # Argument validation + if max_bytes is not None: + max_bytes = operator.index(max_bytes) + if max_bytes < 1: + raise ValueError("max_bytes must be >= 1") + # State validation + if self._receiver_closed: + raise _core.ClosedResourceError + # Wake wait_send_all_might_not_block and wait for data + self._receiver_waiting = True + self._something_happened() + try: + await self._wait_for(lambda: self._data != b"") + finally: + self._receiver_waiting = False + if self._receiver_closed: + raise _core.ClosedResourceError + # Get data, possibly waking send_all + if self._data: + # Neat trick: if max_bytes is None, then obj[:max_bytes] is + # the same as obj[:]. + got = self._data[:max_bytes] + del self._data[:max_bytes] + self._something_happened() + return got + else: + assert self._sender_closed + return b"" + + +class _LockstepSendStream(SendStream): + def __init__(self, lbq: _LockstepByteQueue) -> None: + self._lbq = lbq + + def close(self) -> None: + self._lbq.close_sender() + + async def aclose(self) -> None: + self.close() + await _core.checkpoint() + + async def send_all(self, data: bytes | bytearray | memoryview) -> None: + await self._lbq.send_all(data) + + async def wait_send_all_might_not_block(self) -> None: + await self._lbq.wait_send_all_might_not_block() + + +class _LockstepReceiveStream(ReceiveStream): + def __init__(self, lbq: _LockstepByteQueue) -> None: + self._lbq = lbq + + def close(self) -> None: + self._lbq.close_receiver() + + async def aclose(self) -> None: + self.close() + await _core.checkpoint() + + async def receive_some(self, max_bytes: int | None = None) -> bytes | bytearray: + return await self._lbq.receive_some(max_bytes) + + +def lockstep_stream_one_way_pair() -> tuple[SendStream, ReceiveStream]: + """Create a connected, pure Python, unidirectional stream where data flows + in lockstep. + + Returns: + A tuple + (:class:`~trio.abc.SendStream`, :class:`~trio.abc.ReceiveStream`). + + This stream has *absolutely no* buffering. Each call to + :meth:`~trio.abc.SendStream.send_all` will block until all the given data + has been returned by a call to + :meth:`~trio.abc.ReceiveStream.receive_some`. + + This can be useful for testing flow control mechanisms in an extreme case, + or for setting up "clogged" streams to use with + :func:`check_one_way_stream` and friends. + + In addition to fulfilling the :class:`~trio.abc.SendStream` and + :class:`~trio.abc.ReceiveStream` interfaces, the return objects + also have a synchronous ``close`` method. + + """ + + lbq = _LockstepByteQueue() + return _LockstepSendStream(lbq), _LockstepReceiveStream(lbq) + + +def lockstep_stream_pair() -> tuple[ + StapledStream[SendStream, ReceiveStream], + StapledStream[SendStream, ReceiveStream], +]: + """Create a connected, pure-Python, bidirectional stream where data flows + in lockstep. + + Returns: + A tuple (:class:`~trio.StapledStream`, :class:`~trio.StapledStream`). + + This is a convenience function that creates two one-way streams using + :func:`lockstep_stream_one_way_pair`, and then uses + :class:`~trio.StapledStream` to combine them into a single bidirectional + stream. + + """ + return _make_stapled_pair(lockstep_stream_one_way_pair) diff --git a/contrib/python/trio/trio/testing/_network.py b/contrib/python/trio/trio/testing/_network.py new file mode 100644 index 000000000000..fddbbf0fdc70 --- /dev/null +++ b/contrib/python/trio/trio/testing/_network.py @@ -0,0 +1,36 @@ +from .. import socket as tsocket +from .._highlevel_socket import SocketListener, SocketStream + + +async def open_stream_to_socket_listener( + socket_listener: SocketListener, +) -> SocketStream: + """Connect to the given :class:`~trio.SocketListener`. + + This is particularly useful in tests when you want to let a server pick + its own port, and then connect to it:: + + listeners = await trio.open_tcp_listeners(0) + client = await trio.testing.open_stream_to_socket_listener(listeners[0]) + + Args: + socket_listener (~trio.SocketListener): The + :class:`~trio.SocketListener` to connect to. + + Returns: + SocketStream: a stream connected to the given listener. + + """ + family = socket_listener.socket.family + sockaddr = socket_listener.socket.getsockname() + if family in (tsocket.AF_INET, tsocket.AF_INET6): + sockaddr = list(sockaddr) + if sockaddr[0] == "0.0.0.0": + sockaddr[0] = "127.0.0.1" + if sockaddr[0] == "::": + sockaddr[0] = "::1" + sockaddr = tuple(sockaddr) + + sock = tsocket.socket(family=family) + await sock.connect(sockaddr) + return SocketStream(sock) diff --git a/contrib/python/trio/trio/testing/_raises_group.py b/contrib/python/trio/trio/testing/_raises_group.py new file mode 100644 index 000000000000..6001e4dab106 --- /dev/null +++ b/contrib/python/trio/trio/testing/_raises_group.py @@ -0,0 +1,1021 @@ +from __future__ import annotations + +import re +import sys +from abc import ABC, abstractmethod +from re import Pattern +from textwrap import indent +from typing import ( + TYPE_CHECKING, + Generic, + Literal, + cast, + overload, +) + +from trio._util import final + +if TYPE_CHECKING: + import builtins + + # sphinx will *only* work if we use types.TracebackType, and import + # *inside* TYPE_CHECKING. No other combination works..... + import types + from collections.abc import Callable, Sequence + + from _pytest._code.code import ExceptionChainRepr, ReprExceptionInfo, Traceback + from typing_extensions import TypeGuard, TypeVar + + # this conditional definition is because we want to allow a TypeVar default + MatchE = TypeVar( + "MatchE", + bound=BaseException, + default=BaseException, + covariant=True, + ) +else: + from typing import TypeVar + + MatchE = TypeVar("MatchE", bound=BaseException, covariant=True) + +# RaisesGroup doesn't work with a default. +BaseExcT_co = TypeVar("BaseExcT_co", bound=BaseException, covariant=True) +BaseExcT_1 = TypeVar("BaseExcT_1", bound=BaseException) +BaseExcT_2 = TypeVar("BaseExcT_2", bound=BaseException) +ExcT_1 = TypeVar("ExcT_1", bound=Exception) +ExcT_2 = TypeVar("ExcT_2", bound=Exception) + +if sys.version_info < (3, 11): + from exceptiongroup import BaseExceptionGroup, ExceptionGroup + + +@final +class _ExceptionInfo(Generic[MatchE]): + """Minimal re-implementation of pytest.ExceptionInfo, only used if pytest is not available. Supports a subset of its features necessary for functionality of :class:`trio.testing.RaisesGroup` and :class:`trio.testing.Matcher`.""" + + _excinfo: tuple[type[MatchE], MatchE, types.TracebackType] | None + + def __init__( + self, + excinfo: tuple[type[MatchE], MatchE, types.TracebackType] | None, + ) -> None: + self._excinfo = excinfo + + def fill_unfilled( + self, + exc_info: tuple[type[MatchE], MatchE, types.TracebackType], + ) -> None: + """Fill an unfilled ExceptionInfo created with ``for_later()``.""" + assert self._excinfo is None, "ExceptionInfo was already filled" + self._excinfo = exc_info + + @classmethod + def for_later(cls) -> _ExceptionInfo[MatchE]: + """Return an unfilled ExceptionInfo.""" + return cls(None) + + # Note, special cased in sphinx config, since "type" conflicts. + @property + def type(self) -> type[MatchE]: + """The exception class.""" + assert ( + self._excinfo is not None + ), ".type can only be used after the context manager exits" + return self._excinfo[0] + + @property + def value(self) -> MatchE: + """The exception value.""" + assert ( + self._excinfo is not None + ), ".value can only be used after the context manager exits" + return self._excinfo[1] + + @property + def tb(self) -> types.TracebackType: + """The exception raw traceback.""" + assert ( + self._excinfo is not None + ), ".tb can only be used after the context manager exits" + return self._excinfo[2] + + def exconly(self, tryshort: bool = False) -> str: + raise NotImplementedError( + "This is a helper method only available if you use RaisesGroup with the pytest package installed", + ) + + def errisinstance( + self, + exc: builtins.type[BaseException] | tuple[builtins.type[BaseException], ...], + ) -> bool: + raise NotImplementedError( + "This is a helper method only available if you use RaisesGroup with the pytest package installed", + ) + + def getrepr( + self, + showlocals: bool = False, + style: str = "long", + abspath: bool = False, + tbfilter: bool | Callable[[_ExceptionInfo], Traceback] = True, + funcargs: bool = False, + truncate_locals: bool = True, + chain: bool = True, + ) -> ReprExceptionInfo | ExceptionChainRepr: + raise NotImplementedError( + "This is a helper method only available if you use RaisesGroup with the pytest package installed", + ) + + +# Type checkers are not able to do conditional types depending on installed packages, so +# we've added signatures for all helpers to _ExceptionInfo, and then always use that. +# If this ends up leading to problems, we can resort to always using _ExceptionInfo and +# users that want to use getrepr/errisinstance/exconly can write helpers on their own, or +# we reimplement them ourselves...or get this merged in upstream pytest. +if TYPE_CHECKING: + ExceptionInfo = _ExceptionInfo + +else: + try: + from pytest import ExceptionInfo # noqa: PT013 + except ImportError: # pragma: no cover + ExceptionInfo = _ExceptionInfo + + +# copied from pytest.ExceptionInfo +def _stringify_exception(exc: BaseException) -> str: + return "\n".join( + [ + getattr(exc, "message", str(exc)), + *getattr(exc, "__notes__", []), + ], + ) + + +# String patterns default to including the unicode flag. +_REGEX_NO_FLAGS = re.compile(r"").flags + + +def _match_pattern(match: Pattern[str]) -> str | Pattern[str]: + """helper function to remove redundant `re.compile` calls when printing regex""" + return match.pattern if match.flags == _REGEX_NO_FLAGS else match + + +def repr_callable(fun: Callable[[BaseExcT_1], bool]) -> str: + """Get the repr of a ``check`` parameter. + + Split out so it can be monkeypatched (e.g. by our hypothesis plugin) + """ + return repr(fun) + + +def _exception_type_name(e: type[BaseException]) -> str: + return repr(e.__name__) + + +def _check_raw_type( + expected_type: type[BaseException] | None, + exception: BaseException, +) -> str | None: + if expected_type is None: + return None + + if not isinstance( + exception, + expected_type, + ): + actual_type_str = _exception_type_name(type(exception)) + expected_type_str = _exception_type_name(expected_type) + if isinstance(exception, BaseExceptionGroup) and not issubclass( + expected_type, BaseExceptionGroup + ): + return f"Unexpected nested {actual_type_str}, expected {expected_type_str}" + return f"{actual_type_str} is not of type {expected_type_str}" + return None + + +class AbstractMatcher(ABC, Generic[BaseExcT_co]): + """ABC with common functionality shared between Matcher and RaisesGroup""" + + def __init__( + self, + match: str | Pattern[str] | None, + check: Callable[[BaseExcT_co], bool] | None, + ) -> None: + if isinstance(match, str): + self.match: Pattern[str] | None = re.compile(match) + else: + self.match = match + self.check = check + self._fail_reason: str | None = None + + # used to suppress repeated printing of `repr(self.check)` + self._nested: bool = False + + @property + def fail_reason(self) -> str | None: + """Set after a call to `matches` to give a human-readable + reason for why the match failed. + When used as a context manager the string will be given as the text of an + `AssertionError`""" + return self._fail_reason + + def _check_check( + self: AbstractMatcher[BaseExcT_1], + exception: BaseExcT_1, + ) -> bool: + if self.check is None: + return True + + if self.check(exception): + return True + + check_repr = "" if self._nested else " " + repr_callable(self.check) + self._fail_reason = f"check{check_repr} did not return True" + return False + + def _check_match(self, e: BaseException) -> bool: + if self.match is None or re.search( + self.match, + stringified_exception := _stringify_exception(e), + ): + return True + + maybe_specify_type = ( + f" of {_exception_type_name(type(e))}" + if isinstance(e, BaseExceptionGroup) + else "" + ) + self._fail_reason = f"Regex pattern {_match_pattern(self.match)!r} did not match {stringified_exception!r}{maybe_specify_type}" + if _match_pattern(self.match) == stringified_exception: + self._fail_reason += "\n Did you mean to `re.escape()` the regex?" + return False + + # TODO: when transitioning to pytest, harmonize Matcher and RaisesGroup + # signatures. One names the parameter `exc_val` and the other `exception` + @abstractmethod + def matches( + self: AbstractMatcher[BaseExcT_1], exc_val: BaseException + ) -> TypeGuard[BaseExcT_1]: + """Check if an exception matches the requirements of this AbstractMatcher. + If it fails, `AbstractMatcher.fail_reason` should be set. + """ + + +@final +class Matcher(AbstractMatcher[MatchE]): + """Helper class to be used together with RaisesGroups when you want to specify requirements on sub-exceptions. Only specifying the type is redundant, and it's also unnecessary when the type is a nested `RaisesGroup` since it supports the same arguments. + The type is checked with `isinstance`, and does not need to be an exact match. If that is wanted you can use the ``check`` parameter. + :meth:`Matcher.matches` can also be used standalone to check individual exceptions. + + Examples:: + + with RaisesGroups(Matcher(ValueError, match="string")): + ... + with RaisesGroups(Matcher(check=lambda x: x.args == (3, "hello"))): + ... + with RaisesGroups(Matcher(check=lambda x: type(x) is ValueError)): + ... + + Tip: if you install ``hypothesis`` and import it in ``conftest.py`` you will get + readable ``repr``s of ``check`` callables in the output. + """ + + # At least one of the three parameters must be passed. + @overload + def __init__( + self, + exception_type: type[MatchE], + match: str | Pattern[str] = ..., + check: Callable[[MatchE], bool] = ..., + ) -> None: ... + + @overload + def __init__( + self: Matcher[BaseException], # Give E a value. + *, + match: str | Pattern[str], + # If exception_type is not provided, check() must do any typechecks itself. + check: Callable[[BaseException], bool] = ..., + ) -> None: ... + + @overload + def __init__(self, *, check: Callable[[BaseException], bool]) -> None: ... + + def __init__( + self, + exception_type: type[MatchE] | None = None, + match: str | Pattern[str] | None = None, + check: Callable[[MatchE], bool] | None = None, + ): + super().__init__(match, check) + if exception_type is None and match is None and check is None: + raise ValueError("You must specify at least one parameter to match on.") + if exception_type is not None and not issubclass(exception_type, BaseException): + raise ValueError( + f"exception_type {exception_type} must be a subclass of BaseException", + ) + self.exception_type = exception_type + + def matches( + self, + exception: BaseException, + ) -> TypeGuard[MatchE]: + """Check if an exception matches the requirements of this Matcher. + If it fails, `Matcher.fail_reason` will be set. + + Examples:: + + assert Matcher(ValueError).matches(my_exception) + # is equivalent to + assert isinstance(my_exception, ValueError) + + # this can be useful when checking e.g. the ``__cause__`` of an exception. + with pytest.raises(ValueError) as excinfo: + ... + assert Matcher(SyntaxError, match="foo").matches(excinfo.value.__cause__) + # above line is equivalent to + assert isinstance(excinfo.value.__cause__, SyntaxError) + assert re.search("foo", str(excinfo.value.__cause__)) + + """ + if not self._check_type(exception): + return False + + if not self._check_match(exception): + return False + + return self._check_check(exception) + + def __repr__(self) -> str: + parameters = [] + if self.exception_type is not None: + parameters.append(self.exception_type.__name__) + if self.match is not None: + # If no flags were specified, discard the redundant re.compile() here. + parameters.append( + f"match={_match_pattern(self.match)!r}", + ) + if self.check is not None: + parameters.append(f"check={repr_callable(self.check)}") + return f'Matcher({", ".join(parameters)})' + + def _check_type(self, exception: BaseException) -> TypeGuard[MatchE]: + self._fail_reason = _check_raw_type(self.exception_type, exception) + return self._fail_reason is None + + +@final +class RaisesGroup(AbstractMatcher[BaseExceptionGroup[BaseExcT_co]]): + """Contextmanager for checking for an expected `ExceptionGroup`. + This works similar to ``pytest.raises``, and a version of it will hopefully be added upstream, after which this can be deprecated and removed. See https://github.com/pytest-dev/pytest/issues/11538 + + + The catching behaviour differs from :ref:`except* ` in multiple different ways, being much stricter by default. By using ``allow_unwrapped=True`` and ``flatten_subgroups=True`` you can match ``except*`` fully when expecting a single exception. + + #. All specified exceptions must be present, *and no others*. + + * If you expect a variable number of exceptions you need to use ``pytest.raises(ExceptionGroup)`` and manually check the contained exceptions. Consider making use of :func:`Matcher.matches`. + + #. It will only catch exceptions wrapped in an exceptiongroup by default. + + * With ``allow_unwrapped=True`` you can specify a single expected exception or `Matcher` and it will match the exception even if it is not inside an `ExceptionGroup`. If you expect one of several different exception types you need to use a `Matcher` object. + + #. By default it cares about the full structure with nested `ExceptionGroup`'s. You can specify nested `ExceptionGroup`'s by passing `RaisesGroup` objects as expected exceptions. + + * With ``flatten_subgroups=True`` it will "flatten" the raised `ExceptionGroup`, extracting all exceptions inside any nested :class:`ExceptionGroup`, before matching. + + It does not care about the order of the exceptions, so ``RaisesGroups(ValueError, TypeError)`` is equivalent to ``RaisesGroups(TypeError, ValueError)``. + + Examples:: + + with RaisesGroups(ValueError): + raise ExceptionGroup("", (ValueError(),)) + with RaisesGroups(ValueError, ValueError, Matcher(TypeError, match="expected int")): + ... + with RaisesGroups(KeyboardInterrupt, match="hello", check=lambda x: type(x) is BaseExceptionGroup): + ... + with RaisesGroups(RaisesGroups(ValueError)): + raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),)) + + # flatten_subgroups + with RaisesGroups(ValueError, flatten_subgroups=True): + raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),)) + + # allow_unwrapped + with RaisesGroups(ValueError, allow_unwrapped=True): + raise ValueError + + + `RaisesGroup.matches` can also be used directly to check a standalone exception group. + + + The matching algorithm is greedy, which means cases such as this may fail:: + + with RaisesGroups(ValueError, Matcher(ValueError, match="hello")): + raise ExceptionGroup("", (ValueError("hello"), ValueError("goodbye"))) + + even though it generally does not care about the order of the exceptions in the group. + To avoid the above you should specify the first ValueError with a Matcher as well. + + Tip: if you install ``hypothesis`` and import it in ``conftest.py`` you will get + readable ``repr``s of ``check`` callables in the output. + """ + + # allow_unwrapped=True requires: singular exception, exception not being + # RaisesGroup instance, match is None, check is None + @overload + def __init__( + self, + exception: type[BaseExcT_co] | Matcher[BaseExcT_co], + *, + allow_unwrapped: Literal[True], + flatten_subgroups: bool = False, + ) -> None: ... + + # flatten_subgroups = True also requires no nested RaisesGroup + @overload + def __init__( + self, + exception: type[BaseExcT_co] | Matcher[BaseExcT_co], + *other_exceptions: type[BaseExcT_co] | Matcher[BaseExcT_co], + flatten_subgroups: Literal[True], + match: str | Pattern[str] | None = None, + check: Callable[[BaseExceptionGroup[BaseExcT_co]], bool] | None = None, + ) -> None: ... + + # simplify the typevars if possible (the following 3 are equivalent but go simpler->complicated) + # ... the first handles RaisesGroup[ValueError], the second RaisesGroup[ExceptionGroup[ValueError]], + # the third RaisesGroup[ValueError | ExceptionGroup[ValueError]]. + # ... otherwise, we will get results like RaisesGroup[ValueError | ExceptionGroup[Never]] (I think) + # (technically correct but misleading) + @overload + def __init__( + self: RaisesGroup[ExcT_1], + exception: type[ExcT_1] | Matcher[ExcT_1], + *other_exceptions: type[ExcT_1] | Matcher[ExcT_1], + match: str | Pattern[str] | None = None, + check: Callable[[ExceptionGroup[ExcT_1]], bool] | None = None, + ) -> None: ... + + @overload + def __init__( + self: RaisesGroup[ExceptionGroup[ExcT_2]], + exception: RaisesGroup[ExcT_2], + *other_exceptions: RaisesGroup[ExcT_2], + match: str | Pattern[str] | None = None, + check: Callable[[ExceptionGroup[ExceptionGroup[ExcT_2]]], bool] | None = None, + ) -> None: ... + + @overload + def __init__( + self: RaisesGroup[ExcT_1 | ExceptionGroup[ExcT_2]], + exception: type[ExcT_1] | Matcher[ExcT_1] | RaisesGroup[ExcT_2], + *other_exceptions: type[ExcT_1] | Matcher[ExcT_1] | RaisesGroup[ExcT_2], + match: str | Pattern[str] | None = None, + check: ( + Callable[[ExceptionGroup[ExcT_1 | ExceptionGroup[ExcT_2]]], bool] | None + ) = None, + ) -> None: ... + + # same as the above 3 but handling BaseException + @overload + def __init__( + self: RaisesGroup[BaseExcT_1], + exception: type[BaseExcT_1] | Matcher[BaseExcT_1], + *other_exceptions: type[BaseExcT_1] | Matcher[BaseExcT_1], + match: str | Pattern[str] | None = None, + check: Callable[[BaseExceptionGroup[BaseExcT_1]], bool] | None = None, + ) -> None: ... + + @overload + def __init__( + self: RaisesGroup[BaseExceptionGroup[BaseExcT_2]], + exception: RaisesGroup[BaseExcT_2], + *other_exceptions: RaisesGroup[BaseExcT_2], + match: str | Pattern[str] | None = None, + check: ( + Callable[[BaseExceptionGroup[BaseExceptionGroup[BaseExcT_2]]], bool] | None + ) = None, + ) -> None: ... + + @overload + def __init__( + self: RaisesGroup[BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]], + exception: type[BaseExcT_1] | Matcher[BaseExcT_1] | RaisesGroup[BaseExcT_2], + *other_exceptions: type[BaseExcT_1] + | Matcher[BaseExcT_1] + | RaisesGroup[BaseExcT_2], + match: str | Pattern[str] | None = None, + check: ( + Callable[ + [BaseExceptionGroup[BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]]], + bool, + ] + | None + ) = None, + ) -> None: ... + + def __init__( + self: RaisesGroup[ExcT_1 | BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]], + exception: type[BaseExcT_1] | Matcher[BaseExcT_1] | RaisesGroup[BaseExcT_2], + *other_exceptions: type[BaseExcT_1] + | Matcher[BaseExcT_1] + | RaisesGroup[BaseExcT_2], + allow_unwrapped: bool = False, + flatten_subgroups: bool = False, + match: str | Pattern[str] | None = None, + check: ( + Callable[[BaseExceptionGroup[BaseExcT_1]], bool] + | Callable[[ExceptionGroup[ExcT_1]], bool] + | None + ) = None, + ): + # The type hint on the `self` and `check` parameters uses different formats + # that are *very* hard to reconcile while adhering to the overloads, so we cast + # it to avoid an error when passing it to super().__init__ + check = cast( + "Callable[[" + "BaseExceptionGroup[ExcT_1|BaseExcT_1|BaseExceptionGroup[BaseExcT_2]]" + "], bool]", + check, + ) + super().__init__(match, check) + self.expected_exceptions: tuple[ + type[BaseExcT_co] | Matcher[BaseExcT_co] | RaisesGroup[BaseException], ... + ] = ( + exception, + *other_exceptions, + ) + self.allow_unwrapped = allow_unwrapped + self.flatten_subgroups: bool = flatten_subgroups + self.is_baseexceptiongroup: bool = False + + if allow_unwrapped and other_exceptions: + raise ValueError( + "You cannot specify multiple exceptions with `allow_unwrapped=True.`" + " If you want to match one of multiple possible exceptions you should" + " use a `Matcher`." + " E.g. `Matcher(check=lambda e: isinstance(e, (...)))`", + ) + if allow_unwrapped and isinstance(exception, RaisesGroup): + raise ValueError( + "`allow_unwrapped=True` has no effect when expecting a `RaisesGroup`." + " You might want it in the expected `RaisesGroup`, or" + " `flatten_subgroups=True` if you don't care about the structure.", + ) + if allow_unwrapped and (match is not None or check is not None): + raise ValueError( + "`allow_unwrapped=True` bypasses the `match` and `check` parameters" + " if the exception is unwrapped. If you intended to match/check the" + " exception you should use a `Matcher` object. If you want to match/check" + " the exceptiongroup when the exception *is* wrapped you need to" + " do e.g. `if isinstance(exc.value, ExceptionGroup):" + " assert RaisesGroup(...).matches(exc.value)` afterwards.", + ) + + # verify `expected_exceptions` and set `self.is_baseexceptiongroup` + for exc in self.expected_exceptions: + if isinstance(exc, RaisesGroup): + if self.flatten_subgroups: + raise ValueError( + "You cannot specify a nested structure inside a RaisesGroup with" + " `flatten_subgroups=True`. The parameter will flatten subgroups" + " in the raised exceptiongroup before matching, which would never" + " match a nested structure.", + ) + self.is_baseexceptiongroup |= exc.is_baseexceptiongroup + exc._nested = True + elif isinstance(exc, Matcher): + if exc.exception_type is not None: + # Matcher __init__ assures it's a subclass of BaseException + self.is_baseexceptiongroup |= not issubclass( + exc.exception_type, + Exception, + ) + exc._nested = True + elif isinstance(exc, type) and issubclass(exc, BaseException): + self.is_baseexceptiongroup |= not issubclass(exc, Exception) + else: + raise ValueError( + f'Invalid argument "{exc!r}" must be exception type, Matcher, or' + " RaisesGroup.", + ) + + @overload + def __enter__( + self: RaisesGroup[ExcT_1], + ) -> ExceptionInfo[ExceptionGroup[ExcT_1]]: ... + @overload + def __enter__( + self: RaisesGroup[BaseExcT_1], + ) -> ExceptionInfo[BaseExceptionGroup[BaseExcT_1]]: ... + + def __enter__(self) -> ExceptionInfo[BaseExceptionGroup[BaseException]]: + self.excinfo: ExceptionInfo[BaseExceptionGroup[BaseExcT_co]] = ( + ExceptionInfo.for_later() + ) + return self.excinfo + + def __repr__(self) -> str: + parameters = [ + e.__name__ if isinstance(e, type) else repr(e) + for e in self.expected_exceptions + ] + if self.allow_unwrapped: + parameters.append(f"allow_unwrapped={self.allow_unwrapped}") + if self.flatten_subgroups: + parameters.append(f"flatten_subgroups={self.flatten_subgroups}") + if self.match is not None: + # If no flags were specified, discard the redundant re.compile() here. + parameters.append(f"match={_match_pattern(self.match)!r}") + if self.check is not None: + parameters.append(f"check={repr_callable(self.check)}") + return f"RaisesGroup({', '.join(parameters)})" + + def _unroll_exceptions( + self, + exceptions: Sequence[BaseException], + ) -> Sequence[BaseException]: + """Used if `flatten_subgroups=True`.""" + res: list[BaseException] = [] + for exc in exceptions: + if isinstance(exc, BaseExceptionGroup): + res.extend(self._unroll_exceptions(exc.exceptions)) + + else: + res.append(exc) + return res + + @overload + def matches( + self: RaisesGroup[ExcT_1], + exc_val: BaseException | None, + ) -> TypeGuard[ExceptionGroup[ExcT_1]]: ... + @overload + def matches( + self: RaisesGroup[BaseExcT_1], + exc_val: BaseException | None, + ) -> TypeGuard[BaseExceptionGroup[BaseExcT_1]]: ... + + def matches( + self, + exc_val: BaseException | None, + ) -> TypeGuard[BaseExceptionGroup[BaseExcT_co]]: + """Check if an exception matches the requirements of this RaisesGroup. + If it fails, `RaisesGroup.fail_reason` will be set. + + Example:: + + with pytest.raises(TypeError) as excinfo: + ... + assert RaisesGroups(ValueError).matches(excinfo.value.__cause__) + # the above line is equivalent to + myexc = excinfo.value.__cause + assert isinstance(myexc, BaseExceptionGroup) + assert len(myexc.exceptions) == 1 + assert isinstance(myexc.exceptions[0], ValueError) + """ + self._fail_reason = None + if exc_val is None: + self._fail_reason = "exception is None" + return False + if not isinstance(exc_val, BaseExceptionGroup): + # we opt to only print type of the exception here, as the repr would + # likely be quite long + not_group_msg = f"{type(exc_val).__name__!r} is not an exception group" + if len(self.expected_exceptions) > 1: + self._fail_reason = not_group_msg + return False + # if we have 1 expected exception, check if it would work even if + # allow_unwrapped is not set + res = self._check_expected(self.expected_exceptions[0], exc_val) + if res is None and self.allow_unwrapped: + return True + + if res is None: + self._fail_reason = ( + f"{not_group_msg}, but would match with `allow_unwrapped=True`" + ) + elif self.allow_unwrapped: + self._fail_reason = res + else: + self._fail_reason = not_group_msg + return False + + actual_exceptions: Sequence[BaseException] = exc_val.exceptions + if self.flatten_subgroups: + actual_exceptions = self._unroll_exceptions(actual_exceptions) + + if not self._check_match(exc_val): + old_reason = self._fail_reason + if ( + len(actual_exceptions) == len(self.expected_exceptions) == 1 + and isinstance(expected := self.expected_exceptions[0], type) + and isinstance(actual := actual_exceptions[0], expected) + and self._check_match(actual) + ): + assert self.match is not None, "can't be None if _check_match failed" + assert self._fail_reason is old_reason is not None + self._fail_reason += f", but matched the expected {self._repr_expected(expected)}. You might want RaisesGroup(Matcher({expected.__name__}, match={_match_pattern(self.match)!r}))" + else: + self._fail_reason = old_reason + return False + + # do the full check on expected exceptions + if not self._check_exceptions( + exc_val, + actual_exceptions, + ): + assert self._fail_reason is not None + old_reason = self._fail_reason + # if we're not expecting a nested structure, and there is one, do a second + # pass where we try flattening it + if ( + not self.flatten_subgroups + and not any( + isinstance(e, RaisesGroup) for e in self.expected_exceptions + ) + and any(isinstance(e, BaseExceptionGroup) for e in actual_exceptions) + and self._check_exceptions( + exc_val, + self._unroll_exceptions(exc_val.exceptions), + ) + ): + # only indent if it's a single-line reason. In a multi-line there's already + # indented lines that this does not belong to. + indent = " " if "\n" not in self._fail_reason else "" + self._fail_reason = ( + old_reason + + f"\n{indent}Did you mean to use `flatten_subgroups=True`?" + ) + else: + self._fail_reason = old_reason + return False + + # Only run `self.check` once we know `exc_val` is of the correct type. + # TODO: if this fails, we should say the *group* did not match + return self._check_check(exc_val) + + @staticmethod + def _check_expected( + expected_type: ( + type[BaseException] | Matcher[BaseException] | RaisesGroup[BaseException] + ), + exception: BaseException, + ) -> str | None: + """Helper method for `RaisesGroup.matches` and `RaisesGroup._check_exceptions` + to check one of potentially several expected exceptions.""" + if isinstance(expected_type, type): + return _check_raw_type(expected_type, exception) + res = expected_type.matches(exception) + if res: + return None + assert expected_type.fail_reason is not None + if expected_type.fail_reason.startswith("\n"): + return f"\n{expected_type!r}: {indent(expected_type.fail_reason, ' ')}" + return f"{expected_type!r}: {expected_type.fail_reason}" + + @staticmethod + def _repr_expected(e: type[BaseException] | AbstractMatcher[BaseException]) -> str: + """Get the repr of an expected type/Matcher/RaisesGroup, but we only want + the name if it's a type""" + if isinstance(e, type): + return _exception_type_name(e) + return repr(e) + + @overload + def _check_exceptions( + self: RaisesGroup[ExcT_1], + _exc_val: Exception, + actual_exceptions: Sequence[Exception], + ) -> TypeGuard[ExceptionGroup[ExcT_1]]: ... + @overload + def _check_exceptions( + self: RaisesGroup[BaseExcT_1], + _exc_val: BaseException, + actual_exceptions: Sequence[BaseException], + ) -> TypeGuard[BaseExceptionGroup[BaseExcT_1]]: ... + + def _check_exceptions( + self, + _exc_val: BaseException, + actual_exceptions: Sequence[BaseException], + ) -> TypeGuard[BaseExceptionGroup[BaseExcT_co]]: + """helper method for RaisesGroup.matches that attempts to pair up expected and actual exceptions""" + # full table with all results + results = ResultHolder(self.expected_exceptions, actual_exceptions) + + # (indexes of) raised exceptions that haven't (yet) found an expected + remaining_actual = list(range(len(actual_exceptions))) + # (indexes of) expected exceptions that haven't found a matching raised + failed_expected: list[int] = [] + # successful greedy matches + matches: dict[int, int] = {} + + # loop over expected exceptions first to get a more predictable result + for i_exp, expected in enumerate(self.expected_exceptions): + for i_rem in remaining_actual: + res = self._check_expected(expected, actual_exceptions[i_rem]) + results.set_result(i_exp, i_rem, res) + if res is None: + remaining_actual.remove(i_rem) + matches[i_exp] = i_rem + break + else: + failed_expected.append(i_exp) + + # All exceptions matched up successfully + if not remaining_actual and not failed_expected: + return True + + # in case of a single expected and single raised we simplify the output + if 1 == len(actual_exceptions) == len(self.expected_exceptions): + assert not matches + self._fail_reason = res + return False + + # The test case is failing, so we can do a slow and exhaustive check to find + # duplicate matches etc that will be helpful in debugging + for i_exp, expected in enumerate(self.expected_exceptions): + for i_actual, actual in enumerate(actual_exceptions): + if results.has_result(i_exp, i_actual): + continue + results.set_result( + i_exp, i_actual, self._check_expected(expected, actual) + ) + + successful_str = ( + f"{len(matches)} matched exception{'s' if len(matches) > 1 else ''}. " + if matches + else "" + ) + + # all expected were found + if not failed_expected and results.no_match_for_actual(remaining_actual): + self._fail_reason = f"{successful_str}Unexpected exception(s): {[actual_exceptions[i] for i in remaining_actual]!r}" + return False + # all raised exceptions were expected + if not remaining_actual and results.no_match_for_expected(failed_expected): + self._fail_reason = f"{successful_str}Too few exceptions raised, found no match for: [{', '.join(self._repr_expected(self.expected_exceptions[i]) for i in failed_expected)}]" + return False + + # if there's only one remaining and one failed, and the unmatched didn't match anything else, + # we elect to only print why the remaining and the failed didn't match. + if ( + 1 == len(remaining_actual) == len(failed_expected) + and results.no_match_for_actual(remaining_actual) + and results.no_match_for_expected(failed_expected) + ): + self._fail_reason = f"{successful_str}{results.get_result(failed_expected[0], remaining_actual[0])}" + return False + + # there's both expected and raised exceptions without matches + s = "" + if matches: + s += f"\n{successful_str}" + indent_1 = " " * 2 + indent_2 = " " * 4 + + if not remaining_actual: + s += "\nToo few exceptions raised!" + elif not failed_expected: + s += "\nUnexpected exception(s)!" + + if failed_expected: + s += "\nThe following expected exceptions did not find a match:" + rev_matches = {v: k for k, v in matches.items()} + for i_failed in failed_expected: + s += ( + f"\n{indent_1}{self._repr_expected(self.expected_exceptions[i_failed])}" + ) + for i_actual, actual in enumerate(actual_exceptions): + if results.get_result(i_exp, i_actual) is None: + # we print full repr of match target + s += f"\n{indent_2}It matches {actual!r} which was paired with {self._repr_expected(self.expected_exceptions[rev_matches[i_actual]])}" + + if remaining_actual: + s += "\nThe following raised exceptions did not find a match" + for i_actual in remaining_actual: + s += f"\n{indent_1}{actual_exceptions[i_actual]!r}:" + for i_exp, expected in enumerate(self.expected_exceptions): + res = results.get_result(i_exp, i_actual) + if i_exp in failed_expected: + assert res is not None + if res[0] != "\n": + s += "\n" + s += indent(res, indent_2) + if res is None: + # we print full repr of match target + s += f"\n{indent_2}It matches {self._repr_expected(expected)} which was paired with {actual_exceptions[matches[i_exp]]!r}" + + if len(self.expected_exceptions) == len(actual_exceptions) and possible_match( + results + ): + s += "\nThere exist a possible match when attempting an exhaustive check, but RaisesGroup uses a greedy algorithm. Please make your expected exceptions more stringent with `Matcher` etc so the greedy algorithm can function." + self._fail_reason = s + return False + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: types.TracebackType | None, + ) -> bool: + __tracebackhide__ = True + assert ( + exc_type is not None + ), f"DID NOT RAISE any exception, expected {self.expected_type()}" + assert ( + self.excinfo is not None + ), "Internal error - should have been constructed in __enter__" + + group_str = ( + "(group)" + if self.allow_unwrapped and not issubclass(exc_type, BaseExceptionGroup) + else "group" + ) + + assert self.matches( + exc_val, + ), f"Raised exception {group_str} did not match: {self._fail_reason}" + + # Cast to narrow the exception type now that it's verified. + exc_info = cast( + "tuple[type[BaseExceptionGroup[BaseExcT_co]], BaseExceptionGroup[BaseExcT_co], types.TracebackType]", + (exc_type, exc_val, exc_tb), + ) + self.excinfo.fill_unfilled(exc_info) + return True + + def expected_type(self) -> str: + subexcs = [] + for e in self.expected_exceptions: + if isinstance(e, Matcher): + subexcs.append(str(e)) + elif isinstance(e, RaisesGroup): + subexcs.append(e.expected_type()) + elif isinstance(e, type): + subexcs.append(e.__name__) + else: # pragma: no cover + raise AssertionError("unknown type") + group_type = "Base" if self.is_baseexceptiongroup else "" + return f"{group_type}ExceptionGroup({', '.join(subexcs)})" + + +@final +class NotChecked: ... + + +class ResultHolder: + def __init__( + self, + expected_exceptions: tuple[ + type[BaseException] | AbstractMatcher[BaseException], ... + ], + actual_exceptions: Sequence[BaseException], + ) -> None: + self.results: list[list[str | type[NotChecked] | None]] = [ + [NotChecked for _ in expected_exceptions] for _ in actual_exceptions + ] + + def set_result(self, expected: int, actual: int, result: str | None) -> None: + self.results[actual][expected] = result + + def get_result(self, expected: int, actual: int) -> str | None: + res = self.results[actual][expected] + # mypy doesn't support `assert res is not NotChecked` + assert not isinstance(res, type) + return res + + def has_result(self, expected: int, actual: int) -> bool: + return self.results[actual][expected] is not NotChecked + + def no_match_for_expected(self, expected: list[int]) -> bool: + for i in expected: + for actual_results in self.results: + assert actual_results[i] is not NotChecked + if actual_results[i] is None: + return False + return True + + def no_match_for_actual(self, actual: list[int]) -> bool: + for i in actual: + for res in self.results[i]: + assert res is not NotChecked + if res is None: + return False + return True + + +def possible_match(results: ResultHolder, used: set[int] | None = None) -> bool: + if used is None: + used = set() + curr_row = len(used) + if curr_row == len(results.results): + return True + + for i, val in enumerate(results.results[curr_row]): + if val is None and i not in used and possible_match(results, used | {i}): + return True + return False diff --git a/contrib/python/trio/trio/testing/_sequencer.py b/contrib/python/trio/trio/testing/_sequencer.py new file mode 100644 index 000000000000..32171cb2a27b --- /dev/null +++ b/contrib/python/trio/trio/testing/_sequencer.py @@ -0,0 +1,87 @@ +from __future__ import annotations + +from collections import defaultdict +from contextlib import asynccontextmanager +from typing import TYPE_CHECKING + +import attrs + +from .. import Event, _core, _util + +if TYPE_CHECKING: + from collections.abc import AsyncIterator + + +@_util.final +@attrs.define(eq=False, slots=False) +class Sequencer: + """A convenience class for forcing code in different tasks to run in an + explicit linear order. + + Instances of this class implement a ``__call__`` method which returns an + async context manager. The idea is that you pass a sequence number to + ``__call__`` to say where this block of code should go in the linear + sequence. Block 0 starts immediately, and then block N doesn't start until + block N-1 has finished. + + Example: + An extremely elaborate way to print the numbers 0-5, in order:: + + async def worker1(seq): + async with seq(0): + print(0) + async with seq(4): + print(4) + + async def worker2(seq): + async with seq(2): + print(2) + async with seq(5): + print(5) + + async def worker3(seq): + async with seq(1): + print(1) + async with seq(3): + print(3) + + async def main(): + seq = trio.testing.Sequencer() + async with trio.open_nursery() as nursery: + nursery.start_soon(worker1, seq) + nursery.start_soon(worker2, seq) + nursery.start_soon(worker3, seq) + + """ + + _sequence_points: defaultdict[int, Event] = attrs.field( + factory=lambda: defaultdict(Event), + init=False, + ) + _claimed: set[int] = attrs.field(factory=set, init=False) + _broken: bool = attrs.field(default=False, init=False) + + @asynccontextmanager + async def __call__(self, position: int) -> AsyncIterator[None]: + if position in self._claimed: + raise RuntimeError(f"Attempted to reuse sequence point {position}") + if self._broken: + raise RuntimeError("sequence broken!") + self._claimed.add(position) + if position != 0: + try: + await self._sequence_points[position].wait() + except _core.Cancelled: + self._broken = True + for event in self._sequence_points.values(): + event.set() + raise RuntimeError( + "Sequencer wait cancelled -- sequence broken", + ) from None + else: + if self._broken: + raise RuntimeError("sequence broken!") + try: + yield + finally: + self._sequence_points[position + 1].set() diff --git a/contrib/python/trio/trio/testing/_trio_test.py b/contrib/python/trio/trio/testing/_trio_test.py new file mode 100644 index 000000000000..226e55919666 --- /dev/null +++ b/contrib/python/trio/trio/testing/_trio_test.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from functools import partial, wraps +from typing import TYPE_CHECKING, TypeVar + +from .. import _core +from ..abc import Clock, Instrument + +if TYPE_CHECKING: + from collections.abc import Awaitable, Callable + + from typing_extensions import ParamSpec + + ArgsT = ParamSpec("ArgsT") + + +RetT = TypeVar("RetT") + + +def trio_test(fn: Callable[ArgsT, Awaitable[RetT]]) -> Callable[ArgsT, RetT]: + """Converts an async test function to be synchronous, running via Trio. + + Usage:: + + @trio_test + async def test_whatever(): + await ... + + If a pytest fixture is passed in that subclasses the :class:`~trio.abc.Clock` or + :class:`~trio.abc.Instrument` ABCs, then those are passed to :meth:`trio.run()`. + """ + + @wraps(fn) + def wrapper(*args: ArgsT.args, **kwargs: ArgsT.kwargs) -> RetT: + __tracebackhide__ = True + clocks = [c for c in kwargs.values() if isinstance(c, Clock)] + if not clocks: + clock = None + elif len(clocks) == 1: + clock = clocks[0] + else: + raise ValueError("too many clocks spoil the broth!") + instruments = [i for i in kwargs.values() if isinstance(i, Instrument)] + return _core.run( + partial(fn, *args, **kwargs), + clock=clock, + instruments=instruments, + ) + + return wrapper diff --git a/contrib/python/trio/trio/to_thread.py b/contrib/python/trio/trio/to_thread.py new file mode 100644 index 000000000000..45ea5b480bfd --- /dev/null +++ b/contrib/python/trio/trio/to_thread.py @@ -0,0 +1,4 @@ +from ._threads import current_default_thread_limiter, to_thread_run_sync as run_sync + +# need to use __all__ for pyright --verifytypes to see re-exports when renaming them +__all__ = ["current_default_thread_limiter", "run_sync"] diff --git a/contrib/python/trio/ya.make b/contrib/python/trio/ya.make new file mode 100644 index 000000000000..6349037343b5 --- /dev/null +++ b/contrib/python/trio/ya.make @@ -0,0 +1,122 @@ +# Generated by devtools/yamaker (pypi). + +PY3_LIBRARY() + +VERSION(0.31.0) + +LICENSE(Apache-2.0 AND BSD-3-Clause AND LicenseRef-scancode-unknown-license-reference AND MIT AND "MIT OR Apache-2.0") + +PEERDIR( + contrib/python/attrs + contrib/python/idna + contrib/python/outcome + contrib/python/sniffio + contrib/python/sortedcontainers +) + +NO_LINT() + +NO_CHECK_IMPORTS( + trio._core._generated_windows_ffi + trio._core._io_kqueue + trio._core._io_windows + trio._core._windows_cffi + trio._subprocess_platform.windows + trio._tools.gen_exports + trio._tools.sync_requirements + trio._tools.windows_ffi_build + trio._wait_for_object + trio._windows_pipes +) + +PY_SRCS( + TOP_LEVEL + trio/__init__.py + trio/__main__.py + trio/_abc.py + trio/_channel.py + trio/_core/__init__.py + trio/_core/_asyncgens.py + trio/_core/_concat_tb.py + trio/_core/_entry_queue.py + trio/_core/_exceptions.py + trio/_core/_generated_instrumentation.py + trio/_core/_generated_io_epoll.py + trio/_core/_generated_io_kqueue.py + trio/_core/_generated_io_windows.py + trio/_core/_generated_run.py + trio/_core/_generated_windows_ffi.py + trio/_core/_instrumentation.py + trio/_core/_io_common.py + trio/_core/_io_epoll.py + trio/_core/_io_kqueue.py + trio/_core/_io_windows.py + trio/_core/_ki.py + trio/_core/_local.py + trio/_core/_mock_clock.py + trio/_core/_parking_lot.py + trio/_core/_run.py + trio/_core/_run_context.py + trio/_core/_thread_cache.py + trio/_core/_traps.py + trio/_core/_unbounded_queue.py + trio/_core/_wakeup_socketpair.py + trio/_core/_windows_cffi.py + trio/_deprecate.py + trio/_dtls.py + trio/_file_io.py + trio/_highlevel_generic.py + trio/_highlevel_open_tcp_listeners.py + trio/_highlevel_open_tcp_stream.py + trio/_highlevel_open_unix_stream.py + trio/_highlevel_serve_listeners.py + trio/_highlevel_socket.py + trio/_highlevel_ssl_helpers.py + trio/_path.py + trio/_repl.py + trio/_signals.py + trio/_socket.py + trio/_ssl.py + trio/_subprocess.py + trio/_subprocess_platform/__init__.py + trio/_subprocess_platform/kqueue.py + trio/_subprocess_platform/waitid.py + trio/_subprocess_platform/windows.py + trio/_sync.py + trio/_threads.py + trio/_timeouts.py + trio/_tools/__init__.py + trio/_tools/gen_exports.py + trio/_tools/mypy_annotate.py + trio/_tools/sync_requirements.py + trio/_tools/windows_ffi_build.py + trio/_unix_pipes.py + trio/_util.py + trio/_version.py + trio/_wait_for_object.py + trio/_windows_pipes.py + trio/abc.py + trio/from_thread.py + trio/lowlevel.py + trio/socket.py + trio/testing/__init__.py + trio/testing/_check_streams.py + trio/testing/_checkpoints.py + trio/testing/_fake_net.py + trio/testing/_memory_streams.py + trio/testing/_network.py + trio/testing/_raises_group.py + trio/testing/_sequencer.py + trio/testing/_trio_test.py + trio/to_thread.py +) + +RESOURCE_FILES( + PREFIX contrib/python/trio/ + .dist-info/METADATA + .dist-info/entry_points.txt + .dist-info/top_level.txt + trio/py.typed +) + +END() From e06e99c2d447002a9fa253960c3e037f75426e21 Mon Sep 17 00:00:00 2001 From: aneporada Date: Tue, 11 Nov 2025 14:09:11 +0300 Subject: [PATCH 09/17] [refactoring] Switch to IsOptimizerEnabled/IsOptimizerDisabled commit_hash:5999939d643dc2d073b5fa40d1b4be09d89a18ba --- .../core/common_opt/yql_co_finalizers.cpp | 5 ++--- yql/essentials/core/common_opt/yql_co_flow2.cpp | 13 +++++-------- yql/essentials/core/common_opt/yql_co_simple1.cpp | 4 ++-- yql/essentials/core/common_opt/yql_co_simple2.cpp | 5 ++--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/yql/essentials/core/common_opt/yql_co_finalizers.cpp b/yql/essentials/core/common_opt/yql_co_finalizers.cpp index a0db77efabcb..b84d4759aa37 100644 --- a/yql/essentials/core/common_opt/yql_co_finalizers.cpp +++ b/yql/essentials/core/common_opt/yql_co_finalizers.cpp @@ -49,9 +49,8 @@ IGraphTransformer::TStatus MultiUsageFlatMapOverJoin(const TExprNode::TPtr& node bool IsFilterMultiusageEnabled(const TOptimizeContext& optCtx) { YQL_ENSURE(optCtx.Types); - static const TString multiUsageFlags = to_lower(TString("FilterPushdownEnableMultiusage")); - static const TString noMultiUsageFlags = to_lower(TString("FilterPushdownDisableMultiusage")); - return optCtx.Types->OptimizerFlags.contains(multiUsageFlags) && !optCtx.Types->OptimizerFlags.contains(noMultiUsageFlags); + static const char optName[] = "FilterPushdownEnableMultiusage"; + return IsOptimizerEnabled(*optCtx.Types) && !IsOptimizerDisabled(*optCtx.Types); } void FilterPushdownWithMultiusage(const TExprNode::TPtr& node, TNodeOnNodeOwnedMap& toOptimize, TExprContext& ctx, TOptimizeContext& optCtx) { diff --git a/yql/essentials/core/common_opt/yql_co_flow2.cpp b/yql/essentials/core/common_opt/yql_co_flow2.cpp index d090473eb983..3e4a007f5700 100644 --- a/yql/essentials/core/common_opt/yql_co_flow2.cpp +++ b/yql/essentials/core/common_opt/yql_co_flow2.cpp @@ -24,19 +24,16 @@ bool AllowSubsetFieldsForNode(const TExprNode& node, const TOptimizeContext& opt bool AllowComplexFiltersOverAggregatePushdown(const TOptimizeContext& optCtx) { YQL_ENSURE(optCtx.Types); - static const TString pushdown = to_lower(TString("PushdownComplexFiltersOverAggregate")); - static const TString noPushdown = to_lower(TString("DisablePushdownComplexFiltersOverAggregate")); - return optCtx.Types->OptimizerFlags.contains(pushdown) && - !optCtx.Types->OptimizerFlags.contains(noPushdown) && + static const char optName[] = "PushdownComplexFiltersOverAggregate"; + return IsOptimizerEnabled(*optCtx.Types) && + !IsOptimizerDisabled(*optCtx.Types) && optCtx.Types->MaxAggPushdownPredicates > 0; } bool AllowPullUpExtendOverEquiJoin(const TOptimizeContext& optCtx) { YQL_ENSURE(optCtx.Types); - static const TString pull = to_lower(TString("PullUpExtendOverEquiJoin")); - static const TString noPull = to_lower(TString("DisablePullUpExtendOverEquiJoin")); - return optCtx.Types->OptimizerFlags.contains(pull) && - !optCtx.Types->OptimizerFlags.contains(noPull); + static const char optName[] = "PullUpExtendOverEquiJoin"; + return IsOptimizerEnabled(*optCtx.Types) && !IsOptimizerDisabled(*optCtx.Types); } THashSet GetAggregationInputKeys(const TCoAggregate& node) { diff --git a/yql/essentials/core/common_opt/yql_co_simple1.cpp b/yql/essentials/core/common_opt/yql_co_simple1.cpp index c9937ed0c955..0b74096e870d 100644 --- a/yql/essentials/core/common_opt/yql_co_simple1.cpp +++ b/yql/essentials/core/common_opt/yql_co_simple1.cpp @@ -3845,8 +3845,8 @@ TExprNode::TPtr OptimizeMerge(const TExprNode::TPtr& node, TExprContext& ctx, TO bool IsEarlyExpandOfSkipNullAllowed(const TOptimizeContext& optCtx) { YQL_ENSURE(optCtx.Types); - static const TString skipNullFlags = to_lower(TString("EarlyExpandSkipNull")); - return optCtx.Types->OptimizerFlags.contains(skipNullFlags); + static const char optName[] = "EarlyExpandSkipNull"; + return IsOptimizerEnabled(*optCtx.Types) && !IsOptimizerDisabled(*optCtx.Types); } TExprNode::TPtr ReplaceFuncWithImpl(const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { diff --git a/yql/essentials/core/common_opt/yql_co_simple2.cpp b/yql/essentials/core/common_opt/yql_co_simple2.cpp index d77d17efafd5..65f337643cac 100644 --- a/yql/essentials/core/common_opt/yql_co_simple2.cpp +++ b/yql/essentials/core/common_opt/yql_co_simple2.cpp @@ -541,9 +541,8 @@ TExprNode::TPtr OptimizeExistsAndUnwrap(const TExprNode::TPtr& node, TExprContex bool IsExtractCommonPredicatesFromLogicalOpsEnabled(const TOptimizeContext& optCtx) { YQL_ENSURE(optCtx.Types); - static const TString enable = to_lower(TString("ExtractCommonPredicatesFromLogicalOps")); - static const TString disable = to_lower(TString("DisableExtractCommonPredicatesFromLogicalOps")); - return optCtx.Types->OptimizerFlags.contains(enable) && !optCtx.Types->OptimizerFlags.contains(disable); + static const char optName[] = "ExtractCommonPredicatesFromLogicalOps"; + return IsOptimizerEnabled(*optCtx.Types) && !IsOptimizerDisabled(*optCtx.Types); } size_t GetNodeId(const TExprNode* node, const TNodeMap& node2id) { From 75780c9a0875bfa2c8d0dae95325811ea210a972 Mon Sep 17 00:00:00 2001 From: neyrox Date: Tue, 11 Nov 2025 15:52:41 +0300 Subject: [PATCH 10/17] Per column compression settings YQL grammar Task: commit_hash:84cb8e3fcab66d48c1861e63fc9d33afb06478dc --- yql/essentials/sql/v1/SQLv1Antlr4.g.in | 10 ++ yql/essentials/sql/v1/format/sql_format_ut.h | 6 +- yql/essentials/sql/v1/node.cpp | 13 -- yql/essentials/sql/v1/node.h | 20 ++- yql/essentials/sql/v1/query.cpp | 25 +++ yql/essentials/sql/v1/sql_query.cpp | 47 ++++- yql/essentials/sql/v1/sql_query.h | 1 + yql/essentials/sql/v1/sql_translation.cpp | 144 ++++++++++++--- yql/essentials/sql/v1/sql_translation.h | 2 + yql/essentials/sql/v1/sql_ut_antlr4.cpp | 176 +++++++++++++++++++ 10 files changed, 387 insertions(+), 57 deletions(-) diff --git a/yql/essentials/sql/v1/SQLv1Antlr4.g.in b/yql/essentials/sql/v1/SQLv1Antlr4.g.in index 84f081054e6c..996daaed0a0a 100644 --- a/yql/essentials/sql/v1/SQLv1Antlr4.g.in +++ b/yql/essentials/sql/v1/SQLv1Antlr4.g.in @@ -777,6 +777,7 @@ alter_table_action: | alter_table_alter_index | alter_table_alter_column_drop_not_null | alter_table_alter_column_set_not_null + | alter_table_alter_column_set_compression ; alter_external_table_stmt: ALTER EXTERNAL TABLE simple_table_ref alter_external_table_action (COMMA alter_external_table_action)*; @@ -800,6 +801,7 @@ alter_table_drop_column: DROP COLUMN? an_id; alter_table_alter_column: ALTER COLUMN an_id SET family_relation; alter_table_alter_column_drop_not_null: ALTER COLUMN an_id DROP NOT NULL; alter_table_alter_column_set_not_null: ALTER COLUMN an_id SET NOT NULL; +alter_table_alter_column_set_compression: ALTER COLUMN an_id SET compression; alter_table_add_column_family: ADD family_entry; alter_table_alter_column_family: ALTER FAMILY an_id SET an_id family_setting_value; alter_table_set_table_setting_uncompat: SET an_id table_setting_value; @@ -824,8 +826,13 @@ column_option: family_relation | nullability | default_value + | compression ; +compression: COMPRESSION LPAREN (compression_setting_entry (COMMA compression_setting_entry)*)? COMMA? RPAREN; +compression_setting_entry: an_id EQUALS compression_setting_value; +compression_setting_value: integer | id; + family_relation: FAMILY an_id; nullability: NOT? NULL; default_value: DEFAULT expr; @@ -1421,6 +1428,7 @@ keyword_as_compat: // | COLLATE | COLLECTION | COMMIT + | COMPRESSION | CONDITIONAL | CONFLICT | CONNECT @@ -1655,6 +1663,7 @@ keyword_compat: ( | COLLATE | COLLECTION | COMMIT + | COMPRESSION | CONDITIONAL | CONFLICT | CONNECT @@ -1999,6 +2008,7 @@ COLUMN: C O L U M N; COLUMNS: C O L U M N S; COMMIT: C O M M I T; COMPACT: C O M P A C T; +COMPRESSION: C O M P R E S S I O N; CONDITIONAL: C O N D I T I O N A L; CONFLICT: C O N F L I C T; CONNECT: C O N N E C T; diff --git a/yql/essentials/sql/v1/format/sql_format_ut.h b/yql/essentials/sql/v1/format/sql_format_ut.h index 0279753af485..afd0b77a805b 100644 --- a/yql/essentials/sql/v1/format/sql_format_ut.h +++ b/yql/essentials/sql/v1/format/sql_format_ut.h @@ -356,7 +356,9 @@ Y_UNIT_TEST(CreateTable) { {"create temporary table user(user int32)", "CREATE TEMPORARY TABLE user (\n\tuser int32\n);\n"}, {"create table user(user int32 (default 0, not null))", "CREATE TABLE user (\n\tuser int32 (DEFAULT 0, NOT NULL)\n);\n"}, {"create table user(user int32 (default 0, not null, family f))", "CREATE TABLE user (\n\tuser int32 (DEFAULT 0, NOT NULL, FAMILY f)\n);\n"}, - {"create table user(user int32 (default 0, family f, not null))", "CREATE TABLE user (\n\tuser int32 (DEFAULT 0, FAMILY f, NOT NULL)\n);\n"}}; + {"create table user(user int32 (default 0, family f, not null))", "CREATE TABLE user (\n\tuser int32 (DEFAULT 0, FAMILY f, NOT NULL)\n);\n"}, + {"create table\tuser(key int32, val int64 compression(algorithm=lz4))", "CREATE TABLE user (\n\tkey int32,\n\tval int64 COMPRESSION (algorithm = lz4)\n);\n"}, + }; TSetup setup; setup.Run(cases); @@ -559,6 +561,8 @@ Y_UNIT_TEST(AlterTable) { "ALTER TABLE user\n\tADD CHANGEFEED user WITH (topic_min_active_partitions = 1)\n;\n"}, {"alter table user add changefeed user with (topic_auto_partitioning = 'ENABLED', topic_min_active_partitions = 1, topic_max_active_partitions = 7)", "ALTER TABLE user\n\tADD CHANGEFEED user WITH (topic_auto_partitioning = 'ENABLED', topic_min_active_partitions = 1, topic_max_active_partitions = 7)\n;\n"}, + {"alter table user alter column val set compression(algorithm=zstd, level=2)", + "ALTER TABLE user\n\tALTER COLUMN val SET COMPRESSION (algorithm = zstd, level = 2)\n;\n"}, }; TSetup setup; diff --git a/yql/essentials/sql/v1/node.cpp b/yql/essentials/sql/v1/node.cpp index 475cf63f13cb..7d92c5b15ffc 100644 --- a/yql/essentials/sql/v1/node.cpp +++ b/yql/essentials/sql/v1/node.cpp @@ -38,19 +38,6 @@ TTopicRef::TTopicRef(const TString& refName, const TDeferredAtom& cluster, TNode { } -TColumnSchema::TColumnSchema(TPosition pos, const TString& name, const TNodePtr& type, bool nullable, - TVector families, bool serial, TNodePtr defaultExpr, ETypeOfChange typeOfChange) - : Pos(pos) - , Name(name) - , Type(type) - , Nullable(nullable) - , Families(families) - , Serial(serial) - , DefaultExpr(defaultExpr) - , TypeOfChange(typeOfChange) -{ -} - INode::INode(TPosition pos) : Pos_(pos) { diff --git a/yql/essentials/sql/v1/node.h b/yql/essentials/sql/v1/node.h index b7d40982a18b..1e80486a4e19 100644 --- a/yql/essentials/sql/v1/node.h +++ b/yql/essentials/sql/v1/node.h @@ -718,10 +718,15 @@ struct TIdentifier { } }; +struct TCompression { + TMap Entries; +}; + struct TColumnOptions { TNodePtr DefaultExpr; - bool Nullable = true; TVector Families; + TMaybe Compression; + bool Nullable = true; }; struct TColumnSchema { @@ -729,20 +734,19 @@ struct TColumnSchema { Nothing, DropNotNullConstraint, SetNotNullConstraint, - SetFamily + SetFamily, + SetCompression, }; TPosition Pos; TString Name; TNodePtr Type; - bool Nullable; TVector Families; - bool Serial; TNodePtr DefaultExpr; - const ETypeOfChange TypeOfChange; - - TColumnSchema(TPosition pos, const TString& name, const TNodePtr& type, bool nullable, - TVector families, bool serial, TNodePtr defaultExpr, ETypeOfChange typeOfChange = ETypeOfChange::Nothing); + TMaybe Compression; + const ETypeOfChange TypeOfChange = ETypeOfChange::Nothing; + bool Nullable = false; + bool Serial = false; }; struct TColumns: public TSimpleRefCount { diff --git a/yql/essentials/sql/v1/query.cpp b/yql/essentials/sql/v1/query.cpp index 518e81910a2e..73530b4d034d 100644 --- a/yql/essentials/sql/v1/query.cpp +++ b/yql/essentials/sql/v1/query.cpp @@ -1261,6 +1261,14 @@ class TCreateTableNode final: public TAstListNode { columnDesc = L(columnDesc, Q(Y(Q("columnConstrains"), Q(columnConstraints)))); + if (col.Compression) { + auto columnCompression = Y(); + for (const auto& [key, value] : col.Compression->Entries) { + columnCompression = L(columnCompression, Q(Y(Q(key), value))); + } + columnDesc = L(columnDesc, Q(Y(Q("columnCompression"), Q(columnCompression)))); + } + auto familiesDesc = Y(); if (col.Families) { @@ -1602,6 +1610,23 @@ class TAlterTableNode final: public TAstListNode { break; } + case TColumnSchema::ETypeOfChange::SetCompression: { + auto columnDesc = Y(); + columnDesc = L(columnDesc, BuildQuotedAtom(Pos_, col.Name)); + + auto columnCompression = Y(); + + if (col.Compression) { + for (const auto& [key, value] : col.Compression->Entries) { + columnCompression = L(columnCompression, Q(Y(Q(key), value))); + } + } + + columnDesc = L(columnDesc, Q(Y(Q("changeCompression"), Q(columnCompression)))); + columns = L(columns, Q(columnDesc)); + + break; + } case TColumnSchema::ETypeOfChange::Nothing: { // do nothing diff --git a/yql/essentials/sql/v1/sql_query.cpp b/yql/essentials/sql/v1/sql_query.cpp index ac4fb09c4d6c..e8e70924e9a3 100644 --- a/yql/essentials/sql/v1/sql_query.cpp +++ b/yql/essentials/sql/v1/sql_query.cpp @@ -2491,7 +2491,16 @@ bool TSqlQuery::AlterTableAction(const TRule_alter_table_action& node, TAlterTab break; } + case TRule_alter_table_action::kAltAlterTableAction19: { + // ALTER COLUMN id SET COMPRESSION(...) + const auto& alterRule = node.GetAlt_alter_table_action19().GetRule_alter_table_alter_column_set_compression1(); + if (!AlterTableAlterColumnSetCompression(alterRule, params)) { + return false; + } + + break; + } case TRule_alter_table_action::ALT_NOT_SET: Y_UNREACHABLE(); } @@ -2575,12 +2584,17 @@ bool TSqlQuery::AlterTableDropColumn(const TRule_alter_table_drop_column& node, bool TSqlQuery::AlterTableAlterColumn(const TRule_alter_table_alter_column& node, TAlterTableParameters& params) { - TString name = Id(node.GetRule_an_id3(), *this); + const TString name = Id(node.GetRule_an_id3(), *this); const TPosition pos(Context().Pos()); TVector families; const auto& familyRelation = node.GetRule_family_relation5(); families.push_back(IdEx(familyRelation.GetRule_an_id2(), *this)); - params.AlterColumns.emplace_back(pos, name, nullptr, false, families, false, nullptr, TColumnSchema::ETypeOfChange::SetFamily); + params.AlterColumns.push_back({ + .Pos = std::move(pos), + .Name = std::move(name), + .Families = std::move(families), + .TypeOfChange = TColumnSchema::ETypeOfChange::SetFamily, + }); return true; } @@ -2827,16 +2841,37 @@ bool TSqlQuery::AlterSequenceAction(const TRule_alter_sequence_action& node, TSe } bool TSqlQuery::AlterTableAlterColumnDropNotNull(const TRule_alter_table_alter_column_drop_not_null& node, TAlterTableParameters& params) { - TString name = Id(node.GetRule_an_id3(), *this); + const TString name = Id(node.GetRule_an_id3(), *this); const TPosition pos(Context().Pos()); - params.AlterColumns.emplace_back(pos, name, nullptr, false, TVector(), false, nullptr, TColumnSchema::ETypeOfChange::DropNotNullConstraint); + params.AlterColumns.push_back({ + .Pos = std::move(pos), + .Name = std::move(name), + .TypeOfChange = TColumnSchema::ETypeOfChange::DropNotNullConstraint, + }); return true; } bool TSqlQuery::AlterTableAlterColumnSetNotNull(const TRule_alter_table_alter_column_set_not_null& node, TAlterTableParameters& params) { - TString name = Id(node.GetRule_an_id3(), *this); + const TString name = Id(node.GetRule_an_id3(), *this); + const TPosition pos(Context().Pos()); + params.AlterColumns.push_back({ + .Pos = std::move(pos), + .Name = std::move(name), + .TypeOfChange = TColumnSchema::ETypeOfChange::SetNotNullConstraint, + }); + return true; +} + +bool TSqlQuery::AlterTableAlterColumnSetCompression(const TRule_alter_table_alter_column_set_compression& node, TAlterTableParameters& params) { + const TString name = Id(node.GetRule_an_id3(), *this); const TPosition pos(Context().Pos()); - params.AlterColumns.emplace_back(pos, name, nullptr, false, TVector(), false, nullptr, TColumnSchema::ETypeOfChange::SetNotNullConstraint); + const auto compression = ColumnCompression(node.GetRule_compression5(), *this); + params.AlterColumns.push_back({ + .Pos = std::move(pos), + .Name = std::move(name), + .Compression = std::move(compression), + .TypeOfChange = TColumnSchema::ETypeOfChange::SetCompression, + }); return true; } diff --git a/yql/essentials/sql/v1/sql_query.h b/yql/essentials/sql/v1/sql_query.h index 201a0268ae53..08295c14fb1f 100644 --- a/yql/essentials/sql/v1/sql_query.h +++ b/yql/essentials/sql/v1/sql_query.h @@ -50,6 +50,7 @@ class TSqlQuery: public TSqlTranslation { bool ParseTableStoreFeatures(std::map& result, const TRule_alter_table_store_action& actions); bool AlterTableAlterColumnDropNotNull(const TRule_alter_table_alter_column_drop_not_null& node, TAlterTableParameters& params); bool AlterTableAlterColumnSetNotNull(const TRule_alter_table_alter_column_set_not_null& node, TAlterTableParameters& params); + bool AlterTableAlterColumnSetCompression(const TRule_alter_table_alter_column_set_compression& node, TAlterTableParameters& params); TNodePtr Build(const TRule_delete_stmt& stmt); diff --git a/yql/essentials/sql/v1/sql_translation.cpp b/yql/essentials/sql/v1/sql_translation.cpp index 1a421986e32f..6b9250d28ef3 100644 --- a/yql/essentials/sql/v1/sql_translation.cpp +++ b/yql/essentials/sql/v1/sql_translation.cpp @@ -1503,21 +1503,82 @@ TMaybe TSqlTranslation::AsTableImpl(const TRule_table_ref& node) { return Nothing(); } +bool ColumnCompression(const TRule_compression_setting_entry& node, TTranslation& ctx, TCompression& compression) { + const auto id = to_lower(Id(node.GetRule_an_id1(), ctx)); + + const auto& value = node.GetRule_compression_setting_value3(); // compression_setting_value + + if (compression.Entries.contains(id)) { + ctx.Context().Error() << "'" << id << "' setting can be specified only once"; + return false; + } + + switch (value.Alt_case()) { + case TRule_compression_setting_value::AltCase::kAltCompressionSettingValue1: { + const auto result = ParseInteger(ctx.Context(), value.GetAlt_compression_setting_value1().GetRule_integer1()); + if (!result) { + return false; // ParseInteger has already set error to context + } + const auto literal = MakeIntrusive>(ctx.Context().Pos(), "Uint64", ToString(*result)); + + compression.Entries[std::move(id)] = std::move(literal); + break; + } + case TRule_compression_setting_value::AltCase::kAltCompressionSettingValue2: { + const auto result = Id(value.GetAlt_compression_setting_value2().GetRule_id1(), ctx); + const TNodePtr literal = BuildLiteralRawString(ctx.Context().Pos(), result); + + compression.Entries[std::move(id)] = std::move(literal); + break; + } + case TRule_compression_setting_value::AltCase::ALT_NOT_SET: + Y_UNREACHABLE(); + } + + return true; +} + +TMaybe ColumnCompression(const TRule_compression& node, TTranslation& ctx) { + // compression: COMPRESSION LPAREN (compression_setting_entry (COMMA compression_setting_entry)*)? COMMA? RPAREN; + + TCompression compression; + + if (!node.HasBlock3()) { // compression_setting_entry + return compression; + } + + const auto& block = node.GetBlock3(); + const auto& entry = block.GetRule_compression_setting_entry1(); + if (!ColumnCompression(entry, ctx, compression)) { + return Nothing(); + } + + for (const auto& block2 : block.GetBlock2()) { + const auto& entry2 = block2.GetRule_compression_setting_entry2(); + if (!ColumnCompression(entry2, ctx, compression)) { + return Nothing(); + } + } + + return compression; +} + TMaybe ColumnOptions(const TRule_column_schema& node, TTranslation& ctx) { TNodePtr defaultExpr; - bool nullable = true; TVector families; + TMaybe compression; + bool nullable = true; const auto& optionsList = node.GetRule_column_option_list3(); enum class EOption { Family, NotNull, - DefaultValue + DefaultValue, + Compression, }; - std::vector columnOptions; - columnOptions.reserve(static_cast(EOption::DefaultValue) + 1); + TVector columnOptions(Reserve(static_cast(EOption::Compression) + 1)); { switch (optionsList.Alt_case()) { @@ -1559,32 +1620,37 @@ TMaybe ColumnOptions(const TRule_column_schema& node, TTranslati for (const auto& rule : columnOptions) { switch (rule.Alt_case()) { - case TRule_column_option::kAltColumnOption1: { + case TRule_column_option::kAltColumnOption1: { // family_relation + const auto opt = rule.GetAlt_column_option1().GetRule_family_relation1(); if (std::find(usedOptions.begin(), usedOptions.end(), EOption::Family) != usedOptions.end()) { - ctx.Context().Error() << "'FAMILY' option can be specified only once"; + TPosition pos = ctx.Context().TokenPosition(opt.GetToken1()); + ctx.Context().Error(pos) << "'FAMILY' option can be specified only once"; return {}; } usedOptions.push_back(EOption::Family); - const auto& familyRelation = rule.GetAlt_column_option1().GetRule_family_relation1(); - families.push_back(IdEx(familyRelation.GetRule_an_id2(), ctx)); + families.push_back(IdEx(opt.GetRule_an_id2(), ctx)); break; } - case TRule_column_option::kAltColumnOption2: { + case TRule_column_option::kAltColumnOption2: { // nullability + const auto opt = rule.GetAlt_column_option2().GetRule_nullability1(); if (std::find(usedOptions.begin(), usedOptions.end(), EOption::NotNull) != usedOptions.end()) { - ctx.Context().Error() << "'NOT NULL' option can be specified only once"; + TPosition pos = ctx.Context().TokenPosition(opt.GetToken2()); + ctx.Context().Error(pos) << "'NOT NULL' option can be specified only once"; return {}; } usedOptions.push_back(EOption::NotNull); - nullable = !rule.GetAlt_column_option2().GetRule_nullability1().HasBlock1(); + nullable = !opt.HasBlock1(); break; } - case TRule_column_option::kAltColumnOption3: { + case TRule_column_option::kAltColumnOption3: { // default_value + const auto opt = rule.GetAlt_column_option3().GetRule_default_value1(); if (std::find(usedOptions.begin(), usedOptions.end(), EOption::DefaultValue) != usedOptions.end()) { - ctx.Context().Error() << "'DEFAULT' option can be specified only once"; + TPosition pos = ctx.Context().TokenPosition(opt.GetToken1()); + ctx.Context().Error(pos) << "'DEFAULT' option can be specified only once"; return {}; } @@ -1600,14 +1666,15 @@ TMaybe ColumnOptions(const TRule_column_schema& node, TTranslati ctx.Context().DisableLegacyNotNull = true; - defaultExpr = expr.Build(rule.GetAlt_column_option3().GetRule_default_value1().GetRule_expr2()); + defaultExpr = expr.Build(opt.GetRule_expr2()); if (AnyOf(ctx.Context().Issues.begin(), ctx.Context().Issues.end(), [](const auto& issue) { return issue.GetCode() == TIssuesIds::YQL_MISSING_IS_BEFORE_NOT_NULL; })) { - ctx.Context().Error() << "'DEFAULT' option can not use expr which contains literall 'NOT NULL'." - << " If you wanted to use two different options 'DEFAULT' and 'NOT NULL'," - << " it is recommended to use the syntax '(DEFAULT value, NOT NULL, ...)'"; + TPosition pos = ctx.Context().TokenPosition(opt.GetToken1()); + ctx.Context().Error(pos) << "'DEFAULT' option can not use expr which contains literall 'NOT NULL'." + << " If you wanted to use two different options 'DEFAULT' and 'NOT NULL'," + << " it is recommended to use the syntax '(DEFAULT value, NOT NULL, ...)'"; return {}; } @@ -1618,13 +1685,30 @@ TMaybe ColumnOptions(const TRule_column_schema& node, TTranslati break; } + case TRule_column_option::kAltColumnOption4: { // compression + const auto opt = rule.GetAlt_column_option4().GetRule_compression1(); + if (std::find(usedOptions.begin(), usedOptions.end(), EOption::Compression) != usedOptions.end()) { + TPosition pos = ctx.Context().TokenPosition(opt.GetToken1()); + ctx.Context().Error(pos) << "'COMPRESSION' option can be specified only once"; + return {}; + } + + usedOptions.push_back(EOption::Compression); + + compression = ColumnCompression(opt, ctx); + break; + } case TRule_column_option::ALT_NOT_SET: Y_UNREACHABLE(); } } } - return TColumnOptions{std::move(defaultExpr), nullable, std::move(families)}; + return TColumnOptions{ + .DefaultExpr = std::move(defaultExpr), + .Families = std::move(families), + .Compression = std::move(compression), + .Nullable = nullable}; } TMaybe TSqlTranslation::ColumnSchemaImpl(const TRule_column_schema& node) { @@ -1633,12 +1717,12 @@ TMaybe TSqlTranslation::ColumnSchemaImpl(const TRule_column_schem TNodePtr type = SerialTypeNode(node.GetRule_type_name_or_bind2()); const bool serial = (type != nullptr); - auto columnOptions = ColumnOptions(node, *this); + const auto columnOptions = ColumnOptions(node, *this); if (!columnOptions) { return {}; } - auto [defaultExpr, nullable, families] = columnOptions.GetRef(); + const auto [defaultExpr, families, compression, nullable] = columnOptions.GetRef(); if (!type) { type = TypeNodeOrBind(node.GetRule_type_name_or_bind2()); @@ -1648,14 +1732,16 @@ TMaybe TSqlTranslation::ColumnSchemaImpl(const TRule_column_schem return {}; } - return TColumnSchema( - std::move(pos), - std::move(name), - std::move(type), - nullable, - std::move(families), - serial, - std::move(defaultExpr)); + return TColumnSchema{ + .Pos = std::move(pos), + .Name = std::move(name), + .Type = std::move(type), + .Families = std::move(families), + .DefaultExpr = std::move(defaultExpr), + .Compression = compression, + .Nullable = nullable, + .Serial = serial, + }; } TNodePtr TSqlTranslation::SerialTypeNode(const TRule_type_name_or_bind& node) { @@ -1909,7 +1995,7 @@ bool TSqlTranslation::CreateTableEntry(const TRule_create_table_entry& node, TCr const TString name(Id(node.GetAlt_create_table_entry6().GetRule_an_id_schema1(), *this)); const TPosition pos(Context().Pos()); - params.Columns.push_back(TColumnSchema(pos, name, nullptr, true, {}, false, nullptr)); + params.Columns.push_back({.Pos = std::move(pos), .Name = std::move(name), .Nullable = true}); break; } case NSQLv1Generated::TRule_create_table_entry::ALT_NOT_SET: diff --git a/yql/essentials/sql/v1/sql_translation.h b/yql/essentials/sql/v1/sql_translation.h index a5c2401ed3ae..4975f4c90bb9 100644 --- a/yql/essentials/sql/v1/sql_translation.h +++ b/yql/essentials/sql/v1/sql_translation.h @@ -105,6 +105,8 @@ std::pair TableKeyImpl(const std::pair std::pair TableKeyImpl(const TRule_table_key& node, TTranslation& ctx, bool hasAt); +TMaybe ColumnCompression(const TRule_compression& node, TTranslation& ctx); + TMaybe ColumnOptions(const TRule_column_schema& node, TTranslation& ctx); /// \return optional prefix diff --git a/yql/essentials/sql/v1/sql_ut_antlr4.cpp b/yql/essentials/sql/v1/sql_ut_antlr4.cpp index a9dd459223bb..6c9f083a1570 100644 --- a/yql/essentials/sql/v1/sql_ut_antlr4.cpp +++ b/yql/essentials/sql/v1/sql_ut_antlr4.cpp @@ -97,3 +97,179 @@ Y_UNIT_TEST(Simple) { };)"); } } // Y_UNIT_TEST_SUITE(QuerySplit) + +Y_UNIT_TEST_SUITE(ColumnCompression) { + +Y_UNIT_TEST(CreateCompressedColumn) { + auto res = SqlToYql(R"sql( + USE ydb; + CREATE TABLE tbl ( + k Uint64 NOT NULL, + v Uint64 COMPRESSION(algorithm=zstd, level=5), + PRIMARY KEY (k) + ); + )sql"); + + UNIT_ASSERT_C(res.IsOk(), res.Issues.ToOneLineString()); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_STRING_CONTAINS(line, "columnCompression"); + UNIT_ASSERT_STRING_CONTAINS(line, "algorithm (String '\"zstd"); + UNIT_ASSERT_STRING_CONTAINS(line, "level (Uint64 '\"5"); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(NoColumnCompressionAtCreationIfNotSpecified) { + auto res = SqlToYql(R"sql( + USE ydb; + CREATE TABLE tbl ( + k Uint64 NOT NULL, + v Uint64, + PRIMARY KEY (k) + ); + )sql"); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("columnCompression")); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(CreateCompressedColumnEmptyAttributes) { + auto res = SqlToYql(R"sql( + USE ydb; + CREATE TABLE tbl ( + k Uint64 NOT NULL, + v Uint64 COMPRESSION(), + PRIMARY KEY (k) + ); + )sql"); + + UNIT_ASSERT_C(res.IsOk(), res.Issues.ToOneLineString()); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_STRING_CONTAINS(line, "columnCompression"); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(CreateColumnDoubleCompression) { + auto res = SqlToYql(R"sql( + USE ydb; + CREATE TABLE tbl ( + k Uint64 NOT NULL, + v Uint64 COMPRESSION() COMPRESSION(), + PRIMARY KEY (k) + ); + )sql"); + + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "
:5:36: Error: 'COMPRESSION' option can be specified only once\n"); +} + +Y_UNIT_TEST(AlterColumnCompression) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET COMPRESSION(algorithm=lz4, level=1); + )sql"); + + UNIT_ASSERT_C(res.IsOk(), res.Issues.ToOneLineString()); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_STRING_CONTAINS(line, "changeCompression"); + UNIT_ASSERT_STRING_CONTAINS(line, "algorithm (String '\"lz4"); + UNIT_ASSERT_STRING_CONTAINS(line, "level (Uint64 '\"1"); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(NoColumnCompressionAtAlterIfNotSpecified) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET NOT NULL; + )sql"); + + UNIT_ASSERT_C(res.IsOk(), res.Issues.ToOneLineString()); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("columnCompression")); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(AlterColumnCompressionEmptyAttributes) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET COMPRESSION(); + )sql"); + + UNIT_ASSERT_C(res.IsOk(), res.Issues.ToOneLineString()); + + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + if (word == "Write") { + UNIT_ASSERT_STRING_CONTAINS(line, "changeCompression"); + } + }; + + TWordCountHive elementStat = {{TString("Write"), 0}}; + VerifyProgram(res, elementStat, verifyLine); + UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); +} + +Y_UNIT_TEST(AlterColumnCompressionDoubleAlgorithm) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET COMPRESSION(algorithm=lz4, algorithm=zstd); + )sql"); + + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "
:3:73: Error: 'algorithm' setting can be specified only once\n"); +} + +Y_UNIT_TEST(AlterColumnCompressionDoubleLevel) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET COMPRESSION(level=1, level=2); + )sql"); + + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "
:3:67: Error: 'level' setting can be specified only once\n"); +} + +Y_UNIT_TEST(AlterColumnCompressionLevelNegative) { + auto res = SqlToYql(R"sql( + USE ydb; + ALTER TABLE tbl ALTER COLUMN val SET COMPRESSION(level=-1); + )sql"); + + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_STRING_CONTAINS(Err2Str(res), "
:3:63: Error: extraneous input '-' expecting"); +} + +} // Y_UNIT_TEST_SUITE(ColumnCompression) From c61d2226cd86de967ae919bd9e9b731ac48ea0de Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 11 Nov 2025 16:48:16 +0300 Subject: [PATCH 11/17] Intermediate changes commit_hash:684f14a6f19a735297e2d00229b9bc1d7b46e18a --- .../matplotlib-inline/.dist-info/METADATA | 63 +++++--------- .../.dist-info/entry_points.txt | 3 +- .../matplotlib_inline/__init__.py | 8 +- .../matplotlib_inline/backend_inline.py | 85 ++++++++++++------- .../matplotlib_inline/config.py | 41 +++++---- .../matplotlib_inline/py.typed | 0 contrib/python/matplotlib-inline/ya.make | 3 +- 7 files changed, 111 insertions(+), 92 deletions(-) create mode 100644 contrib/python/matplotlib-inline/matplotlib_inline/py.typed diff --git a/contrib/python/matplotlib-inline/.dist-info/METADATA b/contrib/python/matplotlib-inline/.dist-info/METADATA index 2046024a647b..c0aef502d2e5 100644 --- a/contrib/python/matplotlib-inline/.dist-info/METADATA +++ b/contrib/python/matplotlib-inline/.dist-info/METADATA @@ -1,61 +1,37 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: matplotlib-inline -Version: 0.1.7 +Version: 0.2.1 Summary: Inline Matplotlib backend for Jupyter -Author-email: IPython Development Team -License: BSD 3-Clause License - - Copyright (c) 2019-2022, IPython Development Team. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - 2. 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. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. - -Project-URL: Homepage, https://github.com/ipython/matplotlib-inline Keywords: ipython,jupyter,matplotlib,python +Author-email: IPython Development Team +Requires-Python: >=3.9 +Description-Content-Type: text/markdown Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: IPython -Classifier: Framework :: Jupyter -Classifier: Framework :: Jupyter :: JupyterLab Classifier: Framework :: Jupyter :: JupyterLab :: 3 Classifier: Framework :: Jupyter :: JupyterLab :: 4 +Classifier: Framework :: Jupyter :: JupyterLab +Classifier: Framework :: Jupyter Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Science/Research -Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python Classifier: Topic :: Multimedia :: Graphics -Requires-Python: >=3.8 -Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: traitlets +Requires-Dist: flake8 ; extra == "test" +Requires-Dist: nbdime ; extra == "test" +Requires-Dist: nbval ; extra == "test" +Requires-Dist: notebook ; extra == "test" +Requires-Dist: pytest ; extra == "test" +Project-URL: Homepage, https://github.com/ipython/matplotlib-inline +Provides-Extra: test # Matplotlib Inline Back-end for IPython and Jupyter @@ -95,3 +71,4 @@ plt.title('A simple chirp'); ## License Licensed under the terms of the BSD 3-Clause License, by the IPython Development Team (see `LICENSE` file). + diff --git a/contrib/python/matplotlib-inline/.dist-info/entry_points.txt b/contrib/python/matplotlib-inline/.dist-info/entry_points.txt index cc52c3383b61..7a26e3855c14 100644 --- a/contrib/python/matplotlib-inline/.dist-info/entry_points.txt +++ b/contrib/python/matplotlib-inline/.dist-info/entry_points.txt @@ -1,2 +1,3 @@ [matplotlib.backend] -inline = matplotlib_inline.backend_inline +inline=matplotlib_inline.backend_inline + diff --git a/contrib/python/matplotlib-inline/matplotlib_inline/__init__.py b/contrib/python/matplotlib-inline/matplotlib_inline/__init__.py index dce942f89914..d275175ecd97 100644 --- a/contrib/python/matplotlib-inline/matplotlib_inline/__init__.py +++ b/contrib/python/matplotlib-inline/matplotlib_inline/__init__.py @@ -1,2 +1,8 @@ from . import backend_inline, config # noqa -__version__ = "0.1.7" # noqa + +__version__ = "0.2.1" + +# we can't ''.join(...) otherwise finding the version number at build time requires +# import which introduces IPython and matplotlib at build time, and thus circular +# dependencies. +version_info = tuple(int(s) for s in __version__.split(".")[:3]) diff --git a/contrib/python/matplotlib-inline/matplotlib_inline/backend_inline.py b/contrib/python/matplotlib-inline/matplotlib_inline/backend_inline.py index 05554b0d223b..a798c562a7fa 100644 --- a/contrib/python/matplotlib-inline/matplotlib_inline/backend_inline.py +++ b/contrib/python/matplotlib-inline/matplotlib_inline/backend_inline.py @@ -4,17 +4,16 @@ # Distributed under the terms of the BSD 3-Clause License. import matplotlib +from IPython.core.getipython import get_ipython +from IPython.core.interactiveshell import InteractiveShell +from IPython.core.pylabtools import select_figure_formats +from IPython.display import display from matplotlib import colors +from matplotlib._pylab_helpers import Gcf from matplotlib.backends import backend_agg from matplotlib.backends.backend_agg import FigureCanvasAgg -from matplotlib._pylab_helpers import Gcf from matplotlib.figure import Figure -from IPython.core.interactiveshell import InteractiveShell -from IPython.core.getipython import get_ipython -from IPython.core.pylabtools import select_figure_formats -from IPython.display import display - from .config import InlineBackend @@ -43,10 +42,11 @@ def new_figure_manager_given_figure(num, figure): # https://github.com/ipython/ipython/issues/1612 # https://github.com/matplotlib/matplotlib/issues/835 - if not hasattr(figure, 'show'): + if not hasattr(figure, "show"): # Queue up `figure` for display figure.show = lambda *a: display( - figure, metadata=_fetch_figure_metadata(figure)) + figure, metadata=_fetch_figure_metadata(figure) + ) # If matplotlib was manually set to non-interactive mode, this function # should be a no-op (otherwise we'll generate duplicate plots, since a user @@ -89,20 +89,20 @@ def show(close=None, block=None): for figure_manager in Gcf.get_all_fig_managers(): display( figure_manager.canvas.figure, - metadata=_fetch_figure_metadata(figure_manager.canvas.figure) + metadata=_fetch_figure_metadata(figure_manager.canvas.figure), ) finally: show._to_draw = [] # only call close('all') if any to close # close triggers gc.collect, which can be slow if close and Gcf.get_all_fig_managers(): - matplotlib.pyplot.close('all') + matplotlib.pyplot.close("all") # This flag will be reset by draw_if_interactive when called -show._draw_called = False +show._draw_called = False # type: ignore[attr-defined] # list of figures to draw when flush_figures is called -show._to_draw = [] +show._to_draw = [] # type: ignore[attr-defined] def flush_figures(): @@ -176,8 +176,8 @@ def configure_inline_support(shell, backend): if cfg not in shell.configurables: shell.configurables.append(cfg) - if backend in ('inline', 'module://matplotlib_inline.backend_inline'): - shell.events.register('post_execute', flush_figures) + if backend in ("inline", "module://matplotlib_inline.backend_inline"): + shell.events.register("post_execute", flush_figures) # Save rcParams that will be overwrittern shell._saved_rcParams = {} @@ -188,10 +188,10 @@ def configure_inline_support(shell, backend): new_backend_name = "inline" else: try: - shell.events.unregister('post_execute', flush_figures) + shell.events.unregister("post_execute", flush_figures) except ValueError: pass - if hasattr(shell, '_saved_rcParams'): + if hasattr(shell, "_saved_rcParams"): matplotlib.rcParams.update(shell._saved_rcParams) del shell._saved_rcParams new_backend_name = "other" @@ -208,11 +208,18 @@ def configure_inline_support(shell, backend): def _enable_matplotlib_integration(): """Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend.""" - from matplotlib import get_backend ip = get_ipython() - backend = get_backend() - if ip and backend in ('inline', 'module://matplotlib_inline.backend_inline'): + + import matplotlib + + if matplotlib.__version_info__ >= (3, 10): + backend = matplotlib.get_backend(auto_select=False) + else: + backend = matplotlib.rcParams._get("backend") + + if ip and backend in ("inline", "module://matplotlib_inline.backend_inline"): from IPython.core.pylabtools import activate_matplotlib + try: activate_matplotlib(backend) configure_inline_support(ip, backend) @@ -221,8 +228,9 @@ def _enable_matplotlib_integration(): def configure_once(*args): activate_matplotlib(backend) configure_inline_support(ip, backend) - ip.events.unregister('post_run_cell', configure_once) - ip.events.register('post_run_cell', configure_once) + ip.events.unregister("post_run_cell", configure_once) + + ip.events.register("post_run_cell", configure_once) _enable_matplotlib_integration() @@ -233,13 +241,17 @@ def _fetch_figure_metadata(fig): # determine if a background is needed for legibility if _is_transparent(fig.get_facecolor()): # the background is transparent - ticksLight = _is_light([label.get_color() - for axes in fig.axes - for axis in (axes.xaxis, axes.yaxis) - for label in axis.get_ticklabels()]) + ticksLight = _is_light( + [ + label.get_color() + for axes in fig.axes + for axis in (axes.xaxis, axes.yaxis) + for label in axis.get_ticklabels() + ] + ) if ticksLight.size and (ticksLight == ticksLight[0]).all(): # there are one or more tick labels, all with the same lightness - return {'needs_background': 'dark' if ticksLight[0] else 'light'} + return {"needs_background": "dark" if ticksLight[0] else "light"} return None @@ -249,13 +261,13 @@ def _is_light(color): opposed to dark). Based on ITU BT.601 luminance formula (see https://stackoverflow.com/a/596241).""" rgbaArr = colors.to_rgba_array(color) - return rgbaArr[:, :3].dot((.299, .587, .114)) > .5 + return rgbaArr[:, :3].dot((0.299, 0.587, 0.114)) > 0.5 def _is_transparent(color): """Determine transparency from alpha.""" rgba = colors.to_rgba(color) - return rgba[3] < .5 + return rgba[3] < 0.5 def set_matplotlib_formats(*formats, **kwargs): @@ -263,12 +275,21 @@ def set_matplotlib_formats(*formats, **kwargs): For example, this enables PNG and JPEG output with a JPEG quality of 90%:: - In [1]: set_matplotlib_formats('png', 'jpeg', quality=90) + In [1]: set_matplotlib_formats('png', 'jpeg', + pil_kwargs={'quality': 90}) + + To set this in your notebook by `%config` magic:: + + In [1]: %config InlineBackend.figure_formats = {'png', 'jpeg'} + %config InlineBackend.print_figure_kwargs = \\ + {'pil_kwargs': {'quality' : 90}} To set this in your config files use the following:: c.InlineBackend.figure_formats = {'png', 'jpeg'} - c.InlineBackend.print_figure_kwargs.update({'quality' : 90}) + c.InlineBackend.print_figure_kwargs.update({ + 'pil_kwargs': {'quality' : 90} + }) Parameters ---------- @@ -276,6 +297,10 @@ def set_matplotlib_formats(*formats, **kwargs): One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'. **kwargs Keyword args will be relayed to ``figure.canvas.print_figure``. + + In addition, see the docstrings of `plt.savefig()`, + `matplotlib.figure.Figure.savefig()`, `PIL.Image.Image.save()` and + :ref:`Pillow Image file formats `. """ # build kwargs, starting with InlineBackend config cfg = InlineBackend.instance() diff --git a/contrib/python/matplotlib-inline/matplotlib_inline/config.py b/contrib/python/matplotlib-inline/matplotlib_inline/config.py index 8718babad92c..ce9be032fbd3 100644 --- a/contrib/python/matplotlib-inline/matplotlib_inline/config.py +++ b/contrib/python/matplotlib-inline/matplotlib_inline/config.py @@ -6,10 +6,8 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the BSD 3-Clause License. +from traitlets import Bool, Dict, Instance, Set, TraitError, Unicode from traitlets.config.configurable import SingletonConfigurable -from traitlets import ( - Dict, Instance, Set, Bool, TraitError, Unicode -) # Configurable for inline backend options @@ -18,6 +16,7 @@ def pil_available(): out = False try: from PIL import Image # noqa + out = True except ImportError: pass @@ -44,37 +43,45 @@ class InlineBackend(InlineBackendConfig): the box, but third-party tools may use it to manage rc data. To change personal defaults for matplotlib, use matplotlib's configuration tools, or customize this class in your `ipython_config.py` file for - IPython/Jupyter-specific usage.""").tag(config=True) + IPython/Jupyter-specific usage.""", + ).tag(config=True) figure_formats = Set( - {'png'}, + {"png"}, help="""A set of figure formats to enable: 'png', - 'retina', 'jpeg', 'svg', 'pdf'.""").tag(config=True) + 'retina', 'jpeg', 'svg', 'pdf'.""", + ).tag(config=True) def _update_figure_formatters(self): if self.shell is not None: from IPython.core.pylabtools import select_figure_formats - select_figure_formats(self.shell, self.figure_formats, **self.print_figure_kwargs) + + select_figure_formats( + self.shell, self.figure_formats, **self.print_figure_kwargs + ) def _figure_formats_changed(self, name, old, new): - if 'jpg' in new or 'jpeg' in new: + if "jpg" in new or "jpeg" in new: if not pil_available(): raise TraitError("Requires PIL/Pillow for JPG figures") self._update_figure_formatters() - figure_format = Unicode(help="""The figure format to enable (deprecated - use `figure_formats` instead)""").tag(config=True) + figure_format = Unicode( + help="""The figure format to enable (deprecated + use `figure_formats` instead)""" + ).tag(config=True) def _figure_format_changed(self, name, old, new): if new: self.figure_formats = {new} print_figure_kwargs = Dict( - {'bbox_inches': 'tight'}, + {"bbox_inches": "tight"}, help="""Extra kwargs to be passed to fig.canvas.print_figure. - Logical examples include: bbox_inches, quality (for jpeg figures), etc. - """ + Logical examples include: bbox_inches, pil_kwargs, etc. In addition, + see the docstrings of `set_matplotlib_formats`. + """, ).tag(config=True) _print_figure_kwargs_changed = _update_figure_formatters @@ -94,7 +101,9 @@ def _figure_format_changed(self, name, old, new): iterative editing of figures, and behaves most consistently with other matplotlib backends, but figure barriers between cells must be explicit. - """).tag(config=True) + """, + ).tag(config=True) - shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', - allow_none=True) + shell = Instance( + "IPython.core.interactiveshell.InteractiveShellABC", allow_none=True + ) diff --git a/contrib/python/matplotlib-inline/matplotlib_inline/py.typed b/contrib/python/matplotlib-inline/matplotlib_inline/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/contrib/python/matplotlib-inline/ya.make b/contrib/python/matplotlib-inline/ya.make index 0de287f135a3..718e1ebacab5 100644 --- a/contrib/python/matplotlib-inline/ya.make +++ b/contrib/python/matplotlib-inline/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.1.7) +VERSION(0.2.1) LICENSE(BSD-3-Clause) @@ -28,6 +28,7 @@ RESOURCE_FILES( .dist-info/METADATA .dist-info/entry_points.txt .dist-info/top_level.txt + matplotlib_inline/py.typed ) END() From 156c78e82a64bc776bfae4f23ed2097d44171b69 Mon Sep 17 00:00:00 2001 From: akhropov Date: Tue, 11 Nov 2025 16:48:17 +0300 Subject: [PATCH 12/17] Simplify: Y_ASSERT already contains Y_UNUSED for NDEBUG case commit_hash:b5bb48dba5876cb5fa844ea640062e9ba3d05e60 --- util/generic/ptr.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 90bcd05d7c25..04cfe50a4258 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -405,13 +405,11 @@ class TRefCounted { inline void Ref(intptr_t d) noexcept { auto resultCount = Counter_.Add(d); Y_ASSERT(resultCount >= d); - (void)resultCount; } inline void Ref() noexcept { auto resultCount = Counter_.Inc(); Y_ASSERT(resultCount != 0); - (void)resultCount; } inline void UnRef(intptr_t d) noexcept { @@ -433,7 +431,6 @@ class TRefCounted { inline void DecRef() noexcept { auto resultCount = Counter_.Dec(); Y_ASSERT(resultCount >= 0); - (void)resultCount; } TRefCounted(const TRefCounted&) From 4ecc650cd8efd5e07146dd9b753395ef5c92c987 Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 11 Nov 2025 17:34:13 +0300 Subject: [PATCH 13/17] Intermediate changes commit_hash:a896f67ee4a422fc51444623a7eb011bd16c9350 --- .../libs/cxxsupp/libcxx/.yandex_meta/build.ym | 12 +- .../libcxx/.yandex_meta/licenses.list.txt | 619 +--------------- .../libcxx/.yandex_meta/scripts/fixlic.py | 17 + .../libcxxmsvc/.yandex_meta/licenses.list.txt | 689 ------------------ .../core/test_framework/testdata/generate.sh | 56 ++ yt/yt/core/test_framework/ya.make | 2 + 6 files changed, 87 insertions(+), 1308 deletions(-) create mode 100644 contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/fixlic.py create mode 100644 yt/yt/core/test_framework/testdata/generate.sh diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym b/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym index c22b21665d23..057688913355 100644 --- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/build.ym @@ -4,6 +4,7 @@ {% block current_date %}2024-09-20{% endblock %} {% block keep_sources %} +.yandex_meta/scripts/fixlic.py .yandex_meta/scripts/sysincls.py include/__config_site include/__config_epilogue.h @@ -286,8 +287,17 @@ echo "no version update" rsync --recursive --delete --perms ${SRC}/ ${OUTPUT} {% endblock %} - {% block step_install %} {{super()}} rsync ${SYSINCLS}/stl-to-libcxx.yml ${ARCADIA_ROOT}/build/sysincl/stl-to-libcxx.yml {% endblock %} + +{% block run_license_analyzer %} +{{super()}} +base64 -d << EOF > ${BIN}/fixlic +{% include 'scripts/fixlic.py/base64' %} + +EOF +cat ${OUTPUT}/.yandex_meta/licenses.list.txt | python3 ${BIN}/fixlic > _ +mv _ ${OUTPUT}/.yandex_meta/licenses.list.txt +{% endblock %} diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt b/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt index 7a40b72ebc96..dd4031b688bc 100644 --- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/licenses.list.txt @@ -493,624 +493,6 @@ E: lichray@gmail.com D: Standard compatibility fixes. -====================File: include/any==================== -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_ANY -#define _LIBCPP_ANY - -/* - any synopsis - -namespace std { - - class bad_any_cast : public bad_cast - { - public: - virtual const char* what() const noexcept; - }; - - class any - { - public: - - // 6.3.1 any construct/destruct - any() noexcept; - - any(const any& other); - any(any&& other) noexcept; - - template - any(ValueType&& value); - - ~any(); - - // 6.3.2 any assignments - any& operator=(const any& rhs); - any& operator=(any&& rhs) noexcept; - - template - any& operator=(ValueType&& rhs); - - // 6.3.3 any modifiers - template - decay_t& emplace(Args&&... args); - template - decay_t& emplace(initializer_list, Args&&...); - void reset() noexcept; - void swap(any& rhs) noexcept; - - // 6.3.4 any observers - bool has_value() const noexcept; - const type_info& type() const noexcept; - }; - - // 6.4 Non-member functions - void swap(any& x, any& y) noexcept; - - template - any make_any(Args&& ...args); - template - any make_any(initializer_list, Args&& ...args); - - template - ValueType any_cast(const any& operand); - template - ValueType any_cast(any& operand); - template - ValueType any_cast(any&& operand); - - template - const ValueType* any_cast(const any* operand) noexcept; - template - ValueType* any_cast(any* operand) noexcept; - -} // namespace std - -*/ - -#include <__config> -#include <__memory/allocator.h> -#include <__memory/allocator_destructor.h> -#include <__memory/allocator_traits.h> -#include <__memory/unique_ptr.h> -#include <__type_traits/add_const.h> -#include <__type_traits/add_pointer.h> -#include <__type_traits/aligned_storage.h> -#include <__type_traits/conditional.h> -#include <__type_traits/decay.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_constructible.h> -#include <__type_traits/is_function.h> -#include <__type_traits/is_nothrow_constructible.h> -#include <__type_traits/is_reference.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_void.h> -#include <__type_traits/remove_cv.h> -#include <__type_traits/remove_cvref.h> -#include <__type_traits/remove_reference.h> -#include <__utility/forward.h> -#include <__utility/in_place.h> -#include <__utility/move.h> -#include <__utility/unreachable.h> -#include <__verbose_abort> -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -namespace std { -class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast { -public: - const char* what() const _NOEXCEPT override; -}; -} // namespace std - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 - -[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() { -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS - throw bad_any_cast(); -# else - _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode"); -# endif -} - -// Forward declarations -class _LIBCPP_TEMPLATE_VIS any; - -template -_LIBCPP_HIDE_FROM_ABI add_pointer_t> any_cast(any const*) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT; - -namespace __any_imp { -_LIBCPP_SUPPRESS_DEPRECATED_PUSH -using _Buffer = aligned_storage_t<3 * sizeof(void*), alignof(void*)>; -_LIBCPP_SUPPRESS_DEPRECATED_POP - -template -using _IsSmallObject = - integral_constant::value >; - -enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo }; - -template -struct _SmallHandler; -template -struct _LargeHandler; - -template -struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { - static constexpr int __id = 0; -}; -template -constexpr int __unique_typeinfo<_Tp>::__id; - -template -inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() { - return &__unique_typeinfo>>::__id; -} - -template -inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) { -# if !defined(_LIBCPP_HAS_NO_RTTI) - if (__id && *__id == typeid(_Tp)) - return true; -# endif - return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>(); -} - -template -using _Handler = conditional_t< _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>; - -} // namespace __any_imp - -class _LIBCPP_TEMPLATE_VIS any { -public: - // construct/destruct - _LIBCPP_HIDE_FROM_ABI constexpr any() _NOEXCEPT : __h_(nullptr) {} - - _LIBCPP_HIDE_FROM_ABI any(any const& __other) : __h_(nullptr) { - if (__other.__h_) - __other.__call(_Action::_Copy, this); - } - - _LIBCPP_HIDE_FROM_ABI any(any&& __other) _NOEXCEPT : __h_(nullptr) { - if (__other.__h_) - __other.__call(_Action::_Move, this); - } - - template < class _ValueType, - class _Tp = decay_t<_ValueType>, - class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value && - is_copy_constructible<_Tp>::value> > - _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value); - - template , - class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value > > - _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args); - - template , - class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && - is_copy_constructible<_Tp>::value> > - _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args); - - _LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); } - - // assignments - _LIBCPP_HIDE_FROM_ABI any& operator=(any const& __rhs) { - any(__rhs).swap(*this); - return *this; - } - - _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) _NOEXCEPT { - any(std::move(__rhs)).swap(*this); - return *this; - } - - template < class _ValueType, - class _Tp = decay_t<_ValueType>, - class = enable_if_t< !is_same<_Tp, any>::value && is_copy_constructible<_Tp>::value> > - _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs); - - template , - class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value> > - _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&...); - - template , - class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && - is_copy_constructible<_Tp>::value> > - _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...); - - // 6.3.3 any modifiers - _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { - if (__h_) - this->__call(_Action::_Destroy); - } - - _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) _NOEXCEPT; - - // 6.3.4 any observers - _LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; } - -# if !defined(_LIBCPP_HAS_NO_RTTI) - _LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT { - if (__h_) { - return *static_cast(this->__call(_Action::_TypeInfo)); - } else { - return typeid(void); - } - } -# endif - -private: - typedef __any_imp::_Action _Action; - using _HandleFuncPtr = void* (*)(_Action, any const*, any*, const type_info*, const void* __fallback_info); - - union _Storage { - _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {} - void* __ptr; - __any_imp::_Buffer __buf; - }; - - _LIBCPP_HIDE_FROM_ABI void* - __call(_Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr) - const { - return __h_(__a, this, __other, __info, __fallback_info); - } - - _LIBCPP_HIDE_FROM_ABI void* __call( - _Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr) { - return __h_(__a, this, __other, __info, __fallback_info); - } - - template - friend struct __any_imp::_SmallHandler; - template - friend struct __any_imp::_LargeHandler; - - template - friend add_pointer_t> any_cast(any const*) _NOEXCEPT; - - template - friend add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT; - - _HandleFuncPtr __h_ = nullptr; - _Storage __s_; -}; - -namespace __any_imp { -template -struct _LIBCPP_TEMPLATE_VIS _SmallHandler { - _LIBCPP_HIDE_FROM_ABI static void* - __handle(_Action __act, any const* __this, any* __other, type_info const* __info, const void* __fallback_info) { - switch (__act) { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info, __fallback_info); - case _Action::_TypeInfo: - return __type_info(); - } - __libcpp_unreachable(); - } - - template - _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp* __ret = static_cast<_Tp*>(static_cast(&__dest.__s_.__buf)); - _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...); - __dest.__h_ = &_SmallHandler::__handle; - return *__ret; - } - -private: - _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp* __p = static_cast<_Tp*>(static_cast(&__this.__s_.__buf)); - _ATraits::destroy(__a, __p); - __this.__h_ = nullptr; - } - - _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) { - _SmallHandler::__create(__dest, *static_cast<_Tp const*>(static_cast(&__this.__s_.__buf))); - } - - _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) { - _SmallHandler::__create(__dest, std::move(*static_cast<_Tp*>(static_cast(&__this.__s_.__buf)))); - __destroy(__this); - } - - _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, const void* __fallback_id) { - if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id)) - return static_cast(&__this.__s_.__buf); - return nullptr; - } - - _LIBCPP_HIDE_FROM_ABI static void* __type_info() { -# if !defined(_LIBCPP_HAS_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -# else - return nullptr; -# endif - } -}; - -template -struct _LIBCPP_TEMPLATE_VIS _LargeHandler { - _LIBCPP_HIDE_FROM_ABI static void* - __handle(_Action __act, any const* __this, any* __other, type_info const* __info, void const* __fallback_info) { - switch (__act) { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info, __fallback_info); - case _Action::_TypeInfo: - return __type_info(); - } - __libcpp_unreachable(); - } - - template - _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - typedef __allocator_destructor<_Alloc> _Dp; - _Alloc __a; - unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1)); - _Tp* __ret = __hold.get(); - _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...); - __dest.__s_.__ptr = __hold.release(); - __dest.__h_ = &_LargeHandler::__handle; - return *__ret; - } - -private: - _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp* __p = static_cast<_Tp*>(__this.__s_.__ptr); - _ATraits::destroy(__a, __p); - _ATraits::deallocate(__a, __p, 1); - __this.__h_ = nullptr; - } - - _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) { - _LargeHandler::__create(__dest, *static_cast<_Tp const*>(__this.__s_.__ptr)); - } - - _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) { - __dest.__s_.__ptr = __this.__s_.__ptr; - __dest.__h_ = &_LargeHandler::__handle; - __this.__h_ = nullptr; - } - - _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, void const* __fallback_info) { - if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info)) - return static_cast(__this.__s_.__ptr); - return nullptr; - } - - _LIBCPP_HIDE_FROM_ABI static void* __type_info() { -# if !defined(_LIBCPP_HAS_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -# else - return nullptr; -# endif - } -}; - -} // namespace __any_imp - -template -any::any(_ValueType&& __v) : __h_(nullptr) { - __any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__v)); -} - -template -any::any(in_place_type_t<_ValueType>, _Args&&... __args) { - __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...); -} - -template -any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) { - __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_HIDE_FROM_ABI any& any::operator=(_ValueType&& __v) { - any(std::forward<_ValueType>(__v)).swap(*this); - return *this; -} - -template -inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(_Args&&... __args) { - reset(); - return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { - reset(); - return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...); -} - -inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT { - if (this == &__rhs) - return; - if (__h_ && __rhs.__h_) { - any __tmp; - __rhs.__call(_Action::_Move, &__tmp); - this->__call(_Action::_Move, &__rhs); - __tmp.__call(_Action::_Move, this); - } else if (__h_) { - this->__call(_Action::_Move, &__rhs); - } else if (__rhs.__h_) { - __rhs.__call(_Action::_Move, this); - } -} - -// 6.4 Non-member functions - -inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap(__rhs); } - -template -inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) { - return any(in_place_type<_Tp>, std::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) { - return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any const& __v) { - using _RawValueType = __remove_cvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType const&>::value, - "ValueType is required to be a const lvalue reference " - "or a CopyConstructible type"); - auto __tmp = std::any_cast>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(*__tmp); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any& __v) { - using _RawValueType = __remove_cvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType&>::value, - "ValueType is required to be an lvalue reference " - "or a CopyConstructible type"); - auto __tmp = std::any_cast<_RawValueType>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(*__tmp); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any&& __v) { - using _RawValueType = __remove_cvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType>::value, - "ValueType is required to be an rvalue reference " - "or a CopyConstructible type"); - auto __tmp = std::any_cast<_RawValueType>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(std::move(*__tmp)); -} - -template -inline _LIBCPP_HIDE_FROM_ABI add_pointer_t> any_cast(any const* __any) _NOEXCEPT { - static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); - static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); - return std::any_cast<_ValueType>(const_cast(__any)); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void* __p, /*IsFunction*/ false_type) noexcept { - return static_cast<_RetType>(__p); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction*/ true_type) noexcept { - return nullptr; -} - -template -_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT { - using __any_imp::_Action; - static_assert(!is_void_v<_ValueType>, "_ValueType may not be void."); - static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference."); - typedef add_pointer_t<_ValueType> _ReturnType; - if (__any && __any->__h_) { - void* __p = __any->__call( - _Action::_Get, - nullptr, -# if !defined(_LIBCPP_HAS_NO_RTTI) - &typeid(_ValueType), -# else - nullptr, -# endif - __any_imp::__get_fallback_typeid<_ValueType>()); - return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{}); - } - return nullptr; -} - -#endif // _LIBCPP_STD_VER >= 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 -# include -#endif - -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#endif // _LIBCPP_ANY - - ====================MIT==================== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1229,3 +611,4 @@ Full text of the relevant licenses is included below. // THE DATA FILES OR SOFTWARE. // // COPYRIGHT AND PERMISSION NOTICE + diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/fixlic.py b/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/fixlic.py new file mode 100644 index 000000000000..e7c9c6c19762 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/fixlic.py @@ -0,0 +1,17 @@ +import sys + +def flt(): + skip = False + + for l in sys.stdin.read().split('\n'): + if skip: + if '====' in l: + skip = False + + if not skip: + if '====' in l and 'include/any' in l: + skip = True + else: + yield l + +print('\n'.join(flt()).strip() + '\n') diff --git a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/licenses.list.txt b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/licenses.list.txt index 041cb5535963..c6421467e8e8 100644 --- a/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/licenses.list.txt +++ b/contrib/libs/cxxsupp/libcxxmsvc/.yandex_meta/licenses.list.txt @@ -521,695 +521,6 @@ E: lichray@gmail.com D: Standard compatibility fixes. -====================File: include/any==================== -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_ANY -#define _LIBCPP_ANY - -/* - any synopsis - -namespace std { - - class bad_any_cast : public bad_cast - { - public: - virtual const char* what() const noexcept; - }; - - class any - { - public: - - // 6.3.1 any construct/destruct - any() noexcept; - - any(const any& other); - any(any&& other) noexcept; - - template - any(ValueType&& value); - - ~any(); - - // 6.3.2 any assignments - any& operator=(const any& rhs); - any& operator=(any&& rhs) noexcept; - - template - any& operator=(ValueType&& rhs); - - // 6.3.3 any modifiers - template - decay_t& emplace(Args&&... args); - template - decay_t& emplace(initializer_list, Args&&...); - void reset() noexcept; - void swap(any& rhs) noexcept; - - // 6.3.4 any observers - bool has_value() const noexcept; - const type_info& type() const noexcept; - }; - - // 6.4 Non-member functions - void swap(any& x, any& y) noexcept; - - template - any make_any(Args&& ...args); - template - any make_any(initializer_list, Args&& ...args); - - template - ValueType any_cast(const any& operand); - template - ValueType any_cast(any& operand); - template - ValueType any_cast(any&& operand); - - template - const ValueType* any_cast(const any* operand) noexcept; - template - ValueType* any_cast(any* operand) noexcept; - -} // namespace std - -*/ - -#include <__availability> -#include <__config> -#include <__utility/forward.h> -#include -#include -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -namespace std { -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast -{ -public: - virtual const char* what() const _NOEXCEPT; -}; -} // namespace std - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER > 14 - -_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -void __throw_bad_any_cast() -{ -#ifndef _LIBCPP_NO_EXCEPTIONS - throw bad_any_cast(); -#else - _VSTD::abort(); -#endif -} - -// Forward declarations -class _LIBCPP_TEMPLATE_VIS any; - -template -_LIBCPP_INLINE_VISIBILITY -add_pointer_t> -any_cast(any const *) _NOEXCEPT; - -template -_LIBCPP_INLINE_VISIBILITY -add_pointer_t<_ValueType> any_cast(any *) _NOEXCEPT; - -namespace __any_imp -{ - using _Buffer = aligned_storage_t<3*sizeof(void*), alignment_of::value>; - - template - using _IsSmallObject = integral_constant::value - % alignment_of<_Tp>::value == 0 - && is_nothrow_move_constructible<_Tp>::value - >; - - enum class _Action { - _Destroy, - _Copy, - _Move, - _Get, - _TypeInfo - }; - - template struct _SmallHandler; - template struct _LargeHandler; - - template - struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { static constexpr int __id = 0; }; - template constexpr int __unique_typeinfo<_Tp>::__id; - - template - inline _LIBCPP_INLINE_VISIBILITY - constexpr const void* __get_fallback_typeid() { - return &__unique_typeinfo>>::__id; - } - - template - inline _LIBCPP_INLINE_VISIBILITY - bool __compare_typeid(type_info const* __id, const void* __fallback_id) - { -#if !defined(_LIBCPP_NO_RTTI) - if (__id && *__id == typeid(_Tp)) - return true; -#endif - if (!__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>()) - return true; - return false; - } - - template - using _Handler = conditional_t< - _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>; - -} // namespace __any_imp - -class _LIBCPP_TEMPLATE_VIS any -{ -public: - // construct/destruct - _LIBCPP_INLINE_VISIBILITY - constexpr any() _NOEXCEPT : __h(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - any(any const & __other) : __h(nullptr) - { - if (__other.__h) __other.__call(_Action::_Copy, this); - } - - _LIBCPP_INLINE_VISIBILITY - any(any && __other) _NOEXCEPT : __h(nullptr) - { - if (__other.__h) __other.__call(_Action::_Move, this); - } - - template < - class _ValueType - , class _Tp = decay_t<_ValueType> - , class = enable_if_t< - !is_same<_Tp, any>::value && - !__is_inplace_type<_ValueType>::value && - is_copy_constructible<_Tp>::value> - > - _LIBCPP_INLINE_VISIBILITY - any(_ValueType && __value); - - template , - class = enable_if_t< - is_constructible<_Tp, _Args...>::value && - is_copy_constructible<_Tp>::value - > - > - _LIBCPP_INLINE_VISIBILITY - explicit any(in_place_type_t<_ValueType>, _Args&&... __args); - - template , - class = enable_if_t< - is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && - is_copy_constructible<_Tp>::value> - > - _LIBCPP_INLINE_VISIBILITY - explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args); - - _LIBCPP_INLINE_VISIBILITY - ~any() { this->reset(); } - - // assignments - _LIBCPP_INLINE_VISIBILITY - any & operator=(any const & __rhs) { - any(__rhs).swap(*this); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - any & operator=(any && __rhs) _NOEXCEPT { - any(_VSTD::move(__rhs)).swap(*this); - return *this; - } - - template < - class _ValueType - , class _Tp = decay_t<_ValueType> - , class = enable_if_t< - !is_same<_Tp, any>::value - && is_copy_constructible<_Tp>::value> - > - _LIBCPP_INLINE_VISIBILITY - any & operator=(_ValueType && __rhs); - - template , - class = enable_if_t< - is_constructible<_Tp, _Args...>::value && - is_copy_constructible<_Tp>::value> - > - _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(_Args&&... args); - - template , - class = enable_if_t< - is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && - is_copy_constructible<_Tp>::value> - > - _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(initializer_list<_Up>, _Args&&...); - - // 6.3.3 any modifiers - _LIBCPP_INLINE_VISIBILITY - void reset() _NOEXCEPT { if (__h) this->__call(_Action::_Destroy); } - - _LIBCPP_INLINE_VISIBILITY - void swap(any & __rhs) _NOEXCEPT; - - // 6.3.4 any observers - _LIBCPP_INLINE_VISIBILITY - bool has_value() const _NOEXCEPT { return __h != nullptr; } - -#if !defined(_LIBCPP_NO_RTTI) - _LIBCPP_INLINE_VISIBILITY - const type_info & type() const _NOEXCEPT { - if (__h) { - return *static_cast(this->__call(_Action::_TypeInfo)); - } else { - return typeid(void); - } - } -#endif - -private: - typedef __any_imp::_Action _Action; - using _HandleFuncPtr = void* (*)(_Action, any const *, any *, const type_info *, - const void* __fallback_info); - - union _Storage { - constexpr _Storage() : __ptr(nullptr) {} - void * __ptr; - __any_imp::_Buffer __buf; - }; - - _LIBCPP_INLINE_VISIBILITY - void * __call(_Action __a, any * __other = nullptr, - type_info const * __info = nullptr, - const void* __fallback_info = nullptr) const - { - return __h(__a, this, __other, __info, __fallback_info); - } - - _LIBCPP_INLINE_VISIBILITY - void * __call(_Action __a, any * __other = nullptr, - type_info const * __info = nullptr, - const void* __fallback_info = nullptr) - { - return __h(__a, this, __other, __info, __fallback_info); - } - - template - friend struct __any_imp::_SmallHandler; - template - friend struct __any_imp::_LargeHandler; - - template - friend add_pointer_t> - any_cast(any const *) _NOEXCEPT; - - template - friend add_pointer_t<_ValueType> - any_cast(any *) _NOEXCEPT; - - _HandleFuncPtr __h = nullptr; - _Storage __s; -}; - -namespace __any_imp -{ - template - struct _LIBCPP_TEMPLATE_VIS _SmallHandler - { - _LIBCPP_INLINE_VISIBILITY - static void* __handle(_Action __act, any const * __this, any * __other, - type_info const * __info, const void* __fallback_info) - { - switch (__act) - { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info, __fallback_info); - case _Action::_TypeInfo: - return __type_info(); - } - } - - template - _LIBCPP_INLINE_VISIBILITY - static _Tp& __create(any & __dest, _Args&&... __args) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp * __ret = static_cast<_Tp*>(static_cast(&__dest.__s.__buf)); - _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); - __dest.__h = &_SmallHandler::__handle; - return *__ret; - } - - private: - _LIBCPP_INLINE_VISIBILITY - static void __destroy(any & __this) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp * __p = static_cast<_Tp *>(static_cast(&__this.__s.__buf)); - _ATraits::destroy(__a, __p); - __this.__h = nullptr; - } - - _LIBCPP_INLINE_VISIBILITY - static void __copy(any const & __this, any & __dest) { - _SmallHandler::__create(__dest, *static_cast<_Tp const *>( - static_cast(&__this.__s.__buf))); - } - - _LIBCPP_INLINE_VISIBILITY - static void __move(any & __this, any & __dest) { - _SmallHandler::__create(__dest, _VSTD::move( - *static_cast<_Tp*>(static_cast(&__this.__s.__buf)))); - __destroy(__this); - } - - _LIBCPP_INLINE_VISIBILITY - static void* __get(any & __this, - type_info const * __info, - const void* __fallback_id) - { - if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id)) - return static_cast(&__this.__s.__buf); - return nullptr; - } - - _LIBCPP_INLINE_VISIBILITY - static void* __type_info() - { -#if !defined(_LIBCPP_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -#else - return nullptr; -#endif - } - }; - - template - struct _LIBCPP_TEMPLATE_VIS _LargeHandler - { - _LIBCPP_INLINE_VISIBILITY - static void* __handle(_Action __act, any const * __this, - any * __other, type_info const * __info, - void const* __fallback_info) - { - switch (__act) - { - case _Action::_Destroy: - __destroy(const_cast(*__this)); - return nullptr; - case _Action::_Copy: - __copy(*__this, *__other); - return nullptr; - case _Action::_Move: - __move(const_cast(*__this), *__other); - return nullptr; - case _Action::_Get: - return __get(const_cast(*__this), __info, __fallback_info); - case _Action::_TypeInfo: - return __type_info(); - } - } - - template - _LIBCPP_INLINE_VISIBILITY - static _Tp& __create(any & __dest, _Args&&... __args) { - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - typedef __allocator_destructor<_Alloc> _Dp; - _Alloc __a; - unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1)); - _Tp * __ret = __hold.get(); - _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); - __dest.__s.__ptr = __hold.release(); - __dest.__h = &_LargeHandler::__handle; - return *__ret; - } - - private: - - _LIBCPP_INLINE_VISIBILITY - static void __destroy(any & __this){ - typedef allocator<_Tp> _Alloc; - typedef allocator_traits<_Alloc> _ATraits; - _Alloc __a; - _Tp * __p = static_cast<_Tp *>(__this.__s.__ptr); - _ATraits::destroy(__a, __p); - _ATraits::deallocate(__a, __p, 1); - __this.__h = nullptr; - } - - _LIBCPP_INLINE_VISIBILITY - static void __copy(any const & __this, any & __dest) { - _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr)); - } - - _LIBCPP_INLINE_VISIBILITY - static void __move(any & __this, any & __dest) { - __dest.__s.__ptr = __this.__s.__ptr; - __dest.__h = &_LargeHandler::__handle; - __this.__h = nullptr; - } - - _LIBCPP_INLINE_VISIBILITY - static void* __get(any & __this, type_info const * __info, - void const* __fallback_info) - { - if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info)) - return static_cast(__this.__s.__ptr); - return nullptr; - - } - - _LIBCPP_INLINE_VISIBILITY - static void* __type_info() - { -#if !defined(_LIBCPP_NO_RTTI) - return const_cast(static_cast(&typeid(_Tp))); -#else - return nullptr; -#endif - } - }; - -} // namespace __any_imp - - -template -any::any(_ValueType && __v) : __h(nullptr) -{ - __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_ValueType>(__v)); -} - -template -any::any(in_place_type_t<_ValueType>, _Args&&... __args) { - __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); -} - -template -any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) { - __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -any & any::operator=(_ValueType && __v) -{ - any(_VSTD::forward<_ValueType>(__v)).swap(*this); - return *this; -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_Tp& any::emplace(_Args&&... __args) { - reset(); - return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { - reset(); - return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); -} - -inline _LIBCPP_INLINE_VISIBILITY -void any::swap(any & __rhs) _NOEXCEPT -{ - if (this == &__rhs) - return; - if (__h && __rhs.__h) { - any __tmp; - __rhs.__call(_Action::_Move, &__tmp); - this->__call(_Action::_Move, &__rhs); - __tmp.__call(_Action::_Move, this); - } - else if (__h) { - this->__call(_Action::_Move, &__rhs); - } - else if (__rhs.__h) { - __rhs.__call(_Action::_Move, this); - } -} - -// 6.4 Non-member functions - -inline _LIBCPP_INLINE_VISIBILITY -void swap(any & __lhs, any & __rhs) _NOEXCEPT -{ - __lhs.swap(__rhs); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -any make_any(_Args&&... __args) { - return any(in_place_type<_Tp>, _VSTD::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -any make_any(initializer_list<_Up> __il, _Args&&... __args) { - return any(in_place_type<_Tp>, __il, _VSTD::forward<_Args>(__args)...); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any const & __v) -{ - using _RawValueType = __uncvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType const &>::value, - "ValueType is required to be a const lvalue reference " - "or a CopyConstructible type"); - auto __tmp = _VSTD::any_cast>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(*__tmp); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any & __v) -{ - using _RawValueType = __uncvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType &>::value, - "ValueType is required to be an lvalue reference " - "or a CopyConstructible type"); - auto __tmp = _VSTD::any_cast<_RawValueType>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(*__tmp); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST -_ValueType any_cast(any && __v) -{ - using _RawValueType = __uncvref_t<_ValueType>; - static_assert(is_constructible<_ValueType, _RawValueType>::value, - "ValueType is required to be an rvalue reference " - "or a CopyConstructible type"); - auto __tmp = _VSTD::any_cast<_RawValueType>(&__v); - if (__tmp == nullptr) - __throw_bad_any_cast(); - return static_cast<_ValueType>(_VSTD::move(*__tmp)); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -add_pointer_t> -any_cast(any const * __any) _NOEXCEPT -{ - static_assert(!is_reference<_ValueType>::value, - "_ValueType may not be a reference."); - return _VSTD::any_cast<_ValueType>(const_cast(__any)); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_RetType __pointer_or_func_cast(void* __p, /*IsFunction*/false_type) noexcept { - return static_cast<_RetType>(__p); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -_RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept { - return nullptr; -} - -template -add_pointer_t<_ValueType> -any_cast(any * __any) _NOEXCEPT -{ - using __any_imp::_Action; - static_assert(!is_reference<_ValueType>::value, - "_ValueType may not be a reference."); - typedef typename add_pointer<_ValueType>::type _ReturnType; - if (__any && __any->__h) { - void *__p = __any->__call(_Action::_Get, nullptr, -#if !defined(_LIBCPP_NO_RTTI) - &typeid(_ValueType), -#else - nullptr, -#endif - __any_imp::__get_fallback_typeid<_ValueType>()); - return _VSTD::__pointer_or_func_cast<_ReturnType>( - __p, is_function<_ValueType>{}); - } - return nullptr; -} - -#endif // _LIBCPP_STD_VER > 14 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_ANY - - ====================MIT==================== 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/yt/yt/core/test_framework/testdata/generate.sh b/yt/yt/core/test_framework/testdata/generate.sh new file mode 100644 index 000000000000..142cb505e8a6 --- /dev/null +++ b/yt/yt/core/test_framework/testdata/generate.sh @@ -0,0 +1,56 @@ +openssl req -x509 -noenc -newkey rsa:4096 -keyout ca_key.pem -out ca.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ + -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ + -addext "keyUsage=keyCertSign" + +openssl req -new -x509 -noenc -newkey rsa:4096 -keyout key.pem -out cert.pem \ + -CA ca.pem -CAkey ca_key.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ + -addext "basicConstraints=critical,CA:FALSE" \ + -addext "keyUsage=digitalSignature,keyEncipherment" \ + -addext "extendedKeyUsage=serverAuth,clientAuth" + +openssl req -x509 -noenc -newkey rsa:4096 -keyout ca_key_with_ip_in_san.pem -out ca_with_ip_in_san.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ + -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ + -addext "keyUsage=keyCertSign" + +openssl req -new -x509 -noenc -newkey rsa:4096 -keyout key_with_ip_in_san.pem -out cert_with_ip_in_san.pem \ + -CA ca_with_ip_in_san.pem -CAkey ca_key_with_ip_in_san.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ + -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1" \ + -addext "basicConstraints=critical,CA:FALSE" \ + -addext "keyUsage=digitalSignature,keyEncipherment" \ + -addext "extendedKeyUsage=serverAuth,clientAuth" + +openssl req -x509 -noenc -newkey ec:<(openssl ecparam -name prime256v1) -keyout ca_key_ec.pem -out ca_ec.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost CA" \ + -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ + -addext "keyUsage=keyCertSign" + +openssl req -new -x509 -noenc -newkey ec:<(openssl ecparam -name prime256v1) -keyout key_ec.pem -out cert_ec.pem \ + -CA ca_ec.pem -CAkey ca_key_ec.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ + -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1" \ + -addext "basicConstraints=critical,CA:FALSE" \ + -addext "keyUsage=digitalSignature,keyEncipherment" \ + -addext "extendedKeyUsage=serverAuth,clientAuth" + +openssl req -x509 -noenc -newkey rsa:4096 -keyout rpc_ca_key.pem -out rpc_ca.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=Localhost RPC CA" \ + -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \ + -addext "keyUsage=keyCertSign" + +openssl req -new -x509 -noenc -newkey rsa:4096 -keyout rpc_server_key.pem -out rpc_server_cert.pem \ + -CA rpc_ca.pem -CAkey rpc_ca_key.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ + -addext "basicConstraints=critical,CA:FALSE" \ + -addext "keyUsage=digitalSignature,keyEncipherment" \ + -addext "extendedKeyUsage=serverAuth" + +openssl req -new -x509 -noenc -newkey rsa:4096 -keyout rpc_client_key.pem -out rpc_client_cert.pem \ + -CA rpc_ca.pem -CAkey rpc_ca_key.pem \ + -days 3650 -subj "/C=RU/L=Moscow/O=Yandex/CN=localhost" \ + -addext "basicConstraints=critical,CA:FALSE" \ + -addext "keyUsage=digitalSignature,keyEncipherment" \ + -addext "extendedKeyUsage=clientAuth" diff --git a/yt/yt/core/test_framework/ya.make b/yt/yt/core/test_framework/ya.make index 945224e4f969..e30255f3fd74 100644 --- a/yt/yt/core/test_framework/ya.make +++ b/yt/yt/core/test_framework/ya.make @@ -39,6 +39,8 @@ RESOURCE( ${TEST_DATA_DIR}/rpc_server_key.pem /testdata/rpc_server_key.pem ${TEST_DATA_DIR}/rpc_client_cert.pem /testdata/rpc_client_cert.pem ${TEST_DATA_DIR}/rpc_client_key.pem /testdata/rpc_client_key.pem + # For publishing generate script to OpenSource. + ${TEST_DATA_DIR}/generate.sh /testdata/generate.sh ) END() From 9491c44b064989a6fc7b0b2da1fa86192945727a Mon Sep 17 00:00:00 2001 From: alexpaniman Date: Tue, 11 Nov 2025 17:57:08 +0300 Subject: [PATCH 14/17] Add CBO parameter for configuring Shuffle Elimination cutoff Adds configurable Shuffle Elimination cutoff option based on number of joins in a query. This option is primarily needed for benchmarking CBO with Shuffle Elimination on different queries, PR with benchmarks is going to be to merged at github , but since it also changes yql/essentials, this PR on Arcanum needs to be merged first. commit_hash:5ca0bbf08f8ec4c370cba0cf2e4034e4a90d3cdf --- yql/essentials/core/cbo/cbo_optimizer_new.h | 10 ++++++---- yql/essentials/core/cbo/simple/cbo_simple.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/yql/essentials/core/cbo/cbo_optimizer_new.h b/yql/essentials/core/cbo/cbo_optimizer_new.h index 2bb4a9529787..af753640e359 100644 --- a/yql/essentials/core/cbo/cbo_optimizer_new.h +++ b/yql/essentials/core/cbo/cbo_optimizer_new.h @@ -385,6 +385,11 @@ struct IOptimizerNew { struct TExprContext; +struct TCBOSettings { + ui32 MaxDPhypDPTableSize = 100000; + bool ForceShuffleElimination = false; +}; + class IOptimizerFactory: private TNonCopyable { public: using TPtr = std::shared_ptr; @@ -392,10 +397,7 @@ class IOptimizerFactory: private TNonCopyable { virtual ~IOptimizerFactory() = default; - struct TNativeSettings { - ui32 MaxDPhypDPTableSize = 100000; - }; - virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ctx, const TNativeSettings& settings) const = 0; + virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ctx, const TCBOSettings& settings) const = 0; struct TPGSettings { TLogger Logger = [](const TString&) {}; diff --git a/yql/essentials/core/cbo/simple/cbo_simple.cpp b/yql/essentials/core/cbo/simple/cbo_simple.cpp index 466a7902822e..0543c0ab7923 100644 --- a/yql/essentials/core/cbo/simple/cbo_simple.cpp +++ b/yql/essentials/core/cbo/simple/cbo_simple.cpp @@ -9,7 +9,7 @@ namespace { class TSimpleOptimizerFactory: public IOptimizerFactory { public: - virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ctx, const TNativeSettings& settings) const override { + virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ctx, const TCBOSettings& settings) const override { Y_UNUSED(pctx); Y_UNUSED(ctx); Y_UNUSED(settings); From 58a0bad8900e9f3fda91a860bcfe0a509fa71ed8 Mon Sep 17 00:00:00 2001 From: ermolovd Date: Tue, 11 Nov 2025 18:40:43 +0300 Subject: [PATCH 15/17] improve error message commit_hash:f5a840952c97d019b950bc1093d1e379dcebbb6d --- yt/cpp/mapreduce/http/host_manager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yt/cpp/mapreduce/http/host_manager.cpp b/yt/cpp/mapreduce/http/host_manager.cpp index e9716ec7a6e0..3ad47be32976 100644 --- a/yt/cpp/mapreduce/http/host_manager.cpp +++ b/yt/cpp/mapreduce/http/host_manager.cpp @@ -4,7 +4,6 @@ #include "helpers.h" #include "http.h" #include "http_client.h" -#include "requests.h" #include @@ -124,8 +123,13 @@ THostManager::TClusterHostList THostManager::GetHosts(const TClientContext& cont auto requestId = CreateGuidAsString(); // TODO: we need to set socket timeout here UpdateHeaderForProxyIfNeed(context.ServerName, context, header); - auto response = context.HttpClient->Request(GetFullUrlForProxy(context.ServerName, context, header), requestId, header); + auto url = GetFullUrlForProxy(context.ServerName, context, header); + auto response = context.HttpClient->Request(url, requestId, header); auto hosts = ParseJsonStringArray(response->GetResponse()); + if (hosts.empty()) { + const auto error = Format("Getting %Qv returned empty host list", url); + return TClusterHostList(std::make_exception_ptr(yexception() << error)); + } for (auto& host : hosts) { host = CreateHostNameWithPort(host, context); } From c54b7c20d30940dfd412821be83cf824e7ce0198 Mon Sep 17 00:00:00 2001 From: stebloev Date: Tue, 11 Nov 2025 18:59:26 +0300 Subject: [PATCH 16/17] Add snowball into ydb sync config commit_hash:8b009e3fc6950c079fcdb5d2c2b7e515a3db07ec --- contrib/libs/snowball/.yandex_meta/build.ym | 35 + .../.yandex_meta/devtools.copyrights.report | 94 + .../.yandex_meta/devtools.licenses.report | 45 + .../snowball/.yandex_meta/licenses.list.txt | 31 + contrib/libs/snowball/COPYING | 29 + contrib/libs/snowball/MANIFEST | 112 + contrib/libs/snowball/NEWS | 1549 ++++ contrib/libs/snowball/README | 151 + contrib/libs/snowball/include/libstemmer.h | 82 + contrib/libs/snowball/libstemmer/libstemmer.c | 96 + .../libs/snowball/libstemmer/libstemmer_c.in | 96 + .../snowball/libstemmer/libstemmer_utf8.c | 96 + contrib/libs/snowball/libstemmer/modules.h | 289 + contrib/libs/snowball/libstemmer/modules.txt | 66 + .../libs/snowball/libstemmer/modules_utf8.h | 205 + contrib/libs/snowball/runtime/api.c | 63 + contrib/libs/snowball/runtime/api.h | 32 + contrib/libs/snowball/runtime/header.h | 62 + contrib/libs/snowball/runtime/utilities.c | 513 ++ .../snowball/src_c/stem_ISO_8859_1_basque.c | 1155 +++ .../snowball/src_c/stem_ISO_8859_1_basque.h | 15 + .../snowball/src_c/stem_ISO_8859_1_catalan.c | 1469 ++++ .../snowball/src_c/stem_ISO_8859_1_catalan.h | 15 + .../snowball/src_c/stem_ISO_8859_1_danish.c | 336 + .../snowball/src_c/stem_ISO_8859_1_danish.h | 15 + .../snowball/src_c/stem_ISO_8859_1_dutch.c | 2015 +++++ .../snowball/src_c/stem_ISO_8859_1_dutch.h | 15 + .../src_c/stem_ISO_8859_1_dutch_porter.c | 661 ++ .../src_c/stem_ISO_8859_1_dutch_porter.h | 15 + .../snowball/src_c/stem_ISO_8859_1_english.c | 1155 +++ .../snowball/src_c/stem_ISO_8859_1_english.h | 15 + .../snowball/src_c/stem_ISO_8859_1_finnish.c | 761 ++ .../snowball/src_c/stem_ISO_8859_1_finnish.h | 15 + .../snowball/src_c/stem_ISO_8859_1_french.c | 1455 ++++ .../snowball/src_c/stem_ISO_8859_1_french.h | 15 + .../snowball/src_c/stem_ISO_8859_1_german.c | 620 ++ .../snowball/src_c/stem_ISO_8859_1_german.h | 15 + .../src_c/stem_ISO_8859_1_indonesian.c | 426 + .../src_c/stem_ISO_8859_1_indonesian.h | 15 + .../snowball/src_c/stem_ISO_8859_1_irish.c | 492 ++ .../snowball/src_c/stem_ISO_8859_1_irish.h | 15 + .../snowball/src_c/stem_ISO_8859_1_italian.c | 1081 +++ .../snowball/src_c/stem_ISO_8859_1_italian.h | 15 + .../src_c/stem_ISO_8859_1_norwegian.c | 344 + .../src_c/stem_ISO_8859_1_norwegian.h | 15 + .../snowball/src_c/stem_ISO_8859_1_porter.c | 761 ++ .../snowball/src_c/stem_ISO_8859_1_porter.h | 15 + .../src_c/stem_ISO_8859_1_portuguese.c | 1007 +++ .../src_c/stem_ISO_8859_1_portuguese.h | 15 + .../snowball/src_c/stem_ISO_8859_1_spanish.c | 1099 +++ .../snowball/src_c/stem_ISO_8859_1_spanish.h | 15 + .../snowball/src_c/stem_ISO_8859_1_swedish.c | 400 + .../snowball/src_c/stem_ISO_8859_1_swedish.h | 15 + .../src_c/stem_ISO_8859_2_hungarian.c | 875 +++ .../src_c/stem_ISO_8859_2_hungarian.h | 15 + .../libs/snowball/src_c/stem_KOI8_R_russian.c | 703 ++ .../libs/snowball/src_c/stem_KOI8_R_russian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_arabic.c | 1756 +++++ .../libs/snowball/src_c/stem_UTF_8_arabic.h | 15 + .../libs/snowball/src_c/stem_UTF_8_armenian.c | 564 ++ .../libs/snowball/src_c/stem_UTF_8_armenian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_basque.c | 1158 +++ .../libs/snowball/src_c/stem_UTF_8_basque.h | 15 + .../libs/snowball/src_c/stem_UTF_8_catalan.c | 1473 ++++ .../libs/snowball/src_c/stem_UTF_8_catalan.h | 15 + .../libs/snowball/src_c/stem_UTF_8_danish.c | 342 + .../libs/snowball/src_c/stem_UTF_8_danish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_dutch.c | 2039 +++++ .../libs/snowball/src_c/stem_UTF_8_dutch.h | 15 + .../snowball/src_c/stem_UTF_8_dutch_porter.c | 676 ++ .../snowball/src_c/stem_UTF_8_dutch_porter.h | 15 + .../libs/snowball/src_c/stem_UTF_8_english.c | 1173 +++ .../libs/snowball/src_c/stem_UTF_8_english.h | 15 + .../snowball/src_c/stem_UTF_8_esperanto.c | 829 ++ .../snowball/src_c/stem_UTF_8_esperanto.h | 15 + .../libs/snowball/src_c/stem_UTF_8_estonian.c | 1481 ++++ .../libs/snowball/src_c/stem_UTF_8_estonian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_finnish.c | 767 ++ .../libs/snowball/src_c/stem_UTF_8_finnish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_french.c | 1473 ++++ .../libs/snowball/src_c/stem_UTF_8_french.h | 15 + .../libs/snowball/src_c/stem_UTF_8_german.c | 635 ++ .../libs/snowball/src_c/stem_UTF_8_german.h | 15 + .../libs/snowball/src_c/stem_UTF_8_greek.c | 3755 +++++++++ .../libs/snowball/src_c/stem_UTF_8_greek.h | 15 + .../libs/snowball/src_c/stem_UTF_8_hindi.c | 321 + .../libs/snowball/src_c/stem_UTF_8_hindi.h | 15 + .../snowball/src_c/stem_UTF_8_hungarian.c | 881 +++ .../snowball/src_c/stem_UTF_8_hungarian.h | 15 + .../snowball/src_c/stem_UTF_8_indonesian.c | 426 + .../snowball/src_c/stem_UTF_8_indonesian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_irish.c | 492 ++ .../libs/snowball/src_c/stem_UTF_8_irish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_italian.c | 1093 +++ .../libs/snowball/src_c/stem_UTF_8_italian.h | 15 + .../snowball/src_c/stem_UTF_8_lithuanian.c | 848 ++ .../snowball/src_c/stem_UTF_8_lithuanian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_nepali.c | 391 + .../libs/snowball/src_c/stem_UTF_8_nepali.h | 15 + .../snowball/src_c/stem_UTF_8_norwegian.c | 350 + .../snowball/src_c/stem_UTF_8_norwegian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_porter.c | 770 ++ .../libs/snowball/src_c/stem_UTF_8_porter.h | 15 + .../snowball/src_c/stem_UTF_8_portuguese.c | 1016 +++ .../snowball/src_c/stem_UTF_8_portuguese.h | 15 + .../libs/snowball/src_c/stem_UTF_8_romanian.c | 1069 +++ .../libs/snowball/src_c/stem_UTF_8_romanian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_russian.c | 700 ++ .../libs/snowball/src_c/stem_UTF_8_russian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_serbian.c | 6843 +++++++++++++++++ .../libs/snowball/src_c/stem_UTF_8_serbian.h | 15 + .../libs/snowball/src_c/stem_UTF_8_spanish.c | 1105 +++ .../libs/snowball/src_c/stem_UTF_8_spanish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_swedish.c | 406 + .../libs/snowball/src_c/stem_UTF_8_swedish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_tamil.c | 1460 ++++ .../libs/snowball/src_c/stem_UTF_8_tamil.h | 15 + .../libs/snowball/src_c/stem_UTF_8_turkish.c | 2356 ++++++ .../libs/snowball/src_c/stem_UTF_8_turkish.h | 15 + .../libs/snowball/src_c/stem_UTF_8_yiddish.c | 1338 ++++ .../libs/snowball/src_c/stem_UTF_8_yiddish.h | 15 + contrib/libs/snowball/ya.make | 23 + contrib/libs/snowball/ya.make.inc | 56 + 123 files changed, 61291 insertions(+) create mode 100644 contrib/libs/snowball/.yandex_meta/build.ym create mode 100644 contrib/libs/snowball/.yandex_meta/devtools.copyrights.report create mode 100644 contrib/libs/snowball/.yandex_meta/devtools.licenses.report create mode 100644 contrib/libs/snowball/.yandex_meta/licenses.list.txt create mode 100644 contrib/libs/snowball/COPYING create mode 100644 contrib/libs/snowball/MANIFEST create mode 100644 contrib/libs/snowball/NEWS create mode 100644 contrib/libs/snowball/README create mode 100644 contrib/libs/snowball/include/libstemmer.h create mode 100644 contrib/libs/snowball/libstemmer/libstemmer.c create mode 100644 contrib/libs/snowball/libstemmer/libstemmer_c.in create mode 100644 contrib/libs/snowball/libstemmer/libstemmer_utf8.c create mode 100644 contrib/libs/snowball/libstemmer/modules.h create mode 100644 contrib/libs/snowball/libstemmer/modules.txt create mode 100644 contrib/libs/snowball/libstemmer/modules_utf8.h create mode 100644 contrib/libs/snowball/runtime/api.c create mode 100644 contrib/libs/snowball/runtime/api.h create mode 100644 contrib/libs/snowball/runtime/header.h create mode 100644 contrib/libs/snowball/runtime/utilities.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_english.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_english.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_french.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_french.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_german.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_german.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.h create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.c create mode 100644 contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.h create mode 100644 contrib/libs/snowball/src_c/stem_KOI8_R_russian.c create mode 100644 contrib/libs/snowball/src_c/stem_KOI8_R_russian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_arabic.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_arabic.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_armenian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_armenian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_basque.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_basque.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_catalan.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_catalan.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_danish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_danish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_dutch.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_dutch.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_english.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_english.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_esperanto.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_esperanto.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_estonian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_estonian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_finnish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_finnish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_french.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_french.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_german.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_german.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_greek.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_greek.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_hindi.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_hindi.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_hungarian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_hungarian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_indonesian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_indonesian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_irish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_irish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_italian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_italian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_nepali.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_nepali.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_norwegian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_norwegian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_porter.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_porter.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_portuguese.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_portuguese.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_romanian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_romanian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_russian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_russian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_serbian.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_serbian.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_spanish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_spanish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_swedish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_swedish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_tamil.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_tamil.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_turkish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_turkish.h create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_yiddish.c create mode 100644 contrib/libs/snowball/src_c/stem_UTF_8_yiddish.h create mode 100644 contrib/libs/snowball/ya.make create mode 100644 contrib/libs/snowball/ya.make.inc diff --git a/contrib/libs/snowball/.yandex_meta/build.ym b/contrib/libs/snowball/.yandex_meta/build.ym new file mode 100644 index 000000000000..134b8c40deca --- /dev/null +++ b/contrib/libs/snowball/.yandex_meta/build.ym @@ -0,0 +1,35 @@ +{% extends '//builtin/bag.ym' %} + +{% block current_version %}3.0.1{% endblock %} + +{% block current_url %} +https://snowballstem.org/dist/libstemmer_c-{{self.version().strip()}}.tar.gz +{% endblock %} + +{% block patch_source %} +( +echo 'SRCS(' +cat mkinc.mak | grep '\.c' | tr -d '\\' | tr -d ' ' +echo ')' +) > ya.make.inc +rm -rf examples Makefile *.mak +{% endblock %} + +{% block ya_make %} +NO_RUNTIME() + +SUBSCRIBER( + g:cpp-contrib +) + +ADDINCL( + GLOBAL contrib/libs/snowball +) + +INCLUDE(ya.make.inc) +{% endblock %} + +{% block move_to_output %} +{{super()}} +cp -R ./ ${OUTPUT}/ +{% endblock %} diff --git a/contrib/libs/snowball/.yandex_meta/devtools.copyrights.report b/contrib/libs/snowball/.yandex_meta/devtools.copyrights.report new file mode 100644 index 000000000000..2ff164620d7a --- /dev/null +++ b/contrib/libs/snowball/.yandex_meta/devtools.copyrights.report @@ -0,0 +1,94 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP COPYRIGHT_SERVICE_LABEL 128e48e3192c0aa322b4563c29a8d370 +BELONGS ya.make + License text: + Copyright (c) 2001, Dr Martin Porter + Copyright (c) 2004,2005, Richard Boulton + Copyright (c) 2013, Yoshiki Shibukawa + Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts + All rights reserved. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + COPYING [1:5] + +KEEP COPYRIGHT_SERVICE_LABEL 9796c11b0b84b7230b425bae82ce2598 +BELONGS ya.make + License text: + Copyright (c) 2001, Dr Martin Porter + Copyright (c) 2004,2005, Richard Boulton + Copyright (c) 2013, Yoshiki Shibukawa + Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts + All rights reserved. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + COPYING [1:5] + +KEEP COPYRIGHT_SERVICE_LABEL a5e0b6d41c2465e61caf121c73575c76 +BELONGS ya.make + License text: + Copyright (c) 2001, Dr Martin Porter + Copyright (c) 2004,2005, Richard Boulton + Copyright (c) 2013, Yoshiki Shibukawa + Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts + All rights reserved. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + COPYING [1:5] + +KEEP COPYRIGHT_SERVICE_LABEL fb0434126c41307ef008634e902e058e +BELONGS ya.make + License text: + Copyright (c) 2001, Dr Martin Porter + Copyright (c) 2004,2005, Richard Boulton + Copyright (c) 2013, Yoshiki Shibukawa + Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts + All rights reserved. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + COPYING [1:5] diff --git a/contrib/libs/snowball/.yandex_meta/devtools.licenses.report b/contrib/libs/snowball/.yandex_meta/devtools.licenses.report new file mode 100644 index 000000000000..7d58b67edc32 --- /dev/null +++ b/contrib/libs/snowball/.yandex_meta/devtools.licenses.report @@ -0,0 +1,45 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP BSD-3-Clause 83708640dd0fc1b43741769410092f4b +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: BSD-3-Clause + Score : 99.07 + Match type : NOTICE + Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause + Files with this license: + COPYING [7:29] diff --git a/contrib/libs/snowball/.yandex_meta/licenses.list.txt b/contrib/libs/snowball/.yandex_meta/licenses.list.txt new file mode 100644 index 000000000000..89a2fb30a7d0 --- /dev/null +++ b/contrib/libs/snowball/.yandex_meta/licenses.list.txt @@ -0,0 +1,31 @@ +====================BSD-3-Clause==================== +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. 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. + 3. Neither the name of the Snowball project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. + +====================COPYRIGHT==================== +Copyright (c) 2001, Dr Martin Porter +Copyright (c) 2004,2005, Richard Boulton +Copyright (c) 2013, Yoshiki Shibukawa +Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts +All rights reserved. diff --git a/contrib/libs/snowball/COPYING b/contrib/libs/snowball/COPYING new file mode 100644 index 000000000000..f36607f9e93f --- /dev/null +++ b/contrib/libs/snowball/COPYING @@ -0,0 +1,29 @@ +Copyright (c) 2001, Dr Martin Porter +Copyright (c) 2004,2005, Richard Boulton +Copyright (c) 2013, Yoshiki Shibukawa +Copyright (c) 2006,2007,2009,2010,2011,2014-2019, Olly Betts +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. 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. + 3. Neither the name of the Snowball project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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/contrib/libs/snowball/MANIFEST b/contrib/libs/snowball/MANIFEST new file mode 100644 index 000000000000..13d27b70b1fd --- /dev/null +++ b/contrib/libs/snowball/MANIFEST @@ -0,0 +1,112 @@ +README.rst +src_c/stem_ISO_8859_1_basque.c +src_c/stem_ISO_8859_1_basque.h +src_c/stem_ISO_8859_1_catalan.c +src_c/stem_ISO_8859_1_catalan.h +src_c/stem_ISO_8859_1_danish.c +src_c/stem_ISO_8859_1_danish.h +src_c/stem_ISO_8859_1_dutch.c +src_c/stem_ISO_8859_1_dutch.h +src_c/stem_ISO_8859_1_dutch_porter.c +src_c/stem_ISO_8859_1_dutch_porter.h +src_c/stem_ISO_8859_1_english.c +src_c/stem_ISO_8859_1_english.h +src_c/stem_ISO_8859_1_finnish.c +src_c/stem_ISO_8859_1_finnish.h +src_c/stem_ISO_8859_1_french.c +src_c/stem_ISO_8859_1_french.h +src_c/stem_ISO_8859_1_german.c +src_c/stem_ISO_8859_1_german.h +src_c/stem_ISO_8859_1_indonesian.c +src_c/stem_ISO_8859_1_indonesian.h +src_c/stem_ISO_8859_1_irish.c +src_c/stem_ISO_8859_1_irish.h +src_c/stem_ISO_8859_1_italian.c +src_c/stem_ISO_8859_1_italian.h +src_c/stem_ISO_8859_1_norwegian.c +src_c/stem_ISO_8859_1_norwegian.h +src_c/stem_ISO_8859_1_porter.c +src_c/stem_ISO_8859_1_porter.h +src_c/stem_ISO_8859_1_portuguese.c +src_c/stem_ISO_8859_1_portuguese.h +src_c/stem_ISO_8859_1_spanish.c +src_c/stem_ISO_8859_1_spanish.h +src_c/stem_ISO_8859_1_swedish.c +src_c/stem_ISO_8859_1_swedish.h +src_c/stem_ISO_8859_2_hungarian.c +src_c/stem_ISO_8859_2_hungarian.h +src_c/stem_KOI8_R_russian.c +src_c/stem_KOI8_R_russian.h +src_c/stem_UTF_8_arabic.c +src_c/stem_UTF_8_arabic.h +src_c/stem_UTF_8_armenian.c +src_c/stem_UTF_8_armenian.h +src_c/stem_UTF_8_basque.c +src_c/stem_UTF_8_basque.h +src_c/stem_UTF_8_catalan.c +src_c/stem_UTF_8_catalan.h +src_c/stem_UTF_8_danish.c +src_c/stem_UTF_8_danish.h +src_c/stem_UTF_8_dutch.c +src_c/stem_UTF_8_dutch.h +src_c/stem_UTF_8_dutch_porter.c +src_c/stem_UTF_8_dutch_porter.h +src_c/stem_UTF_8_english.c +src_c/stem_UTF_8_english.h +src_c/stem_UTF_8_esperanto.c +src_c/stem_UTF_8_esperanto.h +src_c/stem_UTF_8_estonian.c +src_c/stem_UTF_8_estonian.h +src_c/stem_UTF_8_finnish.c +src_c/stem_UTF_8_finnish.h +src_c/stem_UTF_8_french.c +src_c/stem_UTF_8_french.h +src_c/stem_UTF_8_german.c +src_c/stem_UTF_8_german.h +src_c/stem_UTF_8_greek.c +src_c/stem_UTF_8_greek.h +src_c/stem_UTF_8_hindi.c +src_c/stem_UTF_8_hindi.h +src_c/stem_UTF_8_hungarian.c +src_c/stem_UTF_8_hungarian.h +src_c/stem_UTF_8_indonesian.c +src_c/stem_UTF_8_indonesian.h +src_c/stem_UTF_8_irish.c +src_c/stem_UTF_8_irish.h +src_c/stem_UTF_8_italian.c +src_c/stem_UTF_8_italian.h +src_c/stem_UTF_8_lithuanian.c +src_c/stem_UTF_8_lithuanian.h +src_c/stem_UTF_8_nepali.c +src_c/stem_UTF_8_nepali.h +src_c/stem_UTF_8_norwegian.c +src_c/stem_UTF_8_norwegian.h +src_c/stem_UTF_8_porter.c +src_c/stem_UTF_8_porter.h +src_c/stem_UTF_8_portuguese.c +src_c/stem_UTF_8_portuguese.h +src_c/stem_UTF_8_romanian.c +src_c/stem_UTF_8_romanian.h +src_c/stem_UTF_8_russian.c +src_c/stem_UTF_8_russian.h +src_c/stem_UTF_8_serbian.c +src_c/stem_UTF_8_serbian.h +src_c/stem_UTF_8_spanish.c +src_c/stem_UTF_8_spanish.h +src_c/stem_UTF_8_swedish.c +src_c/stem_UTF_8_swedish.h +src_c/stem_UTF_8_tamil.c +src_c/stem_UTF_8_tamil.h +src_c/stem_UTF_8_turkish.c +src_c/stem_UTF_8_turkish.h +src_c/stem_UTF_8_yiddish.c +src_c/stem_UTF_8_yiddish.h +runtime/api.c +runtime/api.h +runtime/header.h +runtime/utilities.c +libstemmer/libstemmer.c +libstemmer/libstemmer_utf8.c +libstemmer/modules.h +libstemmer/modules_utf8.h +include/libstemmer.h diff --git a/contrib/libs/snowball/NEWS b/contrib/libs/snowball/NEWS new file mode 100644 index 000000000000..8bd6bb090bb1 --- /dev/null +++ b/contrib/libs/snowball/NEWS @@ -0,0 +1,1549 @@ +Snowball 3.0.1 (2025-05-09) +=========================== + +Python +------ + +* The __init__.py in 3.0.0 was incorrectly generated due to a missing + build dependency and the list of algorithms was empty. First reported by + laymonage. Thanks to Dmitry Shachnev, Henry Schreiner and Adam Turner for + diagnosing and fixing. (#229, #230, #231) + +* Add trove classifiers for Armenian and Yiddish which have now been registered + with PyPI. Thanks to Henry Schreiner and Dmitry Shachnev. (#228) + +* Update documented details of Python 2 support in old versions. + +Snowball 3.0.0 (2025-05-08) +=========================== + +Ada +--- + +* Bug fixes: + + + Fix invalid Ada code generated for Snowball `loop` (it was partly Pascal!) + None of the stemmers shipped in previous releases triggered this bug, but + the Turkish stemmer now does. + + + The Ada runtime was not tracking the current length of the string + but instead used the current limit value or some other substitute, which + manifested as various incorrect behaviours for code inside of `setlimit`. + + + `size` was incorrectly returning the difference between the limit and the + backwards limit. + + + `lenof` or `sizeof` on a string variable generated Ada code that didn't + even compile. + + + Fix incorrect preconditions on some methods in the runtime. + + + Fix bug in runtime code used by `attach`, `insert`, `<-` and string + variable assignment when a (sub)string was replaced with a larger string. + This bug was triggered by code in the Kraaij-Pohlmann Dutch stemmer + implementation (which was previously not enabled by default but is now the + standard Dutch stemmer). + + + Fix invalid code generated for `insert`, `<-` and string variable + assignment. This bug was triggered by code in the Kraaij-Pohlmann + Dutch stemmer implementation (which was previously not enabled by default + but is now the standard Dutch stemmer). + + + Generate valid code for programs which don't use `among`. This didn't + affect code generation for any algorithms we currently ship. + + + If the end of a routine was unreachable code the Snowball compiler + would think the start of the next routine was also unreachable and would + not generate it. This didn't affect code generation for any algorithms we + currently ship. + +* Code quality: + + + Only declare variables A and C when each is needed. + + + Fix indentation of generated declarations. + + + Drop extra blank line before `Result := True`. + +C/C++ +----- + +* Bug fixes: + + + Fix potential NULL dereference in runtime code if we failed to allocate + memory for the p or S member for a Snowball program which uses one or more + string variables. Problem was introduced in Snowball 2.0.0. Fixes #206, + reported by Maxim Korotkov. + + + Fix invalid C code generated when a failure is handled in a context with + the opposite direction to where it happened, for example: + + externals (stem) + define stem as ( try backwards 'x' ) + + This was fixed by changing the C generator to work like all the other + generators and pre-generate the code to handle failure. + + + Eliminate assumptions that NULL has all-zero bit pattern. We don't know + of any current platforms where this assumption fails, but the C standard + doesn't require an all-zero bit pattern for NULL. Fixes #207. + +* Optimisations: + + + Store index delta for among substring_i field. This makes trying + substrings after a failed match slightly faster because we can just add + the offset to the pointer we already have to the current element. + +* Code quality: + + + Improve formatting of generated code. + +C# +-- + +* Bug fixes: + + + Add missing runtime support for testing for a string var at the current + position when working forwards. This situation isn't exercised by any of + the stemming algorithms we currently ship. + + + Adjust generated code to work around a code flow analysis bug in the `mcs` + C# compiler. + +* Code quality: + + + Prune unused `using System.Text;`. + + + Generate C# with UTF-8 source encoding. This makes the generated code + easier to follow, which helps during development. It's also a bit smaller. + For now codepoints U+0590 and above are still emitted as escape sequences + to avoid confusing source code rendering when LTR scripts are involved. + +Go +-- + +* Optimisations: + + + Drop some unneeded Go code generated for string `$`. None of the shipped + stemmers use string `$`, though the Schinke Latin stemmer algorithm on the + website does. + +* Code quality: + + + Dispatch among result with `switch` instead of an `if` ... `else if` chain + (which looks like we did because the Go generator evolved from the Python + generator and Python didn't used to have a switch-like construct. This + doesn't make a measurable speed difference so it seems the Go compiler is + optimising both to equivalent code, but using a switch here seems clearer, + a better match for the intent, and is a bit simpler to generate. + + + Generate Go with UTF-8 source encoding. This makes the generated code + easier to follow, which helps during development. It's also a bit smaller. + For now codepoints U+0590 and above are still emitted as escape sequences + to avoid confusing source code rendering when LTR scripts are involved. + +Java +---- + +* The Java code generated by Snowball requires now requires Java >= 7. Java 7 + was released in 2011, and Java 6's EOL was 2013 so we don't expect this + to be a problematic requirement. See #195. + +* Optimisations: + + + We now store the current string in a `char[]` rather than using a + `StringBuilder` to reduce overheads. The `getCurrent()` method continues + to return a Java `String`, but the `char[]` can be accessed using the new + `getCurrentBuffer()` and `getCurrentBufferLength()` methods. Patch from + Robert Muir (#195). + + + Use a more efficient mechanism for calling `among` functions. Patch from + Robert Muir (#195). + +* Code quality: + + + Consistently put `[]` right after element type for array types, which seems + the most used style. + + + Fix javac warnings in SnowballProgram.java. + + + Improve formatting of generated code. + +Javascript +---------- + +* Bug fixes: + + + Use base class specified by `-p` in string `$` rather than hard-coding + `BaseStemmer` (which is the default if you don't specify `-p`). None of + the shipped stemmers use string `$`, though the Schinke Latin stemmer + algorithm on the website does. + +* Code quality: + + + Modernise the generated code a bit. Loosely based on changes proposed in + #123 by Emily Marigold Klassen. + +* Other changes: + + + The Javascript runner is now specified by make variable `JSRUN` instead + of `NODE` (since node is just one JS implementation). The default value + is now `node` instead of `nodejs` (older Debian and Ubuntu packages used + `/usr/bin/nodejs` because `/usr/bin/node` was already in use by a + completely different package, but that has since changed). + +Pascal +------ + +* Bug fixes: + + + Add missing semicolons to code generated in some cases for a function which + always succeeds or always fails. The new dutch.sbl was triggering this + bug. + + + If the end of a routine was unreachable code the Snowball compiler + would think the start of the next routine was also unreachable and would + not generate it. This didn't affect code generation for any algorithms we + currently ship. + +* Code quality: + + + Eliminate commented out code generated for string `$`. None of the shipped + stemmers use string `$`, though the Schinke Latin stemmer algorithm on the + website does. + +* Other changes: + + + Enable warnings, etc from fpc. + + + Select GNU-style diagnostic format. + +Python +------ + +* Optimisations: + + + Use Python set for grouping checks. This speeds up running the Python + testsuite by about 4%. + + + Routines used in `among` are now referenced by name directly in the + generated code, rather than using a string containing the name. This + avoids a `getattr()` call each time an among wants to call a routine. This + doesn't seem to make a measurable speed difference, but it's cleaner and + avoids problems with name mangling. Suggested by David Corbett in #217. + + + Simplify code generated for `loop`. If the iteration count is constant and + at most 4 then iterate over a tuple which microbenchmarking shows is + faster. The only current uses of loop in the shipped stemmers are `loop 2` + so benefit from this. Otherwise we now use `range(AE)` instead of + `range (AE, 0, -1)` (the actual value of the loop variable is never + used so only the number of iterations matter). + +* Bug fixes: + + + Correctly handle stemmer names with an underscore. + +* Code quality: + + + Generate Python with UTF-8 source encoding. This makes the generated code + easier to follow, which helps during development. It's also a bit smaller. + For now codepoints U+0590 and above are still emitted as escape sequences + to avoid confusing source code rendering when LTR scripts are involved. + +* Other changes: + + + Set python_requires to indicate to install tools that the generated code + won't work with Python 3.0.x, 3.1.x and 3.2.x (due to use of `u"foo"` + string literals). Closes #192 and #191, opened by Andreas Maier. + + + Add classifiers to indicate support for Python 3.3 and for 3.8 to 3.13. + Fixes #158, reported by Dmitry Shachnev. + + + Stop marking the wheel as universal, which had started to give a warning + message. Patch from Dmitry Shachnev (#210). + + + Stop calling `setup.py` directly which is deprecated and now produces a + warning - use the `build` module instead. Patch from Dmitry Shachnev + (#210). + +Rust +---- + +* Optimisations: + + + Shortcut unnecessary calls to find_among, porting an optimization from the + C generator. In some stemming benchmarks this improves the performance + of the rust english stemmer by about 27%. Patch from jedav (#202). + +* Code quality: + + + Suppress unused_parens warning, for example triggered by the code generated + for `$x = x*x` (where `x` is an integer). + + + Dispatch `among` result with `match` instead of an `if` ... `else if` chain + (which looks like we did because the Rust generator evolved from the Python + generator and Python didn't used to have a switch-like construct. This + results in a 3% speed-up for an unoptimised Rust compile but doesn't seem + to make a measurable difference when optimising so it seems the Rust + compiler is optimising both to equivalent code. However using a `match` + here seems clearer, a better match for the intent, and is a bit simpler to + generate. + + + Generate Rust with UTF-8 source encoding. This makes the generated code + easier to follow, which helps during development. It's also a bit smaller. + For now codepoints U+0590 and above are still emitted as escape sequences + to avoid confusing source code rendering when LTR scripts are involved. + +New stemming algorithms +----------------------- + +* Add Esperanto stemmer from David Corbett (#185). + +* Add Estonian algorithm from Linda Freienthal (#108). + +Behavioural changes to existing algorithms +------------------------------------------ + +* Dutch: Switch to Kraaij-Pohlmann as the default for Dutch. In case you + want Martin Porter's Dutch stemming algorithm for compatibility, this is now + available as `dutch_porter`. Fixes #1, reported by gboer. + +* Dutch (Kraaij-Pohlmann): Fix differences between the Snowball implementation + and the original C implementation. + +* Dutch (Kraaij-Pohlmann): Add a small number of exceptions to the Snowball + implementation to avoid unwanted conflations. This addresses all cases so + far identified which Martin's Dutch stemmer handled better. Fixes #208. + +* Dutch (Porter): The "at least 3 characters" part of the R1 definition was + actually implemented such that when working in UTF-8 it was "at least 3 + bytes". We stripped accents normally found in Dutch except for `è` before + setting R1, and no Dutch words starting `è` seem to stem differently + depending on encoding, but proper nouns and other words of foreign origin may + contain other accented characters and it seems better for the stemmer to + handle such words the same way regardless of the encoding in use. + +* English: Replace '-ogist' with '-og' to conflate "geologist" and "geology", etc. + Suggested by Marc Schipperheijn on snowball-discuss. + +* English: Add extra condition to undoubling. We no longer undouble if the + double consonant is preceded by exactly "a", "e" or "o" to avoid conflating + "add"/"ad", "egg"/"eg", "off"/"of", etc. Fixes #182, reported by Ed Page. + +* English: Avoid conflating 'emerge' and 'emergency'. Reported by Frederick Ross + on snowball-discuss. + +* English: Avoid conflating 'evening' and 'even'. Reported by Ann B on + snowball-discuss. + +* English: Avoid conflating 'lateral' and 'later'. Reported by Steve Tolkin on + snowball-discuss. + +* English: Avoid conflating 'organ', 'organic' and 'organize'. + +* English: Avoid conflating 'past' and 'paste'. Reported by Sonny on + snowball-discuss. + +* English: Avoid conflating 'universe', 'universal' and 'university'. Reported + by Clem Wang on snowball-discuss. + +* English: Handle -eed and -ing exceptions in their respective rules. + This avoids the overhead of checking for them for the majority of + words which don't end -eed or -ing. It also allows us to easily handle + vying->vie and hying->hie at basically no extra cost. Reduces the time to + stem all words in our English word list by nearly 2%. + +* French: Remove elisions as first step. See #187. Originally reported by + Paul Rudin and kelson42. + +* French: Remove -aise and -aises so for example, "française" and "françaises" + are now conflated with "français". Fixes #209. Originally reported by + ririsoft and Fred Fung. + +* French: Avoid incorrect conflation of `mauvais` (bad) with `mauve` (mauve, + mallow or seagull); avoid conflating `mal` with `malais`, `pal` with + `palais`, etc. + +* French: Avoid conflating `ni` (neither/nor) with `niais` + (inexperienced/silly) and `nie`/`nié`/`nier`/`nierais`/`nierons` (to deny). + +* French: -oux -> -ou. Fixes #91, reported by merwok. + +* German: Replace with the "german2" variant. This normalises umlauts ("ä" to + "ae", "ö" to "oe", "ü" to "ue") which is presumably much less common in + newly created text than it once was as modern computer systems generally + don't have the limitations which motivated this, but there will still be + large amounts of legacy text which it seems helpful for the stemmer to + handle without having to know to select a variant. + + On our sample German vocabulary which contains 35033 words, 77 words give + different stems. A significant proportion of these are foreign words, and + some are proper nouns. Some cases definitely seem improved, and quite a few + are just different but effectively just change the stem for a word or group + of words to a stem that isn't otherwise generated. There don't seem any + changes that are clearly worse, though there are some changes that have both + good and bad aspects to them. + + Fixes #92, reported by jrabensc. + +* German: Don't remove -em if preceded by -syst to avoid overstemming words + ending -system. This change means we now conflate e.g. "system" and + "systemen". Partly addresses #161, reported by Olga Gusenikova. + +* German: Remove -erin and -erinnen suffixes which conflates singular and + plural female versions of nouns with the male versions. Fixes #85 and + partly addresses #161, reported by Olga Gusenikova. + +* German: Replace -ln and -lns with -l. This improves 82 cases in the current + sample data without making anything worse. Tests on a larger word list look + good too. Partly addresses #161, reported by Olga Gusenikova. + +* German: Remove -et suffix when we safely can. Fixes #200, reported by Robert + Frunzke. + +* Greek: Fix "faulty slice operation" for input `ισαισα`. The fix changes + `ισα` to stem to `ισ` instead of the empty string, which seems better (and to + be what the second paper actually says to do if read carefully). Fixes #204, + reported by subnix. + +* Italian: Address overstemming of "divano" (sofa) which previously stemmed to + "div", which is the stem for 'diva' (diva). Now it is stemmed to 'divan', + which is what its plural form 'divani' already stemmed to. Fixes #49, + reported by francesco. + +* Norwegian: Improve stemming of words ending -ers. Fixes #175, reported by + Karianne Berg. + +* Norwegian: Include more accented vowels - treating "ê", "ò", "ó" and "ô" + as vowels improves the stemming of a fairly small number of words, but + there's basically no cost to having extra vowels in the grouping, and some + of these words are commonly used. Fixes #218, reported by András Jankovics. + +* Romanian: Fix to work with Romanian text encoded using the correct Unicode + characters. Romanian uses a "comma below" diacritic on letters "s" and "t" + ("ș" and "ț"). Before Unicode these weren't easily available so Romanian + text was written using the visually similar "cedilla" diacritic on these + letters instead ("ş" and "ţ"). Previously our stemmer only recognised the + latter. Now it maps the cedilla forms to "comma below" as a first step. + Patch from Robert Muir. + +* Spanish: Handle -acion like -ación and -ucion like -ución. It's apparently + common to miss off accents in Spanish, and there are examples in our test + vocabulary that these change helps. Proposed by Damian Janowski. + +* Swedish: Replace suffix "öst" with "ös" when preceded by any of 'iklnprtuv' + rather than just 'l'. The new rule only requires the "öst" to be in R1 + whereas previously we required all of "löst" to be. This second tweak + doesn't seem to affect any words ending "löst" but it conflates a few extra + cases when combined with the expanded list of preceding letters, and seems + more logical linguistically (since "ös" is akin to "ous" in English). Fixes + #152, reported by znakeeye. + +* Swedish: Remove -et/-ets in cases where it helps. Removing -et can't be done + unconditionally because many words end in -et where this isn't a suffix. + However it's a very common suffix so it seems worth crafting a more complex + condition under which to remove. Fixes #47. + +* Turkish: Remove proper noun suffixes. For example, `Türkiye'dir` ("it is + Turkey") is now conflated with `Türkiye` ("Turkey"). Fixes #188. + +* Yiddish: Avoid generating empty stem for input "גע" (not a valid word, but + it's better to avoid an empty stem for any non-empty input). + +Optimisations to existing algorithms +------------------------------------ + +* General change: Use `gopast` everywhere to establish R1 and R2 as it is a + little more efficient to do so. + +* Basque: Use an empty action rather than replacing the suffix with itself + which seems clearer and is a little more efficient. + +* Dutch (Porter): Optimise prelude routine. + +* English: Remove unnecessary exception for `skis` as the algorithm stems + `skis` to `ski` by itself (`skies` and `sky` do still need a special case to + avoid conflation with `ski` though). + +* Hungarian: We no longer take digraphs into account when determining where R1 + starts. This can only make a difference to the stemming if we removed a + suffix that started with the last character of the digraph (or with "zs" in + the case of "dzs"), and that doesn't happen for any of the suffixes we remove + for any valid Hungarian words. This simplification speeds up stemming by + ~2% on the current sample vocabulary list. See #216. Thanks to András + Jankovics for confirming no Hungarian words are affected by this change. + +* Lithuanian: Remove redundant R1 check. + +* Nepali: Eliminate redundant check_category_2 routine. + +* Tamil: Optimise by using `among` instead of long `or` chains. The generated + C version now takes 43% less time to processes the test vocabulary. + +* Tamil: Remove many cases which can't be triggered due to being handled by + another case. + +* Tamil: Clean up some uses of `test`. + +* Tamil: Make `fix_va_start` simpler and faster. + +* Tamil: Localise use of `found_a_match` flag. + +* Tamil: Eliminate pointless flag changes. + +* Turkish: Minor optimisations. + +Code clarity improvements to existing algorithms +------------------------------------------------ + +* Stop noting dates changes were made in comments in the code - we now maintain + a changelog in each algorithm's description page on the website (and the + version control history provides a finer grained view). + +* Always use `insert` instead of `<+` as the named command seems clearer. + +* English: Add comments documenting motivating examples for all exceptional + cases. + +* Lithuanian: Change to recommended latin stringdef codes. Using common codes + makes it easier to work across algorithms, but they are more mnemonic so also + seem clearer when just considering this one algorithm. + +* Serbian: Change to recommended latin stringdef codes. Using common codes + makes it easier to work across algorithms, but they are more mnemonic so also + seem clearer when just considering this one algorithm. + +* Turkish: Use `{sc}` for s-cedilla and `{i}` for dotless-i to match other + uses. + +Compiler +-------- + +* Generic code generation improvements: + + + Show Snowball source leafname in "generated" comment at start of files. + + + Add generic reachability tracking machinery. This facilitates various new + optimisations, so far the following have been implemented: + + - Tail-calling + - Simpler code for calling routines which always give the same signal + - Simpler code when a routine ends in a integer test (this also allows + eliminating an Ada-specific codegen optimisation which did something + similar but only for routines which consisted *entirely* of a single + integer test. + - Dead code reporting and removal (only in simple cases currently) + + Currently this overlaps in functionality with the existing reachability + tracking which is implemented on a per-language basis, and only for some + languages. This reachability tracking was originally added for Java + where some unreachable code is invalid and result in a compile time error, + but then seems to have been copied for some other newer languages which + may or may not actually need it. The approach it uses unfortunately + relies on correctly updating the reachability flag anywhere in the + generator code where reachability can change which has proved to be a + source of bugs, some unfixed. This new approach seems better and with some + more work should allow us to eliminate the older code. Fixes #83. + + + Omit check for `among` failing in generated code when we can tell at + compile time that it can't fail. + + + Optimise `goto`/`gopast` applied to a grouping or inverted grouping (which + is by far the most common way to use `goto`/`gopast`) for all target + languages (new for Go, Java, Javascript, Pascal and Rust). + + + We never need to restore the cursor after `not`. If `not` turns signal `f` + into `t` then it sets `c` back to its old position; otherwise, `not` + signals `f` and `c` will get reset by whatever ultimately handles this `f` + (or the program exits and the position of `c` no longer matters). This + slightly improves the generated code for the `english` and `porter` + stemmers. + + + Don't generate code for undefined or unused routines. + + + Avoid generating variable names and then not actually using them. This + eliminates mysterious gaps in the numbering of variables in the generated + code. + + + Eliminate `!`/`not` from integer test code by generating the inverse + comparison operator instead for all languages, e.g. for Python we now + generate + + if self.I_p1 >= self.I_x: + + instead of + + if not self.I_p1 < self.I_x: + + This isn't going to be faster in compiled languages with an optimiser but + for scripting languages it may be faster, and even if not, it makes for a + little less work when loading the script. + + + Canonicalise `hop 1` to `next` as the generated code for `next` can be + slightly more efficient. This will also apply to `hop` followed by a + constant expression which Snowball can reduce to `1`. + + + Avoid trailing whitespace in generated files. + + + Fix problems with --comments option: + + - When generating C code we would segfault for code containing `atleast`, + `hop` or integer tests. + - Fix missing comments for some commands in some target languages. + - Fix inconsistent formatting of comments in some target languages. + - Comments in C are now always on their own line - previously some were + after at the end of the line and some on their own line which made them + harder to follow. + - Emit comments before `among` and before routine/external definitions. + + + Simplify more cases of numeric expressions (e.g. `x * 1` to `x`). + +* Improve --help output. + +* Division by zero during constant folding now gives an error. + +* For `hop` followed by an unexpected token (e.g. `hop hop`) we were + already emitting a suitable error but would then segfault. + +* Emit error for redefinition of a grouping. + +* Improve errors for `define` of an undeclared name. We already peek at the + next token to decide whether to try to parse as a routine or grouping. + Previously we parsed as a routine if it was `as`, and a grouping otherwise, + but routine definitions are more common and a grouping can only start with + a literal string or a name, so now we assume a routine definition with a + missing `as` if the next token isn't valid for either. + +* Suppress duplicate (or even triplicate) "unexpected" errors for the same + token when the compiler tried to recover from the error by adjusting the + parse stare and marking the token to be reparsed, but the same token then + failed to parse in the new state. + +* Fix NULL pointer dereference if an undefined grouping is used in the + definition of another grouping. + +* Fix mangled error for `set` or `unset` on a non-boolean: + + test.sbl:2: nameInvalid type 98 in name_of_type() + +* Emit warning if `=>` is used. The documentation of how it works doesn't + match the implementation, and it seems it has only ever been used in the + Schinke stemmer implementation (which assumes the implemented behaviour). + We've updated the Schinke implementation to avoid it. If you're using it + in your own Snowball code please let us know. + +* Improve errors for unterminated string literals. + +* Fix NULL pointer dereference on invalid code such as `$x = $y`. + +* If malloc fails while compiling the compiler will now report the failure + and exit. Previously the NULL return from malloc wasn't checked for so + we'd typically segfault. + +* `lenof` and `sizeof` applied to a string variable now mark the variable + as used, which avoids a bogus error followed by a confusing additional + message if this is the only use of that variable: + + lenofsizeofbug.sbl:3: warning: string 's' is set but never used + Unhandled type of dead assignment via sizeof + + This is situation is unlikely to occur in real world code. + +* The reported line number for "string not terminated" error was one too high + in the case where we were in a stringdef (but correct if we weren't). + +* Eliminate special handling for among starter. We now convert the starter + to be a command before the among, adding an explict substring if there + isn't one. + +* We now warn if the body of a `repeat` or `atleast` loop always signals + `t` (meaning it will loop forever which is very undesirable for a stemming + algorithm) or always signals `f` (meaning it will never loop, which seems + unlikely to be what was intended). + +* Release memory in compiler before exit. The OS will free all allocated + memory when a process exits, so this memory isn't actually leaked, but it can + be annoying with when using snowball as part of a larger build process with + some leak-finding tools. Patch from jsteemann in #166. + +* Store textual data more efficiently in memory during Snowball compilation. + Previously almost all textual data was stored as 16 bit values, but most + such data only uses 8 bit character values. Doubling the memory usage + isn't really an issue as Snowball programs are tiny, but this also + complicated code handling such data. Now only literal strings use the + 16 bit values. + +* Fix clang -Wunused-but-set-variable warning in compiler code. + +* Fix a few -Wshadow warnings in compiler and enable this warning by default. + +* Tighten parsing of `writef()` format strings. We now error out on + unrecognised escape codes or if a numbered escape is used with too high a + number or a non-digit. This change reveals that the Go and Rust generators + were using invalid escape ~A - the old writef() code was substituting this + with just A which is what is wanted so this case was harmless but being + lenient here could hide bugs, especially when copying code between + generators as they don't all support the same set of format codes. + +Build system +------------ + +* Turn on Java warnings and make them errors. + +* Compile C code with -g by default. This makes debugging easier, and + matches the default for at least some other build systems (e.g. autotools). + +* Fix "make clean" to remove all built Ada files. + +* Clean `stemtest` too. Patch from Stefano Rivera. + +* Add missing `COMMON_FILES` dependency to dist targets. + +* GNUmakefile: Tidy up and make more consistent + +* GNUmakefile: Make use of $* to improve speed and readability. + +* Use $(patsubst ...) instead of sed in .java.class rule which gives cleaner + make output and is a bit more efficient. + +* Add `WERROR` make variable to provide a way to add `-Werror` to existing + CFLAGS. + +libstemmer +---------- + +Testsuite +--------- + +* Give a clear error if snowball-data isn't found. Fixes #196, reported by + Andrea Maccis. + +* Handle not thinning testdata better. If THIN_FACTOR is set to 1 we no longer + run gzipped test data through awk. We also now handle THIN_FACTOR being set + empty as equivalent to 1 for convenience. + +* csharp_stemwords: Correctly handle a stemmer name containing an underscore. + +* csharp_stemwords: Make `-i` option optional and read from stdin if omitted, + like the C version does. + +* csharp_stemwords: Process the input line by line which is more helpful for + interactive testing, and also a little faster. + +* Fix Java TestApp to allow a single argument. The documented command line + syntax is that you only need to specify the language and there was already + code to read from stdin if no input file was specified, but at least two + command line options were required. + +* Fix deprecation warning in TestApp.java. + +* Optimise TestApp.java by creating fewer objects. Patch from Robert Muir. + +* stemwords.py: We no longer create an empty output file if we fail to open the + input file. + +* stemwords: Improve error message to say "Out of memory or internal error" + rather than just "Out of memory". + +Documentation +------------- + +* Include "what is stemming" section in each README. + +* Include section on threads in each README. Based on patch for Python from + dbcerigo. + +* Document that input should be lowercase with composed accents. See #186, + reported by 1993fpale. + +* Add README section on building, including notes on cross-compiling. Fixes + #205, reported by sin-ack. + +* CONTRIBUTING.rst: Clarify which charsets to list + +* CONTRIBUTING.rst: Add general advice section. In particular, note to use + spaces-only for indentation in most cases. Thanks to Dmitry Shachnev for + raising this point. + +* CONTRIBUTING.rst: Note that UTF-8 is OK in comments. Thanks to Dmitry + Shachnev for asking. + +* Fix some typos. Patch from Josh Soref. + +* Document that our CI now uses github actions. + +* Update link to Greek stemmer PDF. Patch from Michael Bissett (#33). + +Snowball 2.2.0 (2021-11-10) +=========================== + +New Code Generators +------------------- + +* Add Ada generator from Stephane Carrez (#135). + +Javascript +---------- + +* Fix generated code to use integer division rather than floating point + division. + + Noted by David Corbett. + +Pascal +------ + +* Fix code generated for division. Previously real division was used and the + generated code would fail to compile with an "Incompatible types" error. + + Noted by David Corbett. + +* Fix code generated for Snowball's `minint` and `maxint` constant. + +Python +------ + +* Python 2 is no longer actively supported, as proposed on the mailing list: + https://lists.tartarus.org/pipermail/snowball-discuss/2021-August/001721.html + +* Fix code generated for division. Previously the Python code we generated + used integer division but rounded negative fractions towards negative + infinity rather than zero under Python 2, and under Python 3 used floating + point division. + + Noted by David Corbett. + +Code quality Improvements +------------------------- + +* C/C++: Generate INT_MIN and INT_MAX directly, including from + the generated C file if necessary, and remove the MAXINT and MININT macros + from runtime/header.h. + +* C#: An `among` without functions is now generated as `static` and groupings + are now generated as constant. Patches from James Turner in #146 and #147. + +Code generation improvements +---------------------------- + +* General: + + + Constant numeric subexpressions and constant numeric tests are now + evaluated at Snowball compile time. + + + Simplify the following degnerate `loop` and `atleast` constructs where + N is a compile-time constant: + + - loop N C where N <= 0 is a no-op. + + - loop N C where N == 1 is just C. + + - atleast N C where N <= 0 is just repeat C. + + If the value of N doesn't depend on the current target language, platform + or Unicode settings then we also issue a warning. + +Behavioural changes to existing algorithms +------------------------------------------ + +* german2: Fix handling of `qu` to match algorithm description. Previously + the implementation erroneously did `skip 2` after `qu`. We suspect this was + intended to skip the `qu` but that's already been done by the substring/among + matching, so it actually skips an extra two characters. + + The implementation has always differed in this way, but there's no good + reason to skip two extra characters here so overall it seems best to change + the code to match the description. This change only affects the stemming of + a single word in the sample vocabulary - `quae` which seems to actually be + Latin rather than German. + +Optimisations to existing algorithms +------------------------------------ + +* arabic: Handle exception cases in the among they're exceptions to. + +* greek: Remove unused slice setting, handle exception cases in the among + they're exceptions to, and turn `substring ... among ... or substring ... + among ...` into a single `substring ... among ...` in cases where it is + trivial to do so. + +* hindi: Eliminate the need for variable `p`. + +* irish: Minor optimisation in setting `pV` and `p1`. + +* yiddish: Make use of `among` more. + +Compiler +-------- + +* Fix handling of `len` and `lenof` being declared as names. + + For compatibility with programs written for older Snowball versions + len and lenof stop being tokens if declared as names. However this + code didn't work correctly if the tokeniser's name buffer needed to + be enlarged to hold the token name (i.e. 3 or 5 elements respectively). + +* Report a clearer error if `=` is used instead of `==` in an integer test. + +* Replace a single entry command list with its contents in the internal syntax + tree. This puts things in a more canonical form, which helps subsequent + optimisations. + +Build system +------------ + +* Support building on Microsoft Windows (using mingw+msys or a similar + Unix-like environment). Patch from Jannick in #129. + +* Split out INCLUDES from CPPFLAGS so that CPPFLAGS can now be overridden by + the user if required. Fixes #148, reported by Dominique Leuenberger. + +* Regenerate algorithms.mk only when needed rather than on every `make` run. + +libstemmer +---------- + +* The libstemmer static library now has a `.a` extension, rather than `.o`. + Patch from Michal Vasilek in #150. + +Testsuite +--------- + +* stemtest: Test that numbers and numeric codes aren't damaged by any of the + algorithms. Regression test for #66. Fixes #81. + +* ada: Fix ada tests to fail if output differs. There was an extra `| head + -300` compared to other languages, which meant that the exit code of `diff` + was ignored. It seems more helpful (and is more consistent) not to limit how + many differences are shown so just drop this addition. + +* go: Stop thinning testdata. It looks like we only are because the test + harness code was based on that for rust, which was based on that for + javascript, which was only thinning because it was reading everything into + memory and the larger vocabulary lists were resulting in out of memory + issues. + +* javascript: Speed up stemwords.js. Process input line-by-line rather than + reading the whole file into memory, splitting, iterating, and creating an + array with all the output, joining and writing out a single huge string. + This also means we can stop thinning the test data for javascript, which we + were only doing because the huge arabic test data file was causing out of + memory errors. Also drop the -p option, which isn't useful here and + complicates the code. + +* rust: Turn on optimisation in the makefile rather than the CI config. This + makes the tests run in about 1/5 of the time and there's really no reason to + be thinning the testdata for rust. + +Documentation +------------- + +* CONTRIBUTING.rst: Improve documentation for adding a new stemming algorithm. + +* Improve wording of Python docs. + +Snowball 2.1.0 (2021-01-21) +=========================== + +C/C++ +----- + +* Fix decoding of 4-byte UTF-8 sequences in `grouping` checks. This bug + affected Unicode codepoints U+40000 to U+7FFFF and U+C0000 to U+FFFFF and + doesn't affect any of the stemming algorithms we currently ship (#138, + reported by Stephane Carrez). + +Python +------ + +* Fix snowballstemmer.algorithms() method (#132, reported by kkaiser). + +* Update code to generate trove language classifiers for PyPI. All the + natural languages we previously had stemmers for have now been added to + PyPI's list, but Armenian and Yiddish aren't on it. Patch from Dmitry + Shachnev. + +Code Quality Improvements +------------------------- + +* Suppress GCC warning in compiler code. + +* Use `const` pointers more in C runtime. + +* Only use spaces for indentation in javascript code. Change proposed by Emily + Marigold Klassen in #123, and seems to be the modern Javascript norm. + +New Snowball Language Features +------------------------------ + +* `lenof` and `sizeof` can now be applied to a literal string, which can be + useful if you want to do calculations on cursor values. + + This change actually simplifies the language a little, since you can now use + a literal string in any read-only context which accepts a string variable. + +Code generation improvements +---------------------------- + +* General: + + + Fix bugs in the code generated to handle failure of `goto`, `gopast` or + `try` inside `setlimit` or string-`$`. This affected all languages (though + the issue with `try` wasn't present for C). These bugs don't affect any of + the stemming algorithms we currently ship. Reported by Stefan Petkovic on + snowball-discuss. + + + Change `hop` with a negative argument to work as documented. The manual + says a negative argument to hop will raise signal f, but the implementation + for all languages was actually to move the cursor in the opposite direction + to `hop` with a positive argument. The implemented behaviour is + problematic as it allows invalidating implicitly saved cursor values by + modifying the string outside the current region, so we've decided it's best + to fix the implementation to match the documentation. + + The only Snowball code we're aware of which relies on this was the original + version of the new Yiddish stemming algorithm, which has been updated not + to rely on this. + + The compiler now issues a warning for `hop` with a constant negative + argument (internally now converted to `false`), and for `hop` with a + constant zero argument (internally now converted to `true`). + + + Canonicalise `among` actions equivalent to `()` such as `(true)` which + previously resulted in an extra case in the among, and for Python + we'd generate invalid Python code (`if` or `elif` with an empty body). + Bug revealed by Assaf Urieli's Yiddish stemmer in #137. + + + Eliminate variables whose values are never used - they no longer have + corresponding member variables, etc, and no code is generated for any + assignments to them. + + + Don't generate anything for an unused `grouping`. + + + Stop warning "grouping X defined but not used" for a `grouping` which is + only used to define another `grouping`. + +* C/C++: + + + Store booleans in same array as integers. This means each boolean is + stored as an int instead of an unsigned char which means 4 bytes instead of + 1, but we save a pointer (4 or 8 bytes) in struct SN_env which is a win for + all the current stemmers. For an algorithm which uses both integers and + booleans, we also save the overhead of allocating a block on the heap, and + potentially improve data locality. + + + Eliminate duplicate generated C comment for sliceto. + +* Pascal: + + + Avoid generating unused variables. The Pascal code generated for the + stemmers we ship is now warning free (tested with fpc 3.2.0). + + + Don't emit empty `private` sections. Cosmetic, but makes the generated + code a bit easier to follow. + +* Python: + + + End `if`-chain with `else` where possible, avoiding a redundant test + of the variable being switched on. This optimisation kicks in for an + `among` where all cases have commands. This change seems to speed up `make + check_python_arabic` by a few percent. + +New stemming algorithms +----------------------- + +* Add Serbian stemmer from stef4np (#113). + +* Add Yiddish stemmer from Assaf Urieli (#137). + +* Add Armenian stemmer from Astghik Mkrtchyan. It's been on the website for + over a decade, and included in Xapian for over 9 years without any negative + feedback. + +Optimisations to existing algorithms +------------------------------------ + +* kraaij_pohlmann: Use `$v = limit` instead of `do (tolimit setmark v)` since + this generates simpler code, and also matches the code other algorithm + implementations use. + + Probably for languages like C with optimising compilers the compiler + will generate equivalent code anyway, but e.g. for Python this should be + an improvement. + +Code clarity improvements to existing algorithms +------------------------------------------------ + +* hindi.sbl: Fix comment typo. + +Compiler +-------- + +* Don't count `$x = x + 1` as initialising or using `x`, so it's now handled + like `$x += 1` already is. + +* Comments are now only included in the generated code if command line option + -comments is specified. + + The comments in the generated code are useful if you're trying to debug the + compiler, and perhaps also if you are trying to debug your Snowball code, but + for everyone else they just bloat the code which as the number of languages + we support grows becomes more of an issue. + +* `-parentclassname` is not only for java and csharp so don't disable it if + those backends are disabled. + +* `-syntax` now reports the value for each numeric literal. + +* Report location for excessive get nesting error. + +* Internally the compiler now represents negated literal numbers as a simple + `c_number` rather than `c_neg` applied to a `c_number` with a positive value. + This simplifies optimisations that want to check for a constant numeric + expression. + +Build system +------------ + +* Link binaries with LDFLAGS if it's set, which is needed for some platform + (e.g. OpenEmbedded). Patch from Andreas Müller (#120). + +* Add missing dependencies of algorithms.go rule. + +Testsuite +--------- + +* C: Add stemtest for low-level regression tests. + +Documentation +------------- + +* Document a C99 compiler as a requirement for building the snowball compiler + (but the C code it generates should still work with any ISO C compiler). + + A few declarations mixed with code crept in some time ago (which nobody's + complained about), so this is really just formally documenting a requirement + which already existed. + +* README: Explain what Snowball is and what Stemming is (#131, reported by Sean + Kelly). + +* CONTRIBUTING.rst: Expand section on adding a new generator. + +* For Python snowballstemmer module include global NEWS instead of + Python-specific CHANGES.rst and use README.rst as the long description. + Patch from Dmitry Shachnev (#119). + +* COPYING: Update and incorporate Python backend licensing information which + was previously in a separate file. + +Snowball 2.0.0 (2019-10-02) +=========================== + +C/C++ +----- + +* Fully handle 4-byte UTF-8 sequences. Previously `hop` and `next` handled + sequences of any length, but commands which look at the character value only + handled sequences up to length 3. Fixes #89. + +* Fix handling of a 3-byte UTF-8 sequence in a grouping in `backwardmode`. + +Java +---- + +* TestApp.java: + + - Always use UTF-8 for I/O. Patch from David Corbett (#80). + + - Allow reading input from stdin. + + - Remove rather pointless "stem n times" feature. + + - Only lower case ASCII to match stemwords.c. + + - Stem empty lines too to match stemwords.c. + +Code Quality Improvements +------------------------- + +* Fix various warnings from newer compilers. + +* Improve use of `const`. + +* Share common functions between compiler backends rather than having multiple + copies of the same code. + +* Assorted code clean-up. + +* Initialise line_labelled member of struct generator to 0. Previously we were + invoking undefined behaviour, though in practice it'll be zero initialised on + most platforms. + +New Code Generators +------------------- + +* Add Python generator (#24). Originally written by Yoshiki Shibukawa, with + additional updates by Dmitry Shachnev. + +* Add Javascript generator. Based on JSX generator (#26) written by Yoshiki + Shibukawa. + +* Add Rust generator from Jakob Demler (#51). + +* Add Go generator from Marty Schoch (#57). + +* Add C# generator. Based on patch from Cesar Souza (#16, #17). + +* Add Pascal generator. Based on Delphi backend from stemming.zip file on old + website (#75). + +New Snowball Language Features +------------------------------ + +* Add `len` and `lenof` to measure Unicode length. These are similar to `size` + and `sizeof` (respectively), but `size` and `sizeof` return the length in + bytes under `-utf8`, whereas these new commands give the same result whether + using `-utf8`, `-widechars` or neither (but under `-utf8` they are O(n) in + the length of the string). For compatibility with existing code which might + use these as variable or function names, they stop being treated as tokens if + declared to be a variable or function. + +* New `{U+1234}` stringdef notation for Unicode codepoints. + +* More versatile integer tests. Now you can compare any two arithmetic + expressions with a relational operator in parentheses after the `$`, so for + example `$(len > 3)` can now be used when previously a temporary variable was + required: `$tmp = len $tmp > 3` + +Code generation improvements +---------------------------- + +* General: + + + Avoid unnecessarily saving and restoring of the cursor for more commands - + `atlimit`, `do`, `set` and `unset` all leave the cursor alone or always + restore its value, and for C `booltest` (which other languages already + handled). + + + Special case handling for `setlimit tomark AE`. All uses of setlimit in + the current stemmers we ship follow this pattern, and by special-casing we + can avoid having to save and restore the cursor (#74). + + + Merge duplicate actions in the same `among`. This reduces the size of the + switch/if-chain in the generated code which dispatch the among for many of + the stemmers. + + + Generate simpler code for `among`. We always check for a zero return value + when we call the among, so there's no point also checking for that in the + switch/if-chain. We can also avoid the switch/if-chain entirely when + there's only one possible outcome (besides the zero return). + + + Optimise code generated for `do `. This speeds up "make + check_python" by about 2%, and should speed up other interpreted languages + too (#110). + + + Generate more and better comments referencing snowball source. + + + Add homepage URL and compiler version as comments in generated files. + +* C/C++: + + + Fix `size` and `sizeof` to not report one too high (reported by Assem + Chelli in #32). + + + If signal `f` from a function call would lead to return from the current + function then handle this and bailing out on an error together with a + simple `if (ret <= 0) return ret;` + + + Inline testing for a single character literals. + + + Avoiding generating `|| 0` in corner case - this can result in a compiler + warning when building the generated code. + + + Implement `insert_v()` in terms of `insert_s()`. + + + Add conditional `extern "C"` so `runtime/api.h` can be included from C++ + code. Closes #90, reported by vvarma. + +* Java: + + + Fix functions in `among` to work in Java. We seem to need to make the + methods called from among `public` instead of `private`, and to call them + on `this` instead of the `methodObject` (which is cleaner anyway). No + revision in version control seems to generate working code for this case, + but Richard says it definitely used to work - possibly older JVMs failed to + correctly enforce the access controls when methods were invoked by + reflection. + + + Code after handling `f` by returning from the current function is + unreachable too. + + + Previously we incorrectly decided that code after an `or` was + unreachable in certain cases. None of the current stemmers in the + distribution triggered this, but Martin Porter's snowball version + of the Schinke Latin stemmer does. Fixes #58, reported by Alexander + Myltsev. + + + The reachability logic was failing to consider reachability from + the final command in an `or`. Fixes #82, reported by David Corbett. + + + Fix `maxint` and `minint`. Patch from David Corbett in #31. + + + Fix `$` on strings. The previous generated code was just wrong. This + doesn't affect any of the included algorithms, but for example breaks + Martin Porter's snowball implementation of Schinke's Latin Stemmer. + Issue noted by Jakob Demler while working on the Rust backend in #51, + and reported in the Schinke's Latin Stemmer by Alexander Myltsev + in #58. + + + Make SnowballProgram objects serializable. Patch from Oleg Smirnov in #43. + + + Eliminate range-check implementation for groupings. This was removed from + the C generator 10 years earlier, isn't used for any of the existing + algorithms, and it doesn't seem likely it would be - the grouping would + have to consist entirely of a contiguous block of Unicode code-points. + + + Simplify code generated for `repeat` and `atleast`. + + + Eliminate unused return values and variables from runtime functions. + + + Only import the `among` and `SnowballProgram` classes if they're actually + used. + + + Only generate `copy_from()` method if it's used. + + + Merge runtime functions `eq_s` and `eq_v` functions. + + + Java arrays know their own length so stop storing it separately. + + + Escape char 127 (DEL) in generated Java code. It's unlikely that this + character would actually be used in a real stemmer, so this was more of a + theoretical bug. + + + Drop unused import of InvocationTargetException from SnowballStemmer. + Reported by GerritDeMeulder in #72. + + + Fix lint check issues in generated Java code. The stemmer classes are only + referenced in the example app via reflection, so add + @SuppressWarnings("unused") for them. The stemmer classes override + equals() and hashCode() methods from the standard java Object class, so + mark these with @Override. Both suggested by GerritDeMeulder in #72. + + + Declare Java variables at point of use in generated code. Putting all + declarations at the top of the function was adding unnecessary complexity + to the Java generator code for no benefit. + + + Improve formatting of generated code. + +New stemming algorithms +----------------------- + +* Add Tamil stemmer from Damodharan Rajalingam (#2, #3). + +* Add Arabic stemmer from Assem Chelli (#32, #50). + +* Add Irish stemmer from Jim O'Regan (#48). + +* Add Nepali stemmer from Arthur Zakirov (#70). + +* Add Indonesian stemmer from Olly Betts (#71). + +* Add Hindi stemmer from Olly Betts (#73). Thanks to David Corbett for review. + +* Add Lithuanian stemmer from Dainius Jocas (#22, #76). + +* Add Greek stemmer from Oleg Smirnov (#44). + +* Add Catalan and Basque stemmers from Israel Olalla (#104). + +Behavioural changes to existing algorithms +------------------------------------------ + +* Portuguese: + + + Replace incorrect Spanish suffixes by Portuguese suffixes (#1). + +* French: + + + The MSDOS CP850 version of the French algorithm was missing changes present + in the ISO8859-1 and Unicode versions. There's now a single version of + each algorithm which was based on the Unicode version. + + + Recognize French suffixes even when they begin with diaereses. Patch from + David Corbett in #78. + +* Russian: + + + We now normalise 'ё' to 'е' before stemming. The documentation has long + said "we assume ['ё'] is mapped into ['е']" but it's more convenient for + the stemmer to actually perform this normalisation. This change has no + effect if the caller is already normalising as we recommend. It's a change + in behaviour they aren't, but 'ё' occurs rarely (there are currently no + instances in our test vocabulary) and this improves behaviour when it does + occur. Patch from Eugene Mirotin (#65, #68). + +* Finish: + + + Adjust the Finnish algorithm not to mangle numbers. This change also + means it tends to leave foreign words alone. Fixes #66. + +* Danish: + + + Adjust Danish algorithm not to mangle alphanumeric codes. In particular + alphanumeric codes ending in a double digit (e.g. 0x0e00, hal9000, + space1999) are no longer mangled. See #81. + +Optimisations to existing algorithms +------------------------------------ + +* Turkish: + + + Simplify uses of `test` in stemmer code. + + + Check for 'ad' or 'soyad' more efficiently, and without needing the + strlen variable. This speeds up "make check_utf8_turkish" by 11% + on x86 Linux. + +* Kraaij-Pohlmann: + + + Eliminate variable x `$p1 <= cursor` is simpler and a little more efficient + than `setmark x $x >= p1`. + +Code clarity improvements to existing algorithms +------------------------------------------------ + +* Turkish: + + + Use , for cedilla to match the conventions used in other stemmers. + +* Kraaij-Pohlmann: + + + Avoid cryptic `[among ( (])` ... `)` construct - instead use the same + `[substring] among (` ... `)` construct we do in other stemmers. + +Compiler +-------- + +* Support conventional --help and --version options. + +* Warn if -r or -ep used with backend other than C/C++. + +* Warn if encoding command line options are specified when generating code in a + language with a fixed encoding. + +* The default classname is now set based on the output filename, so `-n` is now + often no longer needed. Fixes #64. + +* Avoid potential one byte buffer over-read when parsing snowball code. + +* Avoid comparing with uninitialised array element during compilation. + +* Improve `-syntax` output for `setlimit L for C`. + +* Optimise away double negation so generators don't have to worry about + generating `--` (decrement operator in many languages). Fixes #52, reported + by David Corbett. + +* Improved compiler error and warning messages: + + - We now report FILE:LINE: before each diagnostic message. + + - Improve warnings for unused declarations/definitions. + + - Warn for variables which are used, but either never initialised + or never read. + + - Flag non-ASCII literal strings. This is an error for wide Unicode, but + only a warning for single-byte and UTF-8 which work so long as the source + encoding matches the encoding used in the generated stemmer code. + + - Improve error recovery after an undeclared `define`. We now sniff the + token after the identifier and if it is `as` we parse as a routine, + otherwise we parse as a grouping. Previously we always just assumed it was + a routine, which gave a confusing second error if it was a grouping. + + - Improve error recovery after an unexpected token in `among`. Previously + we acted as if the unexpected token closed the `among` (this probably + wasn't intended but just a missing `break;` in a switch statement). Now we + issue an error and try the next token. + +* Report error instead of silently truncating character values (e.g. `hex 123` + previously silently became byte 0x23 which is `#` rather than a + g-with-cedilla). + +* Enlarge the initial input buffer size to 8192 bytes and double each time we + hit the end. Snowball programs are typically a few KB in size (with the + current largest we ship being the Greek stemmer at 27KB) so the previous + approach of starting with a 10 byte input buffer and increasing its size by + 50% plus 40 bytes each time it filled was inefficient, needing up to 15 + reallocations to load greek.sbl. + +* Identify variables only used by one `routine`/`external`. This information + isn't yet used, but such variables which are also always written to before + being read can be emitted as local variables in most target languages. + +* We now allow multiple source files on command line, and allow them to be + after (or even interspersed) with options to better match modern Unix + conventions. Support for multiple source files allows specifying a single + byte character set mapping via a source file of `stringdef`. + +* Avoid infinite recursion in compiler when optimising a recursive snowball + function. Recursive functions aren't typical in snowball programs, but + the compiler shouldn't crash for any input, especially not a valid one. + We now simply limit on how deep the compiler will recurse and make the + pessimistic assumption in the unlikely event we hit this limit. + +Build system +------------ + +* `make clean` in C libstemmer_c distribution now removes `examples/*.o`. + (#59) + +* Fix all the places which previously had to have a list of stemmers to work + dynamically or be generated, so now only modules.txt needs updating to add + a new stemmer. + +* Add check_java make target which runs tests for java. + +* Support gzipped test data (the uncompressed arabic test data is too big for + github). + +* GNUmakefile: Drop useless `-eprefix` and `-r` options from snowball + invocations for Java - these are only meaningful when generating C code. + +* Pass CFLAGS when linking which matches convention (e.g. automake does it) and + facilitates use of tools such as ASan. Fixes #84, reported by Thomas + Pointhuber. + +* Add CI builds with -std=c90 to check compiler and generated code are C90 + (#54) + +libstemmer +---------- + +* Split out CPPFLAGS from CFLAGS and use CFLAGS when linking stemwords. + +* Add -O2 to CFLAGS. + +* Make generated tables of encodings and modules const. + +* Fix clang static analyzer memory leak warning (in practice this code path + can never actually be taken). Patch from Patrick O. Perry (#56) + +Documentation +------------- + +* Added copyright and licensing details (#10). + +* Document that libstemmer supports ISO_8859_2 encoding. Currently hungarian + and romanian are available in ISO_8859_2. + +* Remove documentation falsely claiming that libstemmer supports CP850 + encoding. + +* CONTRIBUTING.rst: Add guidance for contributing new stemming algorithms and + new language backends. + +* Overhaul libstemmer_python_README. Most notably, replace the benchmark data + which was very out of date. diff --git a/contrib/libs/snowball/README b/contrib/libs/snowball/README new file mode 100644 index 000000000000..e2b22961edfe --- /dev/null +++ b/contrib/libs/snowball/README @@ -0,0 +1,151 @@ +libstemmer_c +============ + +This document pertains to the C version of the libstemmer distribution, +available for download from: + +https://snowballstem.org/download.html + + +What is Stemming? +----------------- + +Stemming maps different forms of the same word to a common "stem" - for +example, the English stemmer maps *connection*, *connections*, *connective*, +*connected*, and *connecting* to *connect*. So a search for *connected* +would also find documents which only have the other forms. + +This stem form is often a word itself, but this is not always the case as this +is not a requirement for text search systems, which are the intended field of +use. We also aim to conflate words with the same meaning, rather than all +words with a common linguistic root (so *awe* and *awful* don't have the same +stem), and over-stemming is more problematic than under-stemming so we tend not +to stem in cases that are hard to resolve. If you want to always reduce words +to a root form and/or get a root form which is itself a word then Snowball's +stemming algorithms likely aren't the right answer. + + +Compiling the library +===================== + +A simple makefile is provided for Unix style systems. On such systems, it +should be possible simply to run "make", and the file "libstemmer.o" +and the example program "stemwords" will be generated. + +If this doesn't work on your system, you need to write your own build +system (or call the compiler directly). The files to compile are +all contained in the "libstemmer", "runtime" and "src_c" directories, +and the public header file is contained in the "include" directory. + +The library comes in two flavours; UTF-8 only, and UTF-8 plus other character +sets. To use the utf-8 only flavour, compile "libstemmer_utf8.c" instead of +"libstemmer.c". + +For convenience "mkinc.mak" is a makefile fragment listing the source files and +header files used to compile the standard version of the library. +"mkinc_utf8.mak" is a comparable makefile fragment listing just the source +files for the UTF-8 only version of the library. + + +Using the library +================= + +The stemming algorithms generally expect the input text to use composed accents +(Unicode NFC or NFKC) and to have been folded to lower case already. + +The library provides a simple C API. Essentially, a new stemmer can +be obtained by using "sb_stemmer_new". "sb_stemmer_stem" is then +used to stem a word, "sb_stemmer_length" returns the stemmed +length of the last word processed, and "sb_stemmer_delete" is +used to delete a stemmer. + +Generally you should create a stemmer object and reuse it rather than creating +a fresh object for each word stemmed (since there's some cost to creating and +destroying the object). + +The stemmer code is re-entrant, but not thread-safe if the same stemmer object +is used concurrently in different threads. + +If you want to perform stemming concurrently in different threads, we suggest +creating a new stemmer object for each thread. The alternative is to share +stemmer objects between threads and protect access using a mutex or similar +but that's liable to slow your program down as threads can end up waiting for +the lock. + +libstemmer does not currently incorporate any mechanism for caching the results +of stemming operations. Such caching can greatly increase the performance of a +stemmer under certain situations, so suitable patches will be considered for +inclusion. + +The standard libstemmer sources contain an algorithm for each of the supported +languages. The algorithm may be selected using the english name of the +language, or using the 2 or 3 letter ISO 639 language codes. In addition, +the traditional "Porter" stemming algorithm for english is included for +backwards compatibility purposes, but we recommend use of the "English" +stemmer in preference for new projects. + +(Some minor algorithms which are included only as curiosities in the snowball +website, such as the Lovins stemmer and the Kraaij Pohlmann stemmer, are not +included in the standard libstemmer sources. These are not really supported by +the snowball project, but it would be possible to compile a modified libstemmer +library containing these if desired.) + + +The stemwords example +===================== + +The stemwords example program allows you to run any of the stemmers +compiled into the libstemmer library on a sample vocabulary. For +details on how to use it, run it with the "-h" command line option. + + +Using the library in a larger system +==================================== + +If you are incorporating the library into the build system of a larger +program, I recommend copying the unpacked tarball without modification into +a subdirectory of the sources of your program. Future versions of the +library are intended to keep the same structure, so this will keep the +work required to move to a new version of the library to a minimum. + +As an additional convenience, the list of source and header files used +in the library is detailed in mkinc.mak - a file which is in a suitable +format for inclusion by a Makefile. By including this file in your build +system, you can link the snowball system into your program with a few +extra rules. + +Using the library in a system using GNU autotools +================================================= + +The libstemmer_c library can be integrated into a larger system which uses the +GNU autotool framework (and in particular, automake and autoconf) as follows: + +1) Unpack libstemmer_c-*.tar.gz in the top level project directory and rename + the resulting directory to remove the version number so that there is a + libstemmer_c subdirectory of the top level directory of the project. + +2) Add a file "Makefile.am" to the unpacked libstemmer_c folder, containing: + +noinst_LTLIBRARIES = libstemmer.la +include $(srcdir)/mkinc.mak +noinst_HEADERS = $(snowball_headers) +libstemmer_la_SOURCES = $(snowball_sources) + +(You may also need to add other lines to this, for example, if you are using +compiler options which are not compatible with compiling the libstemmer +library.) + +3) Add libstemmer_c to the AC_CONFIG_FILES declaration in the project's + configure.ac file. + +4) Add to the top level makefile the following lines (or modify existing + assignments to these variables appropriately): + +AUTOMAKE_OPTIONS = subdir-objects +AM_CPPFLAGS = -I$(top_srcdir)/libstemmer_c/include +SUBDIRS=libstemmer_c +_LIBADD = libstemmer_c/libstemmer.la + +(Where is the name of the library or executable which links against +libstemmer.) + diff --git a/contrib/libs/snowball/include/libstemmer.h b/contrib/libs/snowball/include/libstemmer.h new file mode 100644 index 000000000000..62101bfea552 --- /dev/null +++ b/contrib/libs/snowball/include/libstemmer.h @@ -0,0 +1,82 @@ + +/* Make header file work when included from C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +struct sb_stemmer; +typedef unsigned char sb_symbol; + +/* FIXME - should be able to get a version number for each stemming + * algorithm (which will be incremented each time the output changes). */ + +/** Returns an array of the names of the available stemming algorithms. + * Note that these are the canonical names - aliases (ie, other names for + * the same algorithm) will not be included in the list. + * The list is terminated with a null pointer. + * + * The list must not be modified in any way. + */ +const char ** sb_stemmer_list(void); + +/** Create a new stemmer object, using the specified algorithm, for the + * specified character encoding. + * + * All algorithms will usually be available in UTF-8, but may also be + * available in other character encodings. + * + * @param algorithm The algorithm name. This is either the english + * name of the algorithm, or the 2 or 3 letter ISO 639 codes for the + * language. Note that case is significant in this parameter - the + * value should be supplied in lower case. + * + * @param charenc The character encoding. NULL may be passed as + * this value, in which case UTF-8 encoding will be assumed. Otherwise, + * the argument may be one of "UTF_8", "ISO_8859_1" (i.e. Latin 1), + * "ISO_8859_2" (i.e. Latin 2) or "KOI8_R" (Russian). Note that case is + * significant in this parameter. + * + * @return NULL if the specified algorithm is not recognised, or the + * algorithm is not available for the requested encoding. Otherwise, + * returns a pointer to a newly created stemmer for the requested algorithm. + * The returned pointer must be deleted by calling sb_stemmer_delete(). + * + * @note NULL will also be returned if an out of memory error occurs. + */ +struct sb_stemmer * sb_stemmer_new(const char * algorithm, const char * charenc); + +/** Delete a stemmer object. + * + * This frees all resources allocated for the stemmer. After calling + * this function, the supplied stemmer may no longer be used in any way. + * + * It is safe to pass a null pointer to this function - this will have + * no effect. + */ +void sb_stemmer_delete(struct sb_stemmer * stemmer); + +/** Stem a word. + * + * The stemming algorithms generally expect the input text to use composed + * accents (Unicode NFC or NFKC) and to have been folded to lower case + * already. + * + * The return value is owned by the stemmer - it must not be freed or + * modified, and it will become invalid when the stemmer is called again, + * or if the stemmer is freed. + * + * The length of the return value can be obtained using sb_stemmer_length(). + * + * If an out-of-memory error occurs, this will return NULL. + */ +const sb_symbol * sb_stemmer_stem(struct sb_stemmer * stemmer, + const sb_symbol * word, int size); + +/** Get the length of the result of the last stemmed word. + * This should not be called before sb_stemmer_stem() has been called. + */ +int sb_stemmer_length(struct sb_stemmer * stemmer); + +#ifdef __cplusplus +} +#endif diff --git a/contrib/libs/snowball/libstemmer/libstemmer.c b/contrib/libs/snowball/libstemmer/libstemmer.c new file mode 100644 index 000000000000..700445024dfc --- /dev/null +++ b/contrib/libs/snowball/libstemmer/libstemmer.c @@ -0,0 +1,96 @@ + +#include +#include +#include "../include/libstemmer.h" +#include "../runtime/api.h" +#include "modules.h" + +struct sb_stemmer { + struct SN_env * (*create)(void); + void (*close)(struct SN_env *); + int (*stem)(struct SN_env *); + + struct SN_env * env; +}; + +extern const char ** +sb_stemmer_list(void) +{ + return algorithm_names; +} + +static stemmer_encoding_t +sb_getenc(const char * charenc) +{ + const struct stemmer_encoding * encoding; + if (charenc == NULL) return ENC_UTF_8; + for (encoding = encodings; encoding->name != 0; encoding++) { + if (strcmp(encoding->name, charenc) == 0) break; + } + if (encoding->name == NULL) return ENC_UNKNOWN; + return encoding->enc; +} + +extern struct sb_stemmer * +sb_stemmer_new(const char * algorithm, const char * charenc) +{ + stemmer_encoding_t enc; + const struct stemmer_modules * module; + struct sb_stemmer * stemmer; + + enc = sb_getenc(charenc); + if (enc == ENC_UNKNOWN) return NULL; + + for (module = modules; module->name != 0; module++) { + if (strcmp(module->name, algorithm) == 0 && module->enc == enc) break; + } + if (module->name == NULL) return NULL; + + stemmer = (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); + if (stemmer == NULL) return NULL; + + stemmer->create = module->create; + stemmer->close = module->close; + stemmer->stem = module->stem; + + stemmer->env = stemmer->create(); + if (stemmer->env == NULL) + { + sb_stemmer_delete(stemmer); + return NULL; + } + + return stemmer; +} + +void +sb_stemmer_delete(struct sb_stemmer * stemmer) +{ + if (stemmer == 0) return; + if (stemmer->close) { + stemmer->close(stemmer->env); + stemmer->close = 0; + } + free(stemmer); +} + +const sb_symbol * +sb_stemmer_stem(struct sb_stemmer * stemmer, const sb_symbol * word, int size) +{ + int ret; + if (SN_set_current(stemmer->env, size, (const symbol *)(word))) + { + stemmer->env->l = 0; + return NULL; + } + ret = stemmer->stem(stemmer->env); + if (ret < 0) return NULL; + stemmer->env->p[stemmer->env->l] = 0; + return (const sb_symbol *)(stemmer->env->p); +} + +int +sb_stemmer_length(struct sb_stemmer * stemmer) +{ + return stemmer->env->l; +} diff --git a/contrib/libs/snowball/libstemmer/libstemmer_c.in b/contrib/libs/snowball/libstemmer/libstemmer_c.in new file mode 100644 index 000000000000..55d1769d56fa --- /dev/null +++ b/contrib/libs/snowball/libstemmer/libstemmer_c.in @@ -0,0 +1,96 @@ + +#include +#include +#include "../include/libstemmer.h" +#include "../runtime/api.h" +#include "@MODULES_H@" + +struct sb_stemmer { + struct SN_env * (*create)(void); + void (*close)(struct SN_env *); + int (*stem)(struct SN_env *); + + struct SN_env * env; +}; + +extern const char ** +sb_stemmer_list(void) +{ + return algorithm_names; +} + +static stemmer_encoding_t +sb_getenc(const char * charenc) +{ + const struct stemmer_encoding * encoding; + if (charenc == NULL) return ENC_UTF_8; + for (encoding = encodings; encoding->name != 0; encoding++) { + if (strcmp(encoding->name, charenc) == 0) break; + } + if (encoding->name == NULL) return ENC_UNKNOWN; + return encoding->enc; +} + +extern struct sb_stemmer * +sb_stemmer_new(const char * algorithm, const char * charenc) +{ + stemmer_encoding_t enc; + const struct stemmer_modules * module; + struct sb_stemmer * stemmer; + + enc = sb_getenc(charenc); + if (enc == ENC_UNKNOWN) return NULL; + + for (module = modules; module->name != 0; module++) { + if (strcmp(module->name, algorithm) == 0 && module->enc == enc) break; + } + if (module->name == NULL) return NULL; + + stemmer = (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); + if (stemmer == NULL) return NULL; + + stemmer->create = module->create; + stemmer->close = module->close; + stemmer->stem = module->stem; + + stemmer->env = stemmer->create(); + if (stemmer->env == NULL) + { + sb_stemmer_delete(stemmer); + return NULL; + } + + return stemmer; +} + +void +sb_stemmer_delete(struct sb_stemmer * stemmer) +{ + if (stemmer == 0) return; + if (stemmer->close) { + stemmer->close(stemmer->env); + stemmer->close = 0; + } + free(stemmer); +} + +const sb_symbol * +sb_stemmer_stem(struct sb_stemmer * stemmer, const sb_symbol * word, int size) +{ + int ret; + if (SN_set_current(stemmer->env, size, (const symbol *)(word))) + { + stemmer->env->l = 0; + return NULL; + } + ret = stemmer->stem(stemmer->env); + if (ret < 0) return NULL; + stemmer->env->p[stemmer->env->l] = 0; + return (const sb_symbol *)(stemmer->env->p); +} + +int +sb_stemmer_length(struct sb_stemmer * stemmer) +{ + return stemmer->env->l; +} diff --git a/contrib/libs/snowball/libstemmer/libstemmer_utf8.c b/contrib/libs/snowball/libstemmer/libstemmer_utf8.c new file mode 100644 index 000000000000..9966c7158ab1 --- /dev/null +++ b/contrib/libs/snowball/libstemmer/libstemmer_utf8.c @@ -0,0 +1,96 @@ + +#include +#include +#include "../include/libstemmer.h" +#include "../runtime/api.h" +#include "modules_utf8.h" + +struct sb_stemmer { + struct SN_env * (*create)(void); + void (*close)(struct SN_env *); + int (*stem)(struct SN_env *); + + struct SN_env * env; +}; + +extern const char ** +sb_stemmer_list(void) +{ + return algorithm_names; +} + +static stemmer_encoding_t +sb_getenc(const char * charenc) +{ + const struct stemmer_encoding * encoding; + if (charenc == NULL) return ENC_UTF_8; + for (encoding = encodings; encoding->name != 0; encoding++) { + if (strcmp(encoding->name, charenc) == 0) break; + } + if (encoding->name == NULL) return ENC_UNKNOWN; + return encoding->enc; +} + +extern struct sb_stemmer * +sb_stemmer_new(const char * algorithm, const char * charenc) +{ + stemmer_encoding_t enc; + const struct stemmer_modules * module; + struct sb_stemmer * stemmer; + + enc = sb_getenc(charenc); + if (enc == ENC_UNKNOWN) return NULL; + + for (module = modules; module->name != 0; module++) { + if (strcmp(module->name, algorithm) == 0 && module->enc == enc) break; + } + if (module->name == NULL) return NULL; + + stemmer = (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); + if (stemmer == NULL) return NULL; + + stemmer->create = module->create; + stemmer->close = module->close; + stemmer->stem = module->stem; + + stemmer->env = stemmer->create(); + if (stemmer->env == NULL) + { + sb_stemmer_delete(stemmer); + return NULL; + } + + return stemmer; +} + +void +sb_stemmer_delete(struct sb_stemmer * stemmer) +{ + if (stemmer == 0) return; + if (stemmer->close) { + stemmer->close(stemmer->env); + stemmer->close = 0; + } + free(stemmer); +} + +const sb_symbol * +sb_stemmer_stem(struct sb_stemmer * stemmer, const sb_symbol * word, int size) +{ + int ret; + if (SN_set_current(stemmer->env, size, (const symbol *)(word))) + { + stemmer->env->l = 0; + return NULL; + } + ret = stemmer->stem(stemmer->env); + if (ret < 0) return NULL; + stemmer->env->p[stemmer->env->l] = 0; + return (const sb_symbol *)(stemmer->env->p); +} + +int +sb_stemmer_length(struct sb_stemmer * stemmer) +{ + return stemmer->env->l; +} diff --git a/contrib/libs/snowball/libstemmer/modules.h b/contrib/libs/snowball/libstemmer/modules.h new file mode 100644 index 000000000000..e4bfd4c58c2a --- /dev/null +++ b/contrib/libs/snowball/libstemmer/modules.h @@ -0,0 +1,289 @@ +/* libstemmer/modules.h: List of stemming modules. + * + * This file is generated by mkmodules.pl from a list of module names. + * Do not edit manually. + * + * Modules included by this file are: arabic, armenian, basque, catalan, + * danish, dutch, dutch_porter, english, esperanto, estonian, finnish, french, + * german, greek, hindi, hungarian, indonesian, irish, italian, lithuanian, + * nepali, norwegian, porter, portuguese, romanian, russian, serbian, spanish, + * swedish, tamil, turkish, yiddish + */ + +#include "../src_c/stem_UTF_8_arabic.h" +#include "../src_c/stem_UTF_8_armenian.h" +#include "../src_c/stem_ISO_8859_1_basque.h" +#include "../src_c/stem_UTF_8_basque.h" +#include "../src_c/stem_ISO_8859_1_catalan.h" +#include "../src_c/stem_UTF_8_catalan.h" +#include "../src_c/stem_ISO_8859_1_danish.h" +#include "../src_c/stem_UTF_8_danish.h" +#include "../src_c/stem_ISO_8859_1_dutch.h" +#include "../src_c/stem_UTF_8_dutch.h" +#include "../src_c/stem_ISO_8859_1_dutch_porter.h" +#include "../src_c/stem_UTF_8_dutch_porter.h" +#include "../src_c/stem_ISO_8859_1_english.h" +#include "../src_c/stem_UTF_8_english.h" +#include "../src_c/stem_UTF_8_esperanto.h" +#include "../src_c/stem_UTF_8_estonian.h" +#include "../src_c/stem_ISO_8859_1_finnish.h" +#include "../src_c/stem_UTF_8_finnish.h" +#include "../src_c/stem_ISO_8859_1_french.h" +#include "../src_c/stem_UTF_8_french.h" +#include "../src_c/stem_ISO_8859_1_german.h" +#include "../src_c/stem_UTF_8_german.h" +#include "../src_c/stem_UTF_8_greek.h" +#include "../src_c/stem_UTF_8_hindi.h" +#include "../src_c/stem_ISO_8859_2_hungarian.h" +#include "../src_c/stem_UTF_8_hungarian.h" +#include "../src_c/stem_ISO_8859_1_indonesian.h" +#include "../src_c/stem_UTF_8_indonesian.h" +#include "../src_c/stem_ISO_8859_1_irish.h" +#include "../src_c/stem_UTF_8_irish.h" +#include "../src_c/stem_ISO_8859_1_italian.h" +#include "../src_c/stem_UTF_8_italian.h" +#include "../src_c/stem_UTF_8_lithuanian.h" +#include "../src_c/stem_UTF_8_nepali.h" +#include "../src_c/stem_ISO_8859_1_norwegian.h" +#include "../src_c/stem_UTF_8_norwegian.h" +#include "../src_c/stem_ISO_8859_1_porter.h" +#include "../src_c/stem_UTF_8_porter.h" +#include "../src_c/stem_ISO_8859_1_portuguese.h" +#include "../src_c/stem_UTF_8_portuguese.h" +#include "../src_c/stem_UTF_8_romanian.h" +#include "../src_c/stem_KOI8_R_russian.h" +#include "../src_c/stem_UTF_8_russian.h" +#include "../src_c/stem_UTF_8_serbian.h" +#include "../src_c/stem_ISO_8859_1_spanish.h" +#include "../src_c/stem_UTF_8_spanish.h" +#include "../src_c/stem_ISO_8859_1_swedish.h" +#include "../src_c/stem_UTF_8_swedish.h" +#include "../src_c/stem_UTF_8_tamil.h" +#include "../src_c/stem_UTF_8_turkish.h" +#include "../src_c/stem_UTF_8_yiddish.h" + +typedef enum { + ENC_UNKNOWN=0, + ENC_ISO_8859_1, + ENC_ISO_8859_2, + ENC_KOI8_R, + ENC_UTF_8 +} stemmer_encoding_t; + +struct stemmer_encoding { + const char * name; + stemmer_encoding_t enc; +}; +static const struct stemmer_encoding encodings[] = { + {"ISO_8859_1", ENC_ISO_8859_1}, + {"ISO_8859_2", ENC_ISO_8859_2}, + {"KOI8_R", ENC_KOI8_R}, + {"UTF_8", ENC_UTF_8}, + {0,ENC_UNKNOWN} +}; + +struct stemmer_modules { + const char * name; + stemmer_encoding_t enc; + struct SN_env * (*create)(void); + void (*close)(struct SN_env *); + int (*stem)(struct SN_env *); +}; +static const struct stemmer_modules modules[] = { + {"ar", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"ara", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"arabic", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"arm", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"armenian", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"baq", ENC_ISO_8859_1, basque_ISO_8859_1_create_env, basque_ISO_8859_1_close_env, basque_ISO_8859_1_stem}, + {"baq", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"basque", ENC_ISO_8859_1, basque_ISO_8859_1_create_env, basque_ISO_8859_1_close_env, basque_ISO_8859_1_stem}, + {"basque", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"ca", ENC_ISO_8859_1, catalan_ISO_8859_1_create_env, catalan_ISO_8859_1_close_env, catalan_ISO_8859_1_stem}, + {"ca", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"cat", ENC_ISO_8859_1, catalan_ISO_8859_1_create_env, catalan_ISO_8859_1_close_env, catalan_ISO_8859_1_stem}, + {"cat", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"catalan", ENC_ISO_8859_1, catalan_ISO_8859_1_create_env, catalan_ISO_8859_1_close_env, catalan_ISO_8859_1_stem}, + {"catalan", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"da", ENC_ISO_8859_1, danish_ISO_8859_1_create_env, danish_ISO_8859_1_close_env, danish_ISO_8859_1_stem}, + {"da", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"dan", ENC_ISO_8859_1, danish_ISO_8859_1_create_env, danish_ISO_8859_1_close_env, danish_ISO_8859_1_stem}, + {"dan", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"danish", ENC_ISO_8859_1, danish_ISO_8859_1_create_env, danish_ISO_8859_1_close_env, danish_ISO_8859_1_stem}, + {"danish", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"de", ENC_ISO_8859_1, german_ISO_8859_1_create_env, german_ISO_8859_1_close_env, german_ISO_8859_1_stem}, + {"de", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"deu", ENC_ISO_8859_1, german_ISO_8859_1_create_env, german_ISO_8859_1_close_env, german_ISO_8859_1_stem}, + {"deu", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"dut", ENC_ISO_8859_1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"dut", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"dutch", ENC_ISO_8859_1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"dutch", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"dutch_porter", ENC_ISO_8859_1, dutch_porter_ISO_8859_1_create_env, dutch_porter_ISO_8859_1_close_env, dutch_porter_ISO_8859_1_stem}, + {"dutch_porter", ENC_UTF_8, dutch_porter_UTF_8_create_env, dutch_porter_UTF_8_close_env, dutch_porter_UTF_8_stem}, + {"el", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"ell", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"en", ENC_ISO_8859_1, english_ISO_8859_1_create_env, english_ISO_8859_1_close_env, english_ISO_8859_1_stem}, + {"en", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"eng", ENC_ISO_8859_1, english_ISO_8859_1_create_env, english_ISO_8859_1_close_env, english_ISO_8859_1_stem}, + {"eng", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"english", ENC_ISO_8859_1, english_ISO_8859_1_create_env, english_ISO_8859_1_close_env, english_ISO_8859_1_stem}, + {"english", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"eo", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"epo", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"es", ENC_ISO_8859_1, spanish_ISO_8859_1_create_env, spanish_ISO_8859_1_close_env, spanish_ISO_8859_1_stem}, + {"es", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"esl", ENC_ISO_8859_1, spanish_ISO_8859_1_create_env, spanish_ISO_8859_1_close_env, spanish_ISO_8859_1_stem}, + {"esl", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"esperanto", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"est", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"estonian", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"et", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"eu", ENC_ISO_8859_1, basque_ISO_8859_1_create_env, basque_ISO_8859_1_close_env, basque_ISO_8859_1_stem}, + {"eu", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"eus", ENC_ISO_8859_1, basque_ISO_8859_1_create_env, basque_ISO_8859_1_close_env, basque_ISO_8859_1_stem}, + {"eus", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"fi", ENC_ISO_8859_1, finnish_ISO_8859_1_create_env, finnish_ISO_8859_1_close_env, finnish_ISO_8859_1_stem}, + {"fi", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"fin", ENC_ISO_8859_1, finnish_ISO_8859_1_create_env, finnish_ISO_8859_1_close_env, finnish_ISO_8859_1_stem}, + {"fin", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"finnish", ENC_ISO_8859_1, finnish_ISO_8859_1_create_env, finnish_ISO_8859_1_close_env, finnish_ISO_8859_1_stem}, + {"finnish", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"fr", ENC_ISO_8859_1, french_ISO_8859_1_create_env, french_ISO_8859_1_close_env, french_ISO_8859_1_stem}, + {"fr", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"fra", ENC_ISO_8859_1, french_ISO_8859_1_create_env, french_ISO_8859_1_close_env, french_ISO_8859_1_stem}, + {"fra", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"fre", ENC_ISO_8859_1, french_ISO_8859_1_create_env, french_ISO_8859_1_close_env, french_ISO_8859_1_stem}, + {"fre", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"french", ENC_ISO_8859_1, french_ISO_8859_1_create_env, french_ISO_8859_1_close_env, french_ISO_8859_1_stem}, + {"french", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"ga", ENC_ISO_8859_1, irish_ISO_8859_1_create_env, irish_ISO_8859_1_close_env, irish_ISO_8859_1_stem}, + {"ga", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"ger", ENC_ISO_8859_1, german_ISO_8859_1_create_env, german_ISO_8859_1_close_env, german_ISO_8859_1_stem}, + {"ger", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"german", ENC_ISO_8859_1, german_ISO_8859_1_create_env, german_ISO_8859_1_close_env, german_ISO_8859_1_stem}, + {"german", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"gle", ENC_ISO_8859_1, irish_ISO_8859_1_create_env, irish_ISO_8859_1_close_env, irish_ISO_8859_1_stem}, + {"gle", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"gre", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"greek", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"hi", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hin", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hindi", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hu", ENC_ISO_8859_2, hungarian_ISO_8859_2_create_env, hungarian_ISO_8859_2_close_env, hungarian_ISO_8859_2_stem}, + {"hu", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hun", ENC_ISO_8859_2, hungarian_ISO_8859_2_create_env, hungarian_ISO_8859_2_close_env, hungarian_ISO_8859_2_stem}, + {"hun", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hungarian", ENC_ISO_8859_2, hungarian_ISO_8859_2_create_env, hungarian_ISO_8859_2_close_env, hungarian_ISO_8859_2_stem}, + {"hungarian", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hy", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"hye", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"id", ENC_ISO_8859_1, indonesian_ISO_8859_1_create_env, indonesian_ISO_8859_1_close_env, indonesian_ISO_8859_1_stem}, + {"id", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"ind", ENC_ISO_8859_1, indonesian_ISO_8859_1_create_env, indonesian_ISO_8859_1_close_env, indonesian_ISO_8859_1_stem}, + {"ind", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"indonesian", ENC_ISO_8859_1, indonesian_ISO_8859_1_create_env, indonesian_ISO_8859_1_close_env, indonesian_ISO_8859_1_stem}, + {"indonesian", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"irish", ENC_ISO_8859_1, irish_ISO_8859_1_create_env, irish_ISO_8859_1_close_env, irish_ISO_8859_1_stem}, + {"irish", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"it", ENC_ISO_8859_1, italian_ISO_8859_1_create_env, italian_ISO_8859_1_close_env, italian_ISO_8859_1_stem}, + {"it", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"ita", ENC_ISO_8859_1, italian_ISO_8859_1_create_env, italian_ISO_8859_1_close_env, italian_ISO_8859_1_stem}, + {"ita", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"italian", ENC_ISO_8859_1, italian_ISO_8859_1_create_env, italian_ISO_8859_1_close_env, italian_ISO_8859_1_stem}, + {"italian", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"kraaij_pohlmann", ENC_ISO_8859_1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"kraaij_pohlmann", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"lit", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"lithuanian", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"lt", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"ne", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nep", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nepali", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nl", ENC_ISO_8859_1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"nl", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"nld", ENC_ISO_8859_1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"nld", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"no", ENC_ISO_8859_1, norwegian_ISO_8859_1_create_env, norwegian_ISO_8859_1_close_env, norwegian_ISO_8859_1_stem}, + {"no", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"nor", ENC_ISO_8859_1, norwegian_ISO_8859_1_create_env, norwegian_ISO_8859_1_close_env, norwegian_ISO_8859_1_stem}, + {"nor", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"norwegian", ENC_ISO_8859_1, norwegian_ISO_8859_1_create_env, norwegian_ISO_8859_1_close_env, norwegian_ISO_8859_1_stem}, + {"norwegian", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"por", ENC_ISO_8859_1, portuguese_ISO_8859_1_create_env, portuguese_ISO_8859_1_close_env, portuguese_ISO_8859_1_stem}, + {"por", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"porter", ENC_ISO_8859_1, porter_ISO_8859_1_create_env, porter_ISO_8859_1_close_env, porter_ISO_8859_1_stem}, + {"porter", ENC_UTF_8, porter_UTF_8_create_env, porter_UTF_8_close_env, porter_UTF_8_stem}, + {"portuguese", ENC_ISO_8859_1, portuguese_ISO_8859_1_create_env, portuguese_ISO_8859_1_close_env, portuguese_ISO_8859_1_stem}, + {"portuguese", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"pt", ENC_ISO_8859_1, portuguese_ISO_8859_1_create_env, portuguese_ISO_8859_1_close_env, portuguese_ISO_8859_1_stem}, + {"pt", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"ro", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"romanian", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"ron", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"ru", ENC_KOI8_R, russian_KOI8_R_create_env, russian_KOI8_R_close_env, russian_KOI8_R_stem}, + {"ru", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"rum", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"rus", ENC_KOI8_R, russian_KOI8_R_create_env, russian_KOI8_R_close_env, russian_KOI8_R_stem}, + {"rus", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"russian", ENC_KOI8_R, russian_KOI8_R_create_env, russian_KOI8_R_close_env, russian_KOI8_R_stem}, + {"russian", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"serbian", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"spa", ENC_ISO_8859_1, spanish_ISO_8859_1_create_env, spanish_ISO_8859_1_close_env, spanish_ISO_8859_1_stem}, + {"spa", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"spanish", ENC_ISO_8859_1, spanish_ISO_8859_1_create_env, spanish_ISO_8859_1_close_env, spanish_ISO_8859_1_stem}, + {"spanish", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"sr", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"srp", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"sv", ENC_ISO_8859_1, swedish_ISO_8859_1_create_env, swedish_ISO_8859_1_close_env, swedish_ISO_8859_1_stem}, + {"sv", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"swe", ENC_ISO_8859_1, swedish_ISO_8859_1_create_env, swedish_ISO_8859_1_close_env, swedish_ISO_8859_1_stem}, + {"swe", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"swedish", ENC_ISO_8859_1, swedish_ISO_8859_1_create_env, swedish_ISO_8859_1_close_env, swedish_ISO_8859_1_stem}, + {"swedish", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"ta", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tam", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tamil", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tr", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"tur", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"turkish", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"yi", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {"yid", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {"yiddish", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {0,ENC_UNKNOWN,0,0,0} +}; +static const char * algorithm_names[] = { + "arabic", + "armenian", + "basque", + "catalan", + "danish", + "dutch", + "dutch_porter", + "english", + "esperanto", + "estonian", + "finnish", + "french", + "german", + "greek", + "hindi", + "hungarian", + "indonesian", + "irish", + "italian", + "lithuanian", + "nepali", + "norwegian", + "porter", + "portuguese", + "romanian", + "russian", + "serbian", + "spanish", + "swedish", + "tamil", + "turkish", + "yiddish", + 0 +}; diff --git a/contrib/libs/snowball/libstemmer/modules.txt b/contrib/libs/snowball/libstemmer/modules.txt new file mode 100644 index 000000000000..d58c5852854d --- /dev/null +++ b/contrib/libs/snowball/libstemmer/modules.txt @@ -0,0 +1,66 @@ +# This file contains a list of stemmers to include in the distribution. +# The format is a set of space separated lines - on each line: +# First item is name of stemmer. +# Second item is comma separated list of character sets. +# Third item is comma separated list of names to refer to the stemmer by. +# +# Lines starting with a #, or blank lines, are ignored. + +# List all the main algorithms for each language, in UTF-8, and also with +# the most commonly used encoding. + +arabic UTF_8 arabic,ar,ara +armenian UTF_8 armenian,hy,hye,arm +basque UTF_8,ISO_8859_1 basque,eu,eus,baq +catalan UTF_8,ISO_8859_1 catalan,ca,cat +danish UTF_8,ISO_8859_1 danish,da,dan +dutch UTF_8,ISO_8859_1 dutch,nl,dut,nld,kraaij_pohlmann +english UTF_8,ISO_8859_1 english,en,eng +esperanto UTF_8 esperanto,eo,epo +estonian UTF_8 estonian,et,est +finnish UTF_8,ISO_8859_1 finnish,fi,fin +french UTF_8,ISO_8859_1 french,fr,fre,fra +german UTF_8,ISO_8859_1 german,de,ger,deu +greek UTF_8 greek,el,gre,ell +hindi UTF_8 hindi,hi,hin +hungarian UTF_8,ISO_8859_2 hungarian,hu,hun +indonesian UTF_8,ISO_8859_1 indonesian,id,ind +irish UTF_8,ISO_8859_1 irish,ga,gle +italian UTF_8,ISO_8859_1 italian,it,ita +lithuanian UTF_8 lithuanian,lt,lit +nepali UTF_8 nepali,ne,nep +norwegian UTF_8,ISO_8859_1 norwegian,no,nor +portuguese UTF_8,ISO_8859_1 portuguese,pt,por +romanian UTF_8 romanian,ro,rum,ron +russian UTF_8,KOI8_R russian,ru,rus +serbian UTF_8 serbian,sr,srp +spanish UTF_8,ISO_8859_1 spanish,es,esl,spa +swedish UTF_8,ISO_8859_1 swedish,sv,swe +tamil UTF_8 tamil,ta,tam +turkish UTF_8 turkish,tr,tur +yiddish UTF_8 yiddish,yi,yid + +# Also include the traditional porter algorithm for english. +# The porter algorithm is included in the libstemmer distribution to assist +# with backwards compatibility, but for new systems the english algorithm +# should be used in preference. +porter UTF_8,ISO_8859_1 porter english + +# This is Martin Porter's Dutch stemmer. It was the default Dutch stemming +# in Snowball 2.2.0 and earlier, but after user feedback and careful evaluation +# we concluded that the Kraaij-Pohlmann Dutch stemmer was a better default. +# We still provide this to help people who have a lot of existing data indexed +# using it. +dutch_porter UTF_8,ISO_8859_1 dutch_porter dutch + +# Some other stemmers in the snowball project are not included in the standard +# distribution. To compile a libstemmer with them in, add them to this list, +# and regenerate the distribution. (You will need a full source checkout for +# this.) They are included in the snowball website as curiosities, but are not +# intended for general use, and use of them is is not fully supported. These +# algorithms are: +# +# lovins - This is an english stemmer, but fairly outdated, and +# only really applicable to a restricted type of input text +# (keywords in academic publications). +#lovins UTF_8,ISO_8859_1 lovins english diff --git a/contrib/libs/snowball/libstemmer/modules_utf8.h b/contrib/libs/snowball/libstemmer/modules_utf8.h new file mode 100644 index 000000000000..e20dd920fe11 --- /dev/null +++ b/contrib/libs/snowball/libstemmer/modules_utf8.h @@ -0,0 +1,205 @@ +/* libstemmer/modules_utf8.h: List of stemming modules. + * + * This file is generated by mkmodules.pl from a list of module names. + * Do not edit manually. + * + * Modules included by this file are: arabic, armenian, basque, catalan, + * danish, dutch, dutch_porter, english, esperanto, estonian, finnish, french, + * german, greek, hindi, hungarian, indonesian, irish, italian, lithuanian, + * nepali, norwegian, porter, portuguese, romanian, russian, serbian, spanish, + * swedish, tamil, turkish, yiddish + */ + +#include "../src_c/stem_UTF_8_arabic.h" +#include "../src_c/stem_UTF_8_armenian.h" +#include "../src_c/stem_UTF_8_basque.h" +#include "../src_c/stem_UTF_8_catalan.h" +#include "../src_c/stem_UTF_8_danish.h" +#include "../src_c/stem_UTF_8_dutch.h" +#include "../src_c/stem_UTF_8_dutch_porter.h" +#include "../src_c/stem_UTF_8_english.h" +#include "../src_c/stem_UTF_8_esperanto.h" +#include "../src_c/stem_UTF_8_estonian.h" +#include "../src_c/stem_UTF_8_finnish.h" +#include "../src_c/stem_UTF_8_french.h" +#include "../src_c/stem_UTF_8_german.h" +#include "../src_c/stem_UTF_8_greek.h" +#include "../src_c/stem_UTF_8_hindi.h" +#include "../src_c/stem_UTF_8_hungarian.h" +#include "../src_c/stem_UTF_8_indonesian.h" +#include "../src_c/stem_UTF_8_irish.h" +#include "../src_c/stem_UTF_8_italian.h" +#include "../src_c/stem_UTF_8_lithuanian.h" +#include "../src_c/stem_UTF_8_nepali.h" +#include "../src_c/stem_UTF_8_norwegian.h" +#include "../src_c/stem_UTF_8_porter.h" +#include "../src_c/stem_UTF_8_portuguese.h" +#include "../src_c/stem_UTF_8_romanian.h" +#include "../src_c/stem_UTF_8_russian.h" +#include "../src_c/stem_UTF_8_serbian.h" +#include "../src_c/stem_UTF_8_spanish.h" +#include "../src_c/stem_UTF_8_swedish.h" +#include "../src_c/stem_UTF_8_tamil.h" +#include "../src_c/stem_UTF_8_turkish.h" +#include "../src_c/stem_UTF_8_yiddish.h" + +typedef enum { + ENC_UNKNOWN=0, + ENC_UTF_8 +} stemmer_encoding_t; + +struct stemmer_encoding { + const char * name; + stemmer_encoding_t enc; +}; +static const struct stemmer_encoding encodings[] = { + {"UTF_8", ENC_UTF_8}, + {0,ENC_UNKNOWN} +}; + +struct stemmer_modules { + const char * name; + stemmer_encoding_t enc; + struct SN_env * (*create)(void); + void (*close)(struct SN_env *); + int (*stem)(struct SN_env *); +}; +static const struct stemmer_modules modules[] = { + {"ar", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"ara", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"arabic", ENC_UTF_8, arabic_UTF_8_create_env, arabic_UTF_8_close_env, arabic_UTF_8_stem}, + {"arm", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"armenian", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"baq", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"basque", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"ca", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"cat", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"catalan", ENC_UTF_8, catalan_UTF_8_create_env, catalan_UTF_8_close_env, catalan_UTF_8_stem}, + {"da", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"dan", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"danish", ENC_UTF_8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"de", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"deu", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"dut", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"dutch", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"dutch_porter", ENC_UTF_8, dutch_porter_UTF_8_create_env, dutch_porter_UTF_8_close_env, dutch_porter_UTF_8_stem}, + {"el", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"ell", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"en", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"eng", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"english", ENC_UTF_8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"eo", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"epo", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"es", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"esl", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"esperanto", ENC_UTF_8, esperanto_UTF_8_create_env, esperanto_UTF_8_close_env, esperanto_UTF_8_stem}, + {"est", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"estonian", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"et", ENC_UTF_8, estonian_UTF_8_create_env, estonian_UTF_8_close_env, estonian_UTF_8_stem}, + {"eu", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"eus", ENC_UTF_8, basque_UTF_8_create_env, basque_UTF_8_close_env, basque_UTF_8_stem}, + {"fi", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"fin", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"finnish", ENC_UTF_8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"fr", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"fra", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"fre", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"french", ENC_UTF_8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"ga", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"ger", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"german", ENC_UTF_8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"gle", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"gre", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"greek", ENC_UTF_8, greek_UTF_8_create_env, greek_UTF_8_close_env, greek_UTF_8_stem}, + {"hi", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hin", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hindi", ENC_UTF_8, hindi_UTF_8_create_env, hindi_UTF_8_close_env, hindi_UTF_8_stem}, + {"hu", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hun", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hungarian", ENC_UTF_8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"hy", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"hye", ENC_UTF_8, armenian_UTF_8_create_env, armenian_UTF_8_close_env, armenian_UTF_8_stem}, + {"id", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"ind", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"indonesian", ENC_UTF_8, indonesian_UTF_8_create_env, indonesian_UTF_8_close_env, indonesian_UTF_8_stem}, + {"irish", ENC_UTF_8, irish_UTF_8_create_env, irish_UTF_8_close_env, irish_UTF_8_stem}, + {"it", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"ita", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"italian", ENC_UTF_8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"kraaij_pohlmann", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"lit", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"lithuanian", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"lt", ENC_UTF_8, lithuanian_UTF_8_create_env, lithuanian_UTF_8_close_env, lithuanian_UTF_8_stem}, + {"ne", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nep", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nepali", ENC_UTF_8, nepali_UTF_8_create_env, nepali_UTF_8_close_env, nepali_UTF_8_stem}, + {"nl", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"nld", ENC_UTF_8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"no", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"nor", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"norwegian", ENC_UTF_8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"por", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"porter", ENC_UTF_8, porter_UTF_8_create_env, porter_UTF_8_close_env, porter_UTF_8_stem}, + {"portuguese", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"pt", ENC_UTF_8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"ro", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"romanian", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"ron", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"ru", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"rum", ENC_UTF_8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"rus", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"russian", ENC_UTF_8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"serbian", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"spa", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"spanish", ENC_UTF_8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"sr", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"srp", ENC_UTF_8, serbian_UTF_8_create_env, serbian_UTF_8_close_env, serbian_UTF_8_stem}, + {"sv", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"swe", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"swedish", ENC_UTF_8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"ta", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tam", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tamil", ENC_UTF_8, tamil_UTF_8_create_env, tamil_UTF_8_close_env, tamil_UTF_8_stem}, + {"tr", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"tur", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"turkish", ENC_UTF_8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + {"yi", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {"yid", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {"yiddish", ENC_UTF_8, yiddish_UTF_8_create_env, yiddish_UTF_8_close_env, yiddish_UTF_8_stem}, + {0,ENC_UNKNOWN,0,0,0} +}; +static const char * algorithm_names[] = { + "arabic", + "armenian", + "basque", + "catalan", + "danish", + "dutch", + "dutch_porter", + "english", + "esperanto", + "estonian", + "finnish", + "french", + "german", + "greek", + "hindi", + "hungarian", + "indonesian", + "irish", + "italian", + "lithuanian", + "nepali", + "norwegian", + "porter", + "portuguese", + "romanian", + "russian", + "serbian", + "spanish", + "swedish", + "tamil", + "turkish", + "yiddish", + 0 +}; diff --git a/contrib/libs/snowball/runtime/api.c b/contrib/libs/snowball/runtime/api.c new file mode 100644 index 000000000000..b1d18ba82e38 --- /dev/null +++ b/contrib/libs/snowball/runtime/api.c @@ -0,0 +1,63 @@ + +#include /* for malloc, calloc, free */ +#include "header.h" + +extern struct SN_env * SN_create_env(int S_size, int I_size) +{ + static const struct SN_env default_SN_env = {}; + struct SN_env * z = (struct SN_env *) malloc(sizeof(struct SN_env)); + if (z == NULL) return NULL; + *z = default_SN_env; + z->p = create_s(); + if (z->p == NULL) goto error; + if (S_size) + { + int i; + z->S = (symbol * *) malloc(S_size * sizeof(symbol *)); + if (z->S == NULL) goto error; + + for (i = 0; i < S_size; i++) + { + z->S[i] = create_s(); + if (z->S[i] == NULL) { + S_size = i; + goto error; + } + } + } + + if (I_size) + { + z->I = (int *) calloc(I_size, sizeof(int)); + if (z->I == NULL) goto error; + } + + return z; +error: + SN_close_env(z, S_size); + return NULL; +} + +extern void SN_close_env(struct SN_env * z, int S_size) +{ + if (z == NULL) return; + if (z->S) + { + int i; + for (i = 0; i < S_size; i++) + { + lose_s(z->S[i]); + } + free(z->S); + } + free(z->I); + if (z->p) lose_s(z->p); + free(z); +} + +extern int SN_set_current(struct SN_env * z, int size, const symbol * s) +{ + int err = replace_s(z, 0, z->l, size, s, NULL); + z->c = 0; + return err; +} diff --git a/contrib/libs/snowball/runtime/api.h b/contrib/libs/snowball/runtime/api.h new file mode 100644 index 000000000000..ba9d1c14bcae --- /dev/null +++ b/contrib/libs/snowball/runtime/api.h @@ -0,0 +1,32 @@ + +typedef unsigned char symbol; + +/* Or replace 'char' above with 'short' for 16 bit characters. + + More precisely, replace 'char' with whatever type guarantees the + character width you need. Note however that sizeof(symbol) should divide + HEAD, defined in header.h as 2*sizeof(int), without remainder, otherwise + there is an alignment problem. In the unlikely event of a problem here, + consult Martin Porter. + +*/ + +struct SN_env { + symbol * p; + int c; int l; int lb; int bra; int ket; + symbol * * S; + int * I; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * SN_create_env(int S_size, int I_size); +extern void SN_close_env(struct SN_env * z, int S_size); + +extern int SN_set_current(struct SN_env * z, int size, const symbol * s); + +#ifdef __cplusplus +} +#endif diff --git a/contrib/libs/snowball/runtime/header.h b/contrib/libs/snowball/runtime/header.h new file mode 100644 index 000000000000..7f7e0eeb6674 --- /dev/null +++ b/contrib/libs/snowball/runtime/header.h @@ -0,0 +1,62 @@ + +#include "api.h" + +#define HEAD 2*sizeof(int) + +#define SIZE(p) ((int *)(p))[-1] +#define SET_SIZE(p, n) ((int *)(p))[-1] = n +#define CAPACITY(p) ((int *)(p))[-2] + +struct among +{ + /* Number of symbols in s. */ + int s_size; + /* Search string. */ + const symbol * s; + /* Delta of index to longest matching substring, or 0 if none. */ + int substring_i; + /* Result of the lookup. */ + int result; + /* Optional condition routine, or NULL if none. */ + int (* function)(struct SN_env *); +}; + +extern symbol * create_s(void); +extern void lose_s(symbol * p); + +extern int skip_utf8(const symbol * p, int c, int limit, int n); + +extern int skip_b_utf8(const symbol * p, int c, int limit, int n); + +extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int eq_s(struct SN_env * z, int s_size, const symbol * s); +extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s); +extern int eq_v(struct SN_env * z, const symbol * p); +extern int eq_v_b(struct SN_env * z, const symbol * p); + +extern int find_among(struct SN_env * z, const struct among * v, int v_size); +extern int find_among_b(struct SN_env * z, const struct among * v, int v_size); + +extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment); +extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s); +extern int slice_from_v(struct SN_env * z, const symbol * p); +extern int slice_del(struct SN_env * z); + +extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s); +extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p); + +extern symbol * slice_to(struct SN_env * z, symbol * p); +extern symbol * assign_to(struct SN_env * z, symbol * p); + +extern int len_utf8(const symbol * p); + +extern void debug(struct SN_env * z, int number, int line_count); diff --git a/contrib/libs/snowball/runtime/utilities.c b/contrib/libs/snowball/runtime/utilities.c new file mode 100644 index 000000000000..e5e3bbeaf7b6 --- /dev/null +++ b/contrib/libs/snowball/runtime/utilities.c @@ -0,0 +1,513 @@ + +#include +#include +#include + +#include "header.h" + +#define CREATE_SIZE 1 + +extern symbol * create_s(void) { + symbol * p; + void * mem = malloc(HEAD + (CREATE_SIZE + 1) * sizeof(symbol)); + if (mem == NULL) return NULL; + p = (symbol *) (HEAD + (char *) mem); + CAPACITY(p) = CREATE_SIZE; + SET_SIZE(p, 0); + return p; +} + +extern void lose_s(symbol * p) { + if (p == NULL) return; + free((char *) p - HEAD); +} + +/* + new_p = skip_utf8(p, c, l, n); skips n characters forwards from p + c. + new_p is the new position, or -1 on failure. + + -- used to implement hop and next in the utf8 case. +*/ + +extern int skip_utf8(const symbol * p, int c, int limit, int n) { + int b; + if (n < 0) return -1; + for (; n > 0; n--) { + if (c >= limit) return -1; + b = p[c++]; + if (b >= 0xC0) { /* 1100 0000 */ + while (c < limit) { + b = p[c]; + if (b >= 0xC0 || b < 0x80) break; + /* break unless b is 10------ */ + c++; + } + } + } + return c; +} + +/* + new_p = skip_b_utf8(p, c, lb, n); skips n characters backwards from p + c - 1 + new_p is the new position, or -1 on failure. + + -- used to implement hop and next in the utf8 case. +*/ + +extern int skip_b_utf8(const symbol * p, int c, int limit, int n) { + int b; + if (n < 0) return -1; + for (; n > 0; n--) { + if (c <= limit) return -1; + b = p[--c]; + if (b >= 0x80) { /* 1000 0000 */ + while (c > limit) { + b = p[c]; + if (b >= 0xC0) break; /* 1100 0000 */ + c--; + } + } + } + return c; +} + +/* Code for character groupings: utf8 cases */ + +static int get_utf8(const symbol * p, int c, int l, int * slot) { + int b0, b1, b2; + if (c >= l) return 0; + b0 = p[c++]; + if (b0 < 0xC0 || c == l) { /* 1100 0000 */ + *slot = b0; + return 1; + } + b1 = p[c++] & 0x3F; + if (b0 < 0xE0 || c == l) { /* 1110 0000 */ + *slot = (b0 & 0x1F) << 6 | b1; + return 2; + } + b2 = p[c++] & 0x3F; + if (b0 < 0xF0 || c == l) { /* 1111 0000 */ + *slot = (b0 & 0xF) << 12 | b1 << 6 | b2; + return 3; + } + *slot = (b0 & 0x7) << 18 | b1 << 12 | b2 << 6 | (p[c] & 0x3F); + return 4; +} + +static int get_b_utf8(const symbol * p, int c, int lb, int * slot) { + int a, b; + if (c <= lb) return 0; + b = p[--c]; + if (b < 0x80 || c == lb) { /* 1000 0000 */ + *slot = b; + return 1; + } + a = b & 0x3F; + b = p[--c]; + if (b >= 0xC0 || c == lb) { /* 1100 0000 */ + *slot = (b & 0x1F) << 6 | a; + return 2; + } + a |= (b & 0x3F) << 6; + b = p[--c]; + if (b >= 0xE0 || c == lb) { /* 1110 0000 */ + *slot = (b & 0xF) << 12 | a; + return 3; + } + *slot = (p[--c] & 0x7) << 18 | (b & 0x3F) << 12 | a; + return 4; +} + +extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + int w = get_utf8(z->p, z->c, z->l, & ch); + if (!w) return -1; + if (ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) + return w; + z->c += w; + } while (repeat); + return 0; +} + +extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + int w = get_b_utf8(z->p, z->c, z->lb, & ch); + if (!w) return -1; + if (ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) + return w; + z->c -= w; + } while (repeat); + return 0; +} + +extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + int w = get_utf8(z->p, z->c, z->l, & ch); + if (!w) return -1; + if (!(ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0)) + return w; + z->c += w; + } while (repeat); + return 0; +} + +extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + int w = get_b_utf8(z->p, z->c, z->lb, & ch); + if (!w) return -1; + if (!(ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0)) + return w; + z->c -= w; + } while (repeat); + return 0; +} + +/* Code for character groupings: non-utf8 cases */ + +extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + if (z->c >= z->l) return -1; + ch = z->p[z->c]; + if (ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) + return 1; + z->c++; + } while (repeat); + return 0; +} + +extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + if (z->c <= z->lb) return -1; + ch = z->p[z->c - 1]; + if (ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) + return 1; + z->c--; + } while (repeat); + return 0; +} + +extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + if (z->c >= z->l) return -1; + ch = z->p[z->c]; + if (!(ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0)) + return 1; + z->c++; + } while (repeat); + return 0; +} + +extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat) { + do { + int ch; + if (z->c <= z->lb) return -1; + ch = z->p[z->c - 1]; + if (!(ch > max || (ch -= min) < 0 || (s[ch >> 3] & (0X1 << (ch & 0X7))) == 0)) + return 1; + z->c--; + } while (repeat); + return 0; +} + +extern int eq_s(struct SN_env * z, int s_size, const symbol * s) { + if (z->l - z->c < s_size || memcmp(z->p + z->c, s, s_size * sizeof(symbol)) != 0) return 0; + z->c += s_size; return 1; +} + +extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s) { + if (z->c - z->lb < s_size || memcmp(z->p + z->c - s_size, s, s_size * sizeof(symbol)) != 0) return 0; + z->c -= s_size; return 1; +} + +extern int eq_v(struct SN_env * z, const symbol * p) { + return eq_s(z, SIZE(p), p); +} + +extern int eq_v_b(struct SN_env * z, const symbol * p) { + return eq_s_b(z, SIZE(p), p); +} + +extern int find_among(struct SN_env * z, const struct among * v, int v_size) { + + int i = 0; + int j = v_size; + + int c = z->c; int l = z->l; + const symbol * q = z->p + c; + + const struct among * w; + + int common_i = 0; + int common_j = 0; + + int first_key_inspected = 0; + + while (1) { + int k = i + ((j - i) >> 1); + int diff = 0; + int common = common_i < common_j ? common_i : common_j; /* smaller */ + w = v + k; + { + int i2; for (i2 = common; i2 < w->s_size; i2++) { + if (c + common == l) { diff = -1; break; } + diff = q[common] - w->s[i2]; + if (diff != 0) break; + common++; + } + } + if (diff < 0) { + j = k; + common_j = common; + } else { + i = k; + common_i = common; + } + if (j - i <= 1) { + if (i > 0) break; /* v->s has been inspected */ + if (j == i) break; /* only one item in v */ + + /* - but now we need to go round once more to get + v->s inspected. This looks messy, but is actually + the optimal approach. */ + + if (first_key_inspected) break; + first_key_inspected = 1; + } + } + w = v + i; + while (1) { + if (common_i >= w->s_size) { + z->c = c + w->s_size; + if (w->function == NULL) return w->result; + { + int res = w->function(z); + z->c = c + w->s_size; + if (res) return w->result; + } + } + if (!w->substring_i) return 0; + w += w->substring_i; + } +} + +/* find_among_b is for backwards processing. Same comments apply */ + +extern int find_among_b(struct SN_env * z, const struct among * v, int v_size) { + + int i = 0; + int j = v_size; + + int c = z->c; int lb = z->lb; + const symbol * q = z->p + c - 1; + + const struct among * w; + + int common_i = 0; + int common_j = 0; + + int first_key_inspected = 0; + + while (1) { + int k = i + ((j - i) >> 1); + int diff = 0; + int common = common_i < common_j ? common_i : common_j; + w = v + k; + { + int i2; for (i2 = w->s_size - 1 - common; i2 >= 0; i2--) { + if (c - common == lb) { diff = -1; break; } + diff = q[- common] - w->s[i2]; + if (diff != 0) break; + common++; + } + } + if (diff < 0) { j = k; common_j = common; } + else { i = k; common_i = common; } + if (j - i <= 1) { + if (i > 0) break; + if (j == i) break; + if (first_key_inspected) break; + first_key_inspected = 1; + } + } + w = v + i; + while (1) { + if (common_i >= w->s_size) { + z->c = c - w->s_size; + if (w->function == NULL) return w->result; + { + int res = w->function(z); + z->c = c - w->s_size; + if (res) return w->result; + } + } + if (!w->substring_i) return 0; + w += w->substring_i; + } +} + + +/* Increase the size of the buffer pointed to by p to at least n symbols. + * If insufficient memory, returns NULL and frees the old buffer. + */ +static symbol * increase_size(symbol * p, int n) { + symbol * q; + int new_size = n + 20; + void * mem = realloc((char *) p - HEAD, + HEAD + (new_size + 1) * sizeof(symbol)); + if (mem == NULL) { + lose_s(p); + return NULL; + } + q = (symbol *) (HEAD + (char *)mem); + CAPACITY(q) = new_size; + return q; +} + +/* to replace symbols between c_bra and c_ket in z->p by the + s_size symbols at s. + Returns 0 on success, -1 on error. + Also, frees z->p (and sets it to NULL) on error. +*/ +extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjptr) +{ + int adjustment; + int len; + if (z->p == NULL) { + z->p = create_s(); + if (z->p == NULL) return -1; + } + adjustment = s_size - (c_ket - c_bra); + len = SIZE(z->p); + if (adjustment != 0) { + if (adjustment + len > CAPACITY(z->p)) { + z->p = increase_size(z->p, adjustment + len); + if (z->p == NULL) return -1; + } + memmove(z->p + c_ket + adjustment, + z->p + c_ket, + (len - c_ket) * sizeof(symbol)); + SET_SIZE(z->p, adjustment + len); + z->l += adjustment; + if (z->c >= c_ket) + z->c += adjustment; + else if (z->c > c_bra) + z->c = c_bra; + } + if (s_size) memmove(z->p + c_bra, s, s_size * sizeof(symbol)); + if (adjptr != NULL) + *adjptr = adjustment; + return 0; +} + +static int slice_check(struct SN_env * z) { + + if (z->bra < 0 || + z->bra > z->ket || + z->ket > z->l || + z->p == NULL || + z->l > SIZE(z->p)) /* this line could be removed */ + { +#if 0 + fprintf(stderr, "faulty slice operation:\n"); + debug(z, -1, 0); +#endif + return -1; + } + return 0; +} + +extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s) { + if (slice_check(z)) return -1; + return replace_s(z, z->bra, z->ket, s_size, s, NULL); +} + +extern int slice_from_v(struct SN_env * z, const symbol * p) { + return slice_from_s(z, SIZE(p), p); +} + +extern int slice_del(struct SN_env * z) { + return slice_from_s(z, 0, NULL); +} + +extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s) { + int adjustment; + if (replace_s(z, bra, ket, s_size, s, &adjustment)) + return -1; + if (bra <= z->bra) z->bra += adjustment; + if (bra <= z->ket) z->ket += adjustment; + return 0; +} + +extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p) { + return insert_s(z, bra, ket, SIZE(p), p); +} + +extern symbol * slice_to(struct SN_env * z, symbol * p) { + if (slice_check(z)) { + lose_s(p); + return NULL; + } + { + int len = z->ket - z->bra; + if (CAPACITY(p) < len) { + p = increase_size(p, len); + if (p == NULL) + return NULL; + } + memmove(p, z->p + z->bra, len * sizeof(symbol)); + SET_SIZE(p, len); + } + return p; +} + +extern symbol * assign_to(struct SN_env * z, symbol * p) { + int len = z->l; + if (CAPACITY(p) < len) { + p = increase_size(p, len); + if (p == NULL) + return NULL; + } + memmove(p, z->p, len * sizeof(symbol)); + SET_SIZE(p, len); + return p; +} + +extern int len_utf8(const symbol * p) { + int size = SIZE(p); + int len = 0; + while (size--) { + symbol b = *p++; + if (b >= 0xC0 || b < 0x80) ++len; + } + return len; +} + +#if 0 +extern void debug(struct SN_env * z, int number, int line_count) { + int i; + int limit = SIZE(z->p); + /*if (number >= 0) printf("%3d (line %4d): '", number, line_count);*/ + if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit); + for (i = 0; i <= limit; i++) { + if (z->lb == i) printf("{"); + if (z->bra == i) printf("["); + if (z->c == i) printf("|"); + if (z->ket == i) printf("]"); + if (z->l == i) printf("}"); + if (i < limit) + { int ch = z->p[i]; + if (ch == 0) ch = '#'; + printf("%c", ch); + } + } + printf("'\n"); +} +#endif diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.c new file mode 100644 index 000000000000..ca2e9bfceeea --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.c @@ -0,0 +1,1155 @@ +/* Generated from basque.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int basque_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_R1(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_adjetiboak(struct SN_env * z); +static int r_izenak(struct SN_env * z); +static int r_aditzak(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * basque_ISO_8859_1_create_env(void); +extern void basque_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[4] = { 'i', 'd', 'e', 'a' }; +static const symbol s_0_1[5] = { 'b', 'i', 'd', 'e', 'a' }; +static const symbol s_0_2[5] = { 'k', 'i', 'd', 'e', 'a' }; +static const symbol s_0_3[5] = { 'p', 'i', 'd', 'e', 'a' }; +static const symbol s_0_4[6] = { 'k', 'u', 'n', 'd', 'e', 'a' }; +static const symbol s_0_5[5] = { 'g', 'a', 'l', 'e', 'a' }; +static const symbol s_0_6[6] = { 't', 'a', 'i', 'l', 'e', 'a' }; +static const symbol s_0_7[7] = { 't', 'z', 'a', 'i', 'l', 'e', 'a' }; +static const symbol s_0_8[5] = { 'g', 'u', 'n', 'e', 'a' }; +static const symbol s_0_9[5] = { 'k', 'u', 'n', 'e', 'a' }; +static const symbol s_0_10[5] = { 't', 'z', 'a', 'g', 'a' }; +static const symbol s_0_11[4] = { 'g', 'a', 'i', 'a' }; +static const symbol s_0_12[5] = { 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_0_13[6] = { 't', 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_0_14[5] = { 'k', 'a', 'r', 'i', 'a' }; +static const symbol s_0_15[6] = { 'g', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_0_16[6] = { 'k', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_0_17[2] = { 'k', 'a' }; +static const symbol s_0_18[5] = { 't', 'z', 'a', 'k', 'a' }; +static const symbol s_0_19[2] = { 'l', 'a' }; +static const symbol s_0_20[4] = { 'm', 'e', 'n', 'a' }; +static const symbol s_0_21[4] = { 'p', 'e', 'n', 'a' }; +static const symbol s_0_22[4] = { 'k', 'i', 'n', 'a' }; +static const symbol s_0_23[5] = { 'e', 'z', 'i', 'n', 'a' }; +static const symbol s_0_24[6] = { 't', 'e', 'z', 'i', 'n', 'a' }; +static const symbol s_0_25[4] = { 'k', 'u', 'n', 'a' }; +static const symbol s_0_26[4] = { 't', 'u', 'n', 'a' }; +static const symbol s_0_27[6] = { 'k', 'i', 'z', 'u', 'n', 'a' }; +static const symbol s_0_28[3] = { 'e', 'r', 'a' }; +static const symbol s_0_29[4] = { 'b', 'e', 'r', 'a' }; +static const symbol s_0_30[7] = { 'a', 'r', 'a', 'b', 'e', 'r', 'a' }; +static const symbol s_0_31[4] = { 'k', 'e', 'r', 'a' }; +static const symbol s_0_32[4] = { 'p', 'e', 'r', 'a' }; +static const symbol s_0_33[4] = { 'o', 'r', 'r', 'a' }; +static const symbol s_0_34[5] = { 'k', 'o', 'r', 'r', 'a' }; +static const symbol s_0_35[4] = { 'd', 'u', 'r', 'a' }; +static const symbol s_0_36[4] = { 'g', 'u', 'r', 'a' }; +static const symbol s_0_37[4] = { 'k', 'u', 'r', 'a' }; +static const symbol s_0_38[4] = { 't', 'u', 'r', 'a' }; +static const symbol s_0_39[3] = { 'e', 't', 'a' }; +static const symbol s_0_40[4] = { 'k', 'e', 't', 'a' }; +static const symbol s_0_41[6] = { 'g', 'a', 'i', 'l', 'u', 'a' }; +static const symbol s_0_42[3] = { 'e', 'z', 'a' }; +static const symbol s_0_43[6] = { 'e', 'r', 'r', 'e', 'z', 'a' }; +static const symbol s_0_44[3] = { 't', 'z', 'a' }; +static const symbol s_0_45[6] = { 'g', 'a', 'i', 't', 'z', 'a' }; +static const symbol s_0_46[6] = { 'k', 'a', 'i', 't', 'z', 'a' }; +static const symbol s_0_47[6] = { 'k', 'u', 'n', 't', 'z', 'a' }; +static const symbol s_0_48[3] = { 'i', 'd', 'e' }; +static const symbol s_0_49[4] = { 'b', 'i', 'd', 'e' }; +static const symbol s_0_50[4] = { 'k', 'i', 'd', 'e' }; +static const symbol s_0_51[4] = { 'p', 'i', 'd', 'e' }; +static const symbol s_0_52[5] = { 'k', 'u', 'n', 'd', 'e' }; +static const symbol s_0_53[5] = { 't', 'z', 'a', 'k', 'e' }; +static const symbol s_0_54[5] = { 't', 'z', 'e', 'k', 'e' }; +static const symbol s_0_55[2] = { 'l', 'e' }; +static const symbol s_0_56[4] = { 'g', 'a', 'l', 'e' }; +static const symbol s_0_57[5] = { 't', 'a', 'i', 'l', 'e' }; +static const symbol s_0_58[6] = { 't', 'z', 'a', 'i', 'l', 'e' }; +static const symbol s_0_59[4] = { 'g', 'u', 'n', 'e' }; +static const symbol s_0_60[4] = { 'k', 'u', 'n', 'e' }; +static const symbol s_0_61[3] = { 't', 'z', 'e' }; +static const symbol s_0_62[4] = { 'a', 't', 'z', 'e' }; +static const symbol s_0_63[3] = { 'g', 'a', 'i' }; +static const symbol s_0_64[4] = { 'a', 'l', 'd', 'i' }; +static const symbol s_0_65[5] = { 't', 'a', 'l', 'd', 'i' }; +static const symbol s_0_66[2] = { 'k', 'i' }; +static const symbol s_0_67[3] = { 'a', 'r', 'i' }; +static const symbol s_0_68[4] = { 'k', 'a', 'r', 'i' }; +static const symbol s_0_69[4] = { 'l', 'a', 'r', 'i' }; +static const symbol s_0_70[4] = { 't', 'a', 'r', 'i' }; +static const symbol s_0_71[5] = { 'e', 't', 'a', 'r', 'i' }; +static const symbol s_0_72[5] = { 'g', 'a', 'r', 'r', 'i' }; +static const symbol s_0_73[5] = { 'k', 'a', 'r', 'r', 'i' }; +static const symbol s_0_74[5] = { 'a', 'r', 'a', 'z', 'i' }; +static const symbol s_0_75[6] = { 't', 'a', 'r', 'a', 'z', 'i' }; +static const symbol s_0_76[2] = { 'a', 'n' }; +static const symbol s_0_77[3] = { 'e', 'a', 'n' }; +static const symbol s_0_78[4] = { 'r', 'e', 'a', 'n' }; +static const symbol s_0_79[3] = { 'k', 'a', 'n' }; +static const symbol s_0_80[4] = { 'e', 't', 'a', 'n' }; +static const symbol s_0_81[7] = { 'a', 't', 's', 'e', 'd', 'e', 'n' }; +static const symbol s_0_82[3] = { 'm', 'e', 'n' }; +static const symbol s_0_83[3] = { 'p', 'e', 'n' }; +static const symbol s_0_84[3] = { 'k', 'i', 'n' }; +static const symbol s_0_85[5] = { 'r', 'e', 'k', 'i', 'n' }; +static const symbol s_0_86[4] = { 'e', 'z', 'i', 'n' }; +static const symbol s_0_87[5] = { 't', 'e', 'z', 'i', 'n' }; +static const symbol s_0_88[3] = { 't', 'u', 'n' }; +static const symbol s_0_89[5] = { 'k', 'i', 'z', 'u', 'n' }; +static const symbol s_0_90[2] = { 'g', 'o' }; +static const symbol s_0_91[3] = { 'a', 'g', 'o' }; +static const symbol s_0_92[3] = { 't', 'i', 'o' }; +static const symbol s_0_93[4] = { 'd', 'a', 'k', 'o' }; +static const symbol s_0_94[2] = { 'o', 'r' }; +static const symbol s_0_95[3] = { 'k', 'o', 'r' }; +static const symbol s_0_96[4] = { 't', 'z', 'a', 't' }; +static const symbol s_0_97[2] = { 'd', 'u' }; +static const symbol s_0_98[5] = { 'g', 'a', 'i', 'l', 'u' }; +static const symbol s_0_99[2] = { 't', 'u' }; +static const symbol s_0_100[3] = { 'a', 't', 'u' }; +static const symbol s_0_101[6] = { 'a', 'l', 'd', 'a', 't', 'u' }; +static const symbol s_0_102[4] = { 't', 'a', 't', 'u' }; +static const symbol s_0_103[6] = { 'b', 'a', 'd', 'i', 't', 'u' }; +static const symbol s_0_104[2] = { 'e', 'z' }; +static const symbol s_0_105[5] = { 'e', 'r', 'r', 'e', 'z' }; +static const symbol s_0_106[4] = { 't', 'z', 'e', 'z' }; +static const symbol s_0_107[5] = { 'g', 'a', 'i', 't', 'z' }; +static const symbol s_0_108[5] = { 'k', 'a', 'i', 't', 'z' }; +static const struct among a_0[109] = { +{ 4, s_0_0, 0, 1, 0}, +{ 5, s_0_1, -1, 1, 0}, +{ 5, s_0_2, -2, 1, 0}, +{ 5, s_0_3, -3, 1, 0}, +{ 6, s_0_4, 0, 1, 0}, +{ 5, s_0_5, 0, 1, 0}, +{ 6, s_0_6, 0, 1, 0}, +{ 7, s_0_7, 0, 1, 0}, +{ 5, s_0_8, 0, 1, 0}, +{ 5, s_0_9, 0, 1, 0}, +{ 5, s_0_10, 0, 1, 0}, +{ 4, s_0_11, 0, 1, 0}, +{ 5, s_0_12, 0, 1, 0}, +{ 6, s_0_13, -1, 1, 0}, +{ 5, s_0_14, 0, 1, 0}, +{ 6, s_0_15, 0, 2, 0}, +{ 6, s_0_16, 0, 1, 0}, +{ 2, s_0_17, 0, 1, 0}, +{ 5, s_0_18, -1, 1, 0}, +{ 2, s_0_19, 0, 1, 0}, +{ 4, s_0_20, 0, 1, 0}, +{ 4, s_0_21, 0, 1, 0}, +{ 4, s_0_22, 0, 1, 0}, +{ 5, s_0_23, 0, 1, 0}, +{ 6, s_0_24, -1, 1, 0}, +{ 4, s_0_25, 0, 1, 0}, +{ 4, s_0_26, 0, 1, 0}, +{ 6, s_0_27, 0, 1, 0}, +{ 3, s_0_28, 0, 1, 0}, +{ 4, s_0_29, -1, 1, 0}, +{ 7, s_0_30, -1, -1, 0}, +{ 4, s_0_31, -3, 1, 0}, +{ 4, s_0_32, -4, 1, 0}, +{ 4, s_0_33, 0, 1, 0}, +{ 5, s_0_34, -1, 1, 0}, +{ 4, s_0_35, 0, 1, 0}, +{ 4, s_0_36, 0, 1, 0}, +{ 4, s_0_37, 0, 1, 0}, +{ 4, s_0_38, 0, 1, 0}, +{ 3, s_0_39, 0, 1, 0}, +{ 4, s_0_40, -1, 1, 0}, +{ 6, s_0_41, 0, 1, 0}, +{ 3, s_0_42, 0, 1, 0}, +{ 6, s_0_43, -1, 1, 0}, +{ 3, s_0_44, 0, 2, 0}, +{ 6, s_0_45, -1, 1, 0}, +{ 6, s_0_46, -2, 1, 0}, +{ 6, s_0_47, -3, 1, 0}, +{ 3, s_0_48, 0, 1, 0}, +{ 4, s_0_49, -1, 1, 0}, +{ 4, s_0_50, -2, 1, 0}, +{ 4, s_0_51, -3, 1, 0}, +{ 5, s_0_52, 0, 1, 0}, +{ 5, s_0_53, 0, 1, 0}, +{ 5, s_0_54, 0, 1, 0}, +{ 2, s_0_55, 0, 1, 0}, +{ 4, s_0_56, -1, 1, 0}, +{ 5, s_0_57, -2, 1, 0}, +{ 6, s_0_58, -3, 1, 0}, +{ 4, s_0_59, 0, 1, 0}, +{ 4, s_0_60, 0, 1, 0}, +{ 3, s_0_61, 0, 1, 0}, +{ 4, s_0_62, -1, 1, 0}, +{ 3, s_0_63, 0, 1, 0}, +{ 4, s_0_64, 0, 1, 0}, +{ 5, s_0_65, -1, 1, 0}, +{ 2, s_0_66, 0, 1, 0}, +{ 3, s_0_67, 0, 1, 0}, +{ 4, s_0_68, -1, 1, 0}, +{ 4, s_0_69, -2, 1, 0}, +{ 4, s_0_70, -3, 1, 0}, +{ 5, s_0_71, -1, 1, 0}, +{ 5, s_0_72, 0, 2, 0}, +{ 5, s_0_73, 0, 1, 0}, +{ 5, s_0_74, 0, 1, 0}, +{ 6, s_0_75, -1, 1, 0}, +{ 2, s_0_76, 0, 1, 0}, +{ 3, s_0_77, -1, 1, 0}, +{ 4, s_0_78, -1, 1, 0}, +{ 3, s_0_79, -3, 1, 0}, +{ 4, s_0_80, -4, 1, 0}, +{ 7, s_0_81, 0, -1, 0}, +{ 3, s_0_82, 0, 1, 0}, +{ 3, s_0_83, 0, 1, 0}, +{ 3, s_0_84, 0, 1, 0}, +{ 5, s_0_85, -1, 1, 0}, +{ 4, s_0_86, 0, 1, 0}, +{ 5, s_0_87, -1, 1, 0}, +{ 3, s_0_88, 0, 1, 0}, +{ 5, s_0_89, 0, 1, 0}, +{ 2, s_0_90, 0, 1, 0}, +{ 3, s_0_91, -1, 1, 0}, +{ 3, s_0_92, 0, 1, 0}, +{ 4, s_0_93, 0, 1, 0}, +{ 2, s_0_94, 0, 1, 0}, +{ 3, s_0_95, -1, 1, 0}, +{ 4, s_0_96, 0, 1, 0}, +{ 2, s_0_97, 0, 1, 0}, +{ 5, s_0_98, 0, 1, 0}, +{ 2, s_0_99, 0, 1, 0}, +{ 3, s_0_100, -1, 1, 0}, +{ 6, s_0_101, -1, 1, 0}, +{ 4, s_0_102, -2, 1, 0}, +{ 6, s_0_103, -4, -1, 0}, +{ 2, s_0_104, 0, 1, 0}, +{ 5, s_0_105, -1, 1, 0}, +{ 4, s_0_106, -2, 1, 0}, +{ 5, s_0_107, 0, 1, 0}, +{ 5, s_0_108, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'a', 'd', 'a' }; +static const symbol s_1_1[4] = { 'k', 'a', 'd', 'a' }; +static const symbol s_1_2[4] = { 'a', 'n', 'd', 'a' }; +static const symbol s_1_3[5] = { 'd', 'e', 'n', 'd', 'a' }; +static const symbol s_1_4[5] = { 'g', 'a', 'b', 'e', 'a' }; +static const symbol s_1_5[5] = { 'k', 'a', 'b', 'e', 'a' }; +static const symbol s_1_6[5] = { 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_7[6] = { 'k', 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_8[6] = { 't', 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_9[5] = { 'o', 'r', 'd', 'e', 'a' }; +static const symbol s_1_10[5] = { 'z', 'a', 'l', 'e', 'a' }; +static const symbol s_1_11[6] = { 't', 'z', 'a', 'l', 'e', 'a' }; +static const symbol s_1_12[5] = { 'g', 'i', 'l', 'e', 'a' }; +static const symbol s_1_13[4] = { 'e', 'm', 'e', 'a' }; +static const symbol s_1_14[5] = { 'k', 'u', 'm', 'e', 'a' }; +static const symbol s_1_15[3] = { 'n', 'e', 'a' }; +static const symbol s_1_16[4] = { 'e', 'n', 'e', 'a' }; +static const symbol s_1_17[6] = { 'z', 'i', 'o', 'n', 'e', 'a' }; +static const symbol s_1_18[4] = { 'u', 'n', 'e', 'a' }; +static const symbol s_1_19[5] = { 'g', 'u', 'n', 'e', 'a' }; +static const symbol s_1_20[3] = { 'p', 'e', 'a' }; +static const symbol s_1_21[6] = { 'a', 'u', 'r', 'r', 'e', 'a' }; +static const symbol s_1_22[3] = { 't', 'e', 'a' }; +static const symbol s_1_23[5] = { 'k', 'o', 't', 'e', 'a' }; +static const symbol s_1_24[5] = { 'a', 'r', 't', 'e', 'a' }; +static const symbol s_1_25[5] = { 'o', 's', 't', 'e', 'a' }; +static const symbol s_1_26[5] = { 'e', 't', 'x', 'e', 'a' }; +static const symbol s_1_27[2] = { 'g', 'a' }; +static const symbol s_1_28[4] = { 'a', 'n', 'g', 'a' }; +static const symbol s_1_29[4] = { 'g', 'a', 'i', 'a' }; +static const symbol s_1_30[5] = { 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_1_31[6] = { 't', 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_1_32[6] = { 'h', 'a', 'n', 'd', 'i', 'a' }; +static const symbol s_1_33[6] = { 'm', 'e', 'n', 'd', 'i', 'a' }; +static const symbol s_1_34[4] = { 'g', 'e', 'i', 'a' }; +static const symbol s_1_35[4] = { 'e', 'g', 'i', 'a' }; +static const symbol s_1_36[5] = { 'd', 'e', 'g', 'i', 'a' }; +static const symbol s_1_37[5] = { 't', 'e', 'g', 'i', 'a' }; +static const symbol s_1_38[5] = { 'n', 'a', 'h', 'i', 'a' }; +static const symbol s_1_39[4] = { 'o', 'h', 'i', 'a' }; +static const symbol s_1_40[3] = { 'k', 'i', 'a' }; +static const symbol s_1_41[5] = { 't', 'o', 'k', 'i', 'a' }; +static const symbol s_1_42[3] = { 'o', 'i', 'a' }; +static const symbol s_1_43[4] = { 'k', 'o', 'i', 'a' }; +static const symbol s_1_44[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_1_45[5] = { 'k', 'a', 'r', 'i', 'a' }; +static const symbol s_1_46[5] = { 'l', 'a', 'r', 'i', 'a' }; +static const symbol s_1_47[5] = { 't', 'a', 'r', 'i', 'a' }; +static const symbol s_1_48[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_1_49[5] = { 'k', 'e', 'r', 'i', 'a' }; +static const symbol s_1_50[5] = { 't', 'e', 'r', 'i', 'a' }; +static const symbol s_1_51[6] = { 'g', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_1_52[6] = { 'l', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_1_53[6] = { 'k', 'i', 'r', 'r', 'i', 'a' }; +static const symbol s_1_54[5] = { 'd', 'u', 'r', 'i', 'a' }; +static const symbol s_1_55[4] = { 'a', 's', 'i', 'a' }; +static const symbol s_1_56[3] = { 't', 'i', 'a' }; +static const symbol s_1_57[4] = { 'e', 'z', 'i', 'a' }; +static const symbol s_1_58[5] = { 'b', 'i', 'z', 'i', 'a' }; +static const symbol s_1_59[6] = { 'o', 'n', 't', 'z', 'i', 'a' }; +static const symbol s_1_60[2] = { 'k', 'a' }; +static const symbol s_1_61[4] = { 'j', 'o', 'k', 'a' }; +static const symbol s_1_62[5] = { 'a', 'u', 'r', 'k', 'a' }; +static const symbol s_1_63[3] = { 's', 'k', 'a' }; +static const symbol s_1_64[3] = { 'x', 'k', 'a' }; +static const symbol s_1_65[3] = { 'z', 'k', 'a' }; +static const symbol s_1_66[6] = { 'g', 'i', 'b', 'e', 'l', 'a' }; +static const symbol s_1_67[4] = { 'g', 'e', 'l', 'a' }; +static const symbol s_1_68[5] = { 'k', 'a', 'i', 'l', 'a' }; +static const symbol s_1_69[5] = { 's', 'k', 'i', 'l', 'a' }; +static const symbol s_1_70[4] = { 't', 'i', 'l', 'a' }; +static const symbol s_1_71[3] = { 'o', 'l', 'a' }; +static const symbol s_1_72[2] = { 'n', 'a' }; +static const symbol s_1_73[4] = { 'k', 'a', 'n', 'a' }; +static const symbol s_1_74[3] = { 'e', 'n', 'a' }; +static const symbol s_1_75[7] = { 'g', 'a', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_76[7] = { 'g', 'e', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_77[6] = { 'u', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_78[5] = { 'z', 'a', 'i', 'n', 'a' }; +static const symbol s_1_79[6] = { 't', 'z', 'a', 'i', 'n', 'a' }; +static const symbol s_1_80[4] = { 'k', 'i', 'n', 'a' }; +static const symbol s_1_81[4] = { 'm', 'i', 'n', 'a' }; +static const symbol s_1_82[5] = { 'g', 'a', 'r', 'n', 'a' }; +static const symbol s_1_83[3] = { 'u', 'n', 'a' }; +static const symbol s_1_84[4] = { 'd', 'u', 'n', 'a' }; +static const symbol s_1_85[5] = { 'a', 's', 'u', 'n', 'a' }; +static const symbol s_1_86[6] = { 't', 'a', 's', 'u', 'n', 'a' }; +static const symbol s_1_87[5] = { 'o', 'n', 'd', 'o', 'a' }; +static const symbol s_1_88[6] = { 'k', 'o', 'n', 'd', 'o', 'a' }; +static const symbol s_1_89[4] = { 'n', 'g', 'o', 'a' }; +static const symbol s_1_90[4] = { 'z', 'i', 'o', 'a' }; +static const symbol s_1_91[3] = { 'k', 'o', 'a' }; +static const symbol s_1_92[5] = { 't', 'a', 'k', 'o', 'a' }; +static const symbol s_1_93[4] = { 'z', 'k', 'o', 'a' }; +static const symbol s_1_94[3] = { 'n', 'o', 'a' }; +static const symbol s_1_95[5] = { 'z', 'i', 'n', 'o', 'a' }; +static const symbol s_1_96[4] = { 'a', 'r', 'o', 'a' }; +static const symbol s_1_97[5] = { 't', 'a', 'r', 'o', 'a' }; +static const symbol s_1_98[5] = { 'z', 'a', 'r', 'o', 'a' }; +static const symbol s_1_99[4] = { 'e', 'r', 'o', 'a' }; +static const symbol s_1_100[4] = { 'o', 'r', 'o', 'a' }; +static const symbol s_1_101[4] = { 'o', 's', 'o', 'a' }; +static const symbol s_1_102[3] = { 't', 'o', 'a' }; +static const symbol s_1_103[4] = { 't', 't', 'o', 'a' }; +static const symbol s_1_104[4] = { 'z', 't', 'o', 'a' }; +static const symbol s_1_105[4] = { 't', 'x', 'o', 'a' }; +static const symbol s_1_106[4] = { 't', 'z', 'o', 'a' }; +static const symbol s_1_107[3] = { 0xF1, 'o', 'a' }; +static const symbol s_1_108[2] = { 'r', 'a' }; +static const symbol s_1_109[3] = { 'a', 'r', 'a' }; +static const symbol s_1_110[4] = { 'd', 'a', 'r', 'a' }; +static const symbol s_1_111[5] = { 'l', 'i', 'a', 'r', 'a' }; +static const symbol s_1_112[5] = { 't', 'i', 'a', 'r', 'a' }; +static const symbol s_1_113[4] = { 't', 'a', 'r', 'a' }; +static const symbol s_1_114[5] = { 'e', 't', 'a', 'r', 'a' }; +static const symbol s_1_115[5] = { 't', 'z', 'a', 'r', 'a' }; +static const symbol s_1_116[4] = { 'b', 'e', 'r', 'a' }; +static const symbol s_1_117[4] = { 'k', 'e', 'r', 'a' }; +static const symbol s_1_118[4] = { 'p', 'e', 'r', 'a' }; +static const symbol s_1_119[3] = { 'o', 'r', 'a' }; +static const symbol s_1_120[6] = { 't', 'z', 'a', 'r', 'r', 'a' }; +static const symbol s_1_121[5] = { 'k', 'o', 'r', 'r', 'a' }; +static const symbol s_1_122[3] = { 't', 'r', 'a' }; +static const symbol s_1_123[2] = { 's', 'a' }; +static const symbol s_1_124[3] = { 'o', 's', 'a' }; +static const symbol s_1_125[2] = { 't', 'a' }; +static const symbol s_1_126[3] = { 'e', 't', 'a' }; +static const symbol s_1_127[4] = { 'k', 'e', 't', 'a' }; +static const symbol s_1_128[3] = { 's', 't', 'a' }; +static const symbol s_1_129[3] = { 'd', 'u', 'a' }; +static const symbol s_1_130[6] = { 'm', 'e', 'n', 'd', 'u', 'a' }; +static const symbol s_1_131[5] = { 'o', 'r', 'd', 'u', 'a' }; +static const symbol s_1_132[5] = { 'l', 'e', 'k', 'u', 'a' }; +static const symbol s_1_133[5] = { 'b', 'u', 'r', 'u', 'a' }; +static const symbol s_1_134[5] = { 'd', 'u', 'r', 'u', 'a' }; +static const symbol s_1_135[4] = { 't', 's', 'u', 'a' }; +static const symbol s_1_136[3] = { 't', 'u', 'a' }; +static const symbol s_1_137[6] = { 'm', 'e', 'n', 't', 'u', 'a' }; +static const symbol s_1_138[5] = { 'e', 's', 't', 'u', 'a' }; +static const symbol s_1_139[4] = { 't', 'x', 'u', 'a' }; +static const symbol s_1_140[3] = { 'z', 'u', 'a' }; +static const symbol s_1_141[4] = { 't', 'z', 'u', 'a' }; +static const symbol s_1_142[2] = { 'z', 'a' }; +static const symbol s_1_143[3] = { 'e', 'z', 'a' }; +static const symbol s_1_144[5] = { 'e', 'r', 'o', 'z', 'a' }; +static const symbol s_1_145[3] = { 't', 'z', 'a' }; +static const symbol s_1_146[6] = { 'k', 'o', 'i', 't', 'z', 'a' }; +static const symbol s_1_147[5] = { 'a', 'n', 't', 'z', 'a' }; +static const symbol s_1_148[6] = { 'g', 'i', 'n', 't', 'z', 'a' }; +static const symbol s_1_149[6] = { 'k', 'i', 'n', 't', 'z', 'a' }; +static const symbol s_1_150[6] = { 'k', 'u', 'n', 't', 'z', 'a' }; +static const symbol s_1_151[4] = { 'g', 'a', 'b', 'e' }; +static const symbol s_1_152[4] = { 'k', 'a', 'b', 'e' }; +static const symbol s_1_153[4] = { 'k', 'i', 'd', 'e' }; +static const symbol s_1_154[4] = { 'a', 'l', 'd', 'e' }; +static const symbol s_1_155[5] = { 'k', 'a', 'l', 'd', 'e' }; +static const symbol s_1_156[5] = { 't', 'a', 'l', 'd', 'e' }; +static const symbol s_1_157[4] = { 'o', 'r', 'd', 'e' }; +static const symbol s_1_158[2] = { 'g', 'e' }; +static const symbol s_1_159[4] = { 'z', 'a', 'l', 'e' }; +static const symbol s_1_160[5] = { 't', 'z', 'a', 'l', 'e' }; +static const symbol s_1_161[4] = { 'g', 'i', 'l', 'e' }; +static const symbol s_1_162[3] = { 'e', 'm', 'e' }; +static const symbol s_1_163[4] = { 'k', 'u', 'm', 'e' }; +static const symbol s_1_164[2] = { 'n', 'e' }; +static const symbol s_1_165[5] = { 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_1_166[3] = { 'u', 'n', 'e' }; +static const symbol s_1_167[4] = { 'g', 'u', 'n', 'e' }; +static const symbol s_1_168[2] = { 'p', 'e' }; +static const symbol s_1_169[5] = { 'a', 'u', 'r', 'r', 'e' }; +static const symbol s_1_170[2] = { 't', 'e' }; +static const symbol s_1_171[4] = { 'k', 'o', 't', 'e' }; +static const symbol s_1_172[4] = { 'a', 'r', 't', 'e' }; +static const symbol s_1_173[4] = { 'o', 's', 't', 'e' }; +static const symbol s_1_174[4] = { 'e', 't', 'x', 'e' }; +static const symbol s_1_175[3] = { 'g', 'a', 'i' }; +static const symbol s_1_176[2] = { 'd', 'i' }; +static const symbol s_1_177[4] = { 'a', 'l', 'd', 'i' }; +static const symbol s_1_178[5] = { 't', 'a', 'l', 'd', 'i' }; +static const symbol s_1_179[5] = { 'g', 'e', 'l', 'd', 'i' }; +static const symbol s_1_180[5] = { 'h', 'a', 'n', 'd', 'i' }; +static const symbol s_1_181[5] = { 'm', 'e', 'n', 'd', 'i' }; +static const symbol s_1_182[3] = { 'g', 'e', 'i' }; +static const symbol s_1_183[3] = { 'e', 'g', 'i' }; +static const symbol s_1_184[4] = { 'd', 'e', 'g', 'i' }; +static const symbol s_1_185[4] = { 't', 'e', 'g', 'i' }; +static const symbol s_1_186[4] = { 'n', 'a', 'h', 'i' }; +static const symbol s_1_187[3] = { 'o', 'h', 'i' }; +static const symbol s_1_188[2] = { 'k', 'i' }; +static const symbol s_1_189[4] = { 't', 'o', 'k', 'i' }; +static const symbol s_1_190[2] = { 'o', 'i' }; +static const symbol s_1_191[3] = { 'g', 'o', 'i' }; +static const symbol s_1_192[3] = { 'k', 'o', 'i' }; +static const symbol s_1_193[3] = { 'a', 'r', 'i' }; +static const symbol s_1_194[4] = { 'k', 'a', 'r', 'i' }; +static const symbol s_1_195[4] = { 'l', 'a', 'r', 'i' }; +static const symbol s_1_196[4] = { 't', 'a', 'r', 'i' }; +static const symbol s_1_197[5] = { 'g', 'a', 'r', 'r', 'i' }; +static const symbol s_1_198[5] = { 'l', 'a', 'r', 'r', 'i' }; +static const symbol s_1_199[5] = { 'k', 'i', 'r', 'r', 'i' }; +static const symbol s_1_200[4] = { 'd', 'u', 'r', 'i' }; +static const symbol s_1_201[3] = { 'a', 's', 'i' }; +static const symbol s_1_202[2] = { 't', 'i' }; +static const symbol s_1_203[5] = { 'o', 'n', 't', 'z', 'i' }; +static const symbol s_1_204[2] = { 0xF1, 'i' }; +static const symbol s_1_205[2] = { 'a', 'k' }; +static const symbol s_1_206[2] = { 'e', 'k' }; +static const symbol s_1_207[5] = { 't', 'a', 'r', 'i', 'k' }; +static const symbol s_1_208[5] = { 'g', 'i', 'b', 'e', 'l' }; +static const symbol s_1_209[3] = { 'a', 'i', 'l' }; +static const symbol s_1_210[4] = { 'k', 'a', 'i', 'l' }; +static const symbol s_1_211[3] = { 'k', 'a', 'n' }; +static const symbol s_1_212[3] = { 't', 'a', 'n' }; +static const symbol s_1_213[4] = { 'e', 't', 'a', 'n' }; +static const symbol s_1_214[2] = { 'e', 'n' }; +static const symbol s_1_215[3] = { 'r', 'e', 'n' }; +static const symbol s_1_216[6] = { 'g', 'a', 'r', 'r', 'e', 'n' }; +static const symbol s_1_217[6] = { 'g', 'e', 'r', 'r', 'e', 'n' }; +static const symbol s_1_218[5] = { 'u', 'r', 'r', 'e', 'n' }; +static const symbol s_1_219[3] = { 't', 'e', 'n' }; +static const symbol s_1_220[4] = { 't', 'z', 'e', 'n' }; +static const symbol s_1_221[4] = { 'z', 'a', 'i', 'n' }; +static const symbol s_1_222[5] = { 't', 'z', 'a', 'i', 'n' }; +static const symbol s_1_223[3] = { 'k', 'i', 'n' }; +static const symbol s_1_224[3] = { 'm', 'i', 'n' }; +static const symbol s_1_225[3] = { 'd', 'u', 'n' }; +static const symbol s_1_226[4] = { 'a', 's', 'u', 'n' }; +static const symbol s_1_227[5] = { 't', 'a', 's', 'u', 'n' }; +static const symbol s_1_228[5] = { 'a', 'i', 'z', 'u', 'n' }; +static const symbol s_1_229[4] = { 'o', 'n', 'd', 'o' }; +static const symbol s_1_230[5] = { 'k', 'o', 'n', 'd', 'o' }; +static const symbol s_1_231[2] = { 'g', 'o' }; +static const symbol s_1_232[3] = { 'n', 'g', 'o' }; +static const symbol s_1_233[3] = { 'z', 'i', 'o' }; +static const symbol s_1_234[2] = { 'k', 'o' }; +static const symbol s_1_235[5] = { 't', 'r', 'a', 'k', 'o' }; +static const symbol s_1_236[4] = { 't', 'a', 'k', 'o' }; +static const symbol s_1_237[5] = { 'e', 't', 'a', 'k', 'o' }; +static const symbol s_1_238[3] = { 'e', 'k', 'o' }; +static const symbol s_1_239[6] = { 't', 'a', 'r', 'i', 'k', 'o' }; +static const symbol s_1_240[3] = { 's', 'k', 'o' }; +static const symbol s_1_241[4] = { 't', 'u', 'k', 'o' }; +static const symbol s_1_242[8] = { 'm', 'i', 'n', 'u', 't', 'u', 'k', 'o' }; +static const symbol s_1_243[3] = { 'z', 'k', 'o' }; +static const symbol s_1_244[2] = { 'n', 'o' }; +static const symbol s_1_245[4] = { 'z', 'i', 'n', 'o' }; +static const symbol s_1_246[2] = { 'r', 'o' }; +static const symbol s_1_247[3] = { 'a', 'r', 'o' }; +static const symbol s_1_248[5] = { 'i', 'g', 'a', 'r', 'o' }; +static const symbol s_1_249[4] = { 't', 'a', 'r', 'o' }; +static const symbol s_1_250[4] = { 'z', 'a', 'r', 'o' }; +static const symbol s_1_251[3] = { 'e', 'r', 'o' }; +static const symbol s_1_252[4] = { 'g', 'i', 'r', 'o' }; +static const symbol s_1_253[3] = { 'o', 'r', 'o' }; +static const symbol s_1_254[3] = { 'o', 's', 'o' }; +static const symbol s_1_255[2] = { 't', 'o' }; +static const symbol s_1_256[3] = { 't', 't', 'o' }; +static const symbol s_1_257[3] = { 'z', 't', 'o' }; +static const symbol s_1_258[3] = { 't', 'x', 'o' }; +static const symbol s_1_259[3] = { 't', 'z', 'o' }; +static const symbol s_1_260[6] = { 'g', 'i', 'n', 't', 'z', 'o' }; +static const symbol s_1_261[2] = { 0xF1, 'o' }; +static const symbol s_1_262[2] = { 'z', 'p' }; +static const symbol s_1_263[2] = { 'a', 'r' }; +static const symbol s_1_264[3] = { 'd', 'a', 'r' }; +static const symbol s_1_265[5] = { 'b', 'e', 'h', 'a', 'r' }; +static const symbol s_1_266[5] = { 'z', 'e', 'h', 'a', 'r' }; +static const symbol s_1_267[4] = { 'l', 'i', 'a', 'r' }; +static const symbol s_1_268[4] = { 't', 'i', 'a', 'r' }; +static const symbol s_1_269[3] = { 't', 'a', 'r' }; +static const symbol s_1_270[4] = { 't', 'z', 'a', 'r' }; +static const symbol s_1_271[2] = { 'o', 'r' }; +static const symbol s_1_272[3] = { 'k', 'o', 'r' }; +static const symbol s_1_273[2] = { 'o', 's' }; +static const symbol s_1_274[3] = { 'k', 'e', 't' }; +static const symbol s_1_275[2] = { 'd', 'u' }; +static const symbol s_1_276[5] = { 'm', 'e', 'n', 'd', 'u' }; +static const symbol s_1_277[4] = { 'o', 'r', 'd', 'u' }; +static const symbol s_1_278[4] = { 'l', 'e', 'k', 'u' }; +static const symbol s_1_279[4] = { 'b', 'u', 'r', 'u' }; +static const symbol s_1_280[4] = { 'd', 'u', 'r', 'u' }; +static const symbol s_1_281[3] = { 't', 's', 'u' }; +static const symbol s_1_282[2] = { 't', 'u' }; +static const symbol s_1_283[4] = { 't', 'a', 't', 'u' }; +static const symbol s_1_284[5] = { 'm', 'e', 'n', 't', 'u' }; +static const symbol s_1_285[4] = { 'e', 's', 't', 'u' }; +static const symbol s_1_286[3] = { 't', 'x', 'u' }; +static const symbol s_1_287[2] = { 'z', 'u' }; +static const symbol s_1_288[3] = { 't', 'z', 'u' }; +static const symbol s_1_289[6] = { 'g', 'i', 'n', 't', 'z', 'u' }; +static const symbol s_1_290[1] = { 'z' }; +static const symbol s_1_291[2] = { 'e', 'z' }; +static const symbol s_1_292[4] = { 'e', 'r', 'o', 'z' }; +static const symbol s_1_293[2] = { 't', 'z' }; +static const symbol s_1_294[5] = { 'k', 'o', 'i', 't', 'z' }; +static const struct among a_1[295] = { +{ 3, s_1_0, 0, 1, 0}, +{ 4, s_1_1, -1, 1, 0}, +{ 4, s_1_2, 0, 1, 0}, +{ 5, s_1_3, 0, 1, 0}, +{ 5, s_1_4, 0, 1, 0}, +{ 5, s_1_5, 0, 1, 0}, +{ 5, s_1_6, 0, 1, 0}, +{ 6, s_1_7, -1, 1, 0}, +{ 6, s_1_8, -2, 1, 0}, +{ 5, s_1_9, 0, 1, 0}, +{ 5, s_1_10, 0, 1, 0}, +{ 6, s_1_11, -1, 1, 0}, +{ 5, s_1_12, 0, 1, 0}, +{ 4, s_1_13, 0, 1, 0}, +{ 5, s_1_14, 0, 1, 0}, +{ 3, s_1_15, 0, 1, 0}, +{ 4, s_1_16, -1, 1, 0}, +{ 6, s_1_17, -2, 1, 0}, +{ 4, s_1_18, -3, 1, 0}, +{ 5, s_1_19, -1, 1, 0}, +{ 3, s_1_20, 0, 1, 0}, +{ 6, s_1_21, 0, 1, 0}, +{ 3, s_1_22, 0, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 5, s_1_24, -2, 1, 0}, +{ 5, s_1_25, -3, 1, 0}, +{ 5, s_1_26, 0, 1, 0}, +{ 2, s_1_27, 0, 1, 0}, +{ 4, s_1_28, -1, 1, 0}, +{ 4, s_1_29, 0, 1, 0}, +{ 5, s_1_30, 0, 1, 0}, +{ 6, s_1_31, -1, 1, 0}, +{ 6, s_1_32, 0, 1, 0}, +{ 6, s_1_33, 0, 1, 0}, +{ 4, s_1_34, 0, 1, 0}, +{ 4, s_1_35, 0, 1, 0}, +{ 5, s_1_36, -1, 1, 0}, +{ 5, s_1_37, -2, 1, 0}, +{ 5, s_1_38, 0, 1, 0}, +{ 4, s_1_39, 0, 1, 0}, +{ 3, s_1_40, 0, 1, 0}, +{ 5, s_1_41, -1, 1, 0}, +{ 3, s_1_42, 0, 1, 0}, +{ 4, s_1_43, -1, 1, 0}, +{ 4, s_1_44, 0, 1, 0}, +{ 5, s_1_45, -1, 1, 0}, +{ 5, s_1_46, -2, 1, 0}, +{ 5, s_1_47, -3, 1, 0}, +{ 4, s_1_48, 0, 1, 0}, +{ 5, s_1_49, -1, 1, 0}, +{ 5, s_1_50, -2, 1, 0}, +{ 6, s_1_51, 0, 2, 0}, +{ 6, s_1_52, 0, 1, 0}, +{ 6, s_1_53, 0, 1, 0}, +{ 5, s_1_54, 0, 1, 0}, +{ 4, s_1_55, 0, 1, 0}, +{ 3, s_1_56, 0, 1, 0}, +{ 4, s_1_57, 0, 1, 0}, +{ 5, s_1_58, 0, 1, 0}, +{ 6, s_1_59, 0, 1, 0}, +{ 2, s_1_60, 0, 1, 0}, +{ 4, s_1_61, -1, 3, 0}, +{ 5, s_1_62, -2, -1, 0}, +{ 3, s_1_63, -3, 1, 0}, +{ 3, s_1_64, -4, 1, 0}, +{ 3, s_1_65, -5, 1, 0}, +{ 6, s_1_66, 0, 1, 0}, +{ 4, s_1_67, 0, 1, 0}, +{ 5, s_1_68, 0, 1, 0}, +{ 5, s_1_69, 0, 1, 0}, +{ 4, s_1_70, 0, 1, 0}, +{ 3, s_1_71, 0, 1, 0}, +{ 2, s_1_72, 0, 1, 0}, +{ 4, s_1_73, -1, 1, 0}, +{ 3, s_1_74, -2, 1, 0}, +{ 7, s_1_75, -1, 1, 0}, +{ 7, s_1_76, -2, 1, 0}, +{ 6, s_1_77, -3, 1, 0}, +{ 5, s_1_78, -6, 1, 0}, +{ 6, s_1_79, -1, 1, 0}, +{ 4, s_1_80, -8, 1, 0}, +{ 4, s_1_81, -9, 1, 0}, +{ 5, s_1_82, -10, 1, 0}, +{ 3, s_1_83, -11, 1, 0}, +{ 4, s_1_84, -1, 1, 0}, +{ 5, s_1_85, -2, 1, 0}, +{ 6, s_1_86, -1, 1, 0}, +{ 5, s_1_87, 0, 1, 0}, +{ 6, s_1_88, -1, 1, 0}, +{ 4, s_1_89, 0, 1, 0}, +{ 4, s_1_90, 0, 1, 0}, +{ 3, s_1_91, 0, 1, 0}, +{ 5, s_1_92, -1, 1, 0}, +{ 4, s_1_93, -2, 1, 0}, +{ 3, s_1_94, 0, 1, 0}, +{ 5, s_1_95, -1, 1, 0}, +{ 4, s_1_96, 0, 1, 0}, +{ 5, s_1_97, -1, 1, 0}, +{ 5, s_1_98, -2, 1, 0}, +{ 4, s_1_99, 0, 1, 0}, +{ 4, s_1_100, 0, 1, 0}, +{ 4, s_1_101, 0, 1, 0}, +{ 3, s_1_102, 0, 1, 0}, +{ 4, s_1_103, -1, 1, 0}, +{ 4, s_1_104, -2, 1, 0}, +{ 4, s_1_105, 0, 1, 0}, +{ 4, s_1_106, 0, 1, 0}, +{ 3, s_1_107, 0, 1, 0}, +{ 2, s_1_108, 0, 1, 0}, +{ 3, s_1_109, -1, 1, 0}, +{ 4, s_1_110, -1, 1, 0}, +{ 5, s_1_111, -2, 1, 0}, +{ 5, s_1_112, -3, 1, 0}, +{ 4, s_1_113, -4, 1, 0}, +{ 5, s_1_114, -1, 1, 0}, +{ 5, s_1_115, -6, 1, 0}, +{ 4, s_1_116, -8, 1, 0}, +{ 4, s_1_117, -9, 1, 0}, +{ 4, s_1_118, -10, 1, 0}, +{ 3, s_1_119, -11, 2, 0}, +{ 6, s_1_120, -12, 1, 0}, +{ 5, s_1_121, -13, 1, 0}, +{ 3, s_1_122, -14, 1, 0}, +{ 2, s_1_123, 0, 1, 0}, +{ 3, s_1_124, -1, 1, 0}, +{ 2, s_1_125, 0, 1, 0}, +{ 3, s_1_126, -1, 1, 0}, +{ 4, s_1_127, -1, 1, 0}, +{ 3, s_1_128, -3, 1, 0}, +{ 3, s_1_129, 0, 1, 0}, +{ 6, s_1_130, -1, 1, 0}, +{ 5, s_1_131, -2, 1, 0}, +{ 5, s_1_132, 0, 1, 0}, +{ 5, s_1_133, 0, 1, 0}, +{ 5, s_1_134, 0, 1, 0}, +{ 4, s_1_135, 0, 1, 0}, +{ 3, s_1_136, 0, 1, 0}, +{ 6, s_1_137, -1, 1, 0}, +{ 5, s_1_138, -2, 1, 0}, +{ 4, s_1_139, 0, 1, 0}, +{ 3, s_1_140, 0, 1, 0}, +{ 4, s_1_141, -1, 1, 0}, +{ 2, s_1_142, 0, 1, 0}, +{ 3, s_1_143, -1, 1, 0}, +{ 5, s_1_144, -2, 1, 0}, +{ 3, s_1_145, -3, 2, 0}, +{ 6, s_1_146, -1, 1, 0}, +{ 5, s_1_147, -2, 1, 0}, +{ 6, s_1_148, -3, 1, 0}, +{ 6, s_1_149, -4, 1, 0}, +{ 6, s_1_150, -5, 1, 0}, +{ 4, s_1_151, 0, 1, 0}, +{ 4, s_1_152, 0, 1, 0}, +{ 4, s_1_153, 0, 1, 0}, +{ 4, s_1_154, 0, 1, 0}, +{ 5, s_1_155, -1, 1, 0}, +{ 5, s_1_156, -2, 1, 0}, +{ 4, s_1_157, 0, 1, 0}, +{ 2, s_1_158, 0, 1, 0}, +{ 4, s_1_159, 0, 1, 0}, +{ 5, s_1_160, -1, 1, 0}, +{ 4, s_1_161, 0, 1, 0}, +{ 3, s_1_162, 0, 1, 0}, +{ 4, s_1_163, 0, 1, 0}, +{ 2, s_1_164, 0, 1, 0}, +{ 5, s_1_165, -1, 1, 0}, +{ 3, s_1_166, -2, 1, 0}, +{ 4, s_1_167, -1, 1, 0}, +{ 2, s_1_168, 0, 1, 0}, +{ 5, s_1_169, 0, 1, 0}, +{ 2, s_1_170, 0, 1, 0}, +{ 4, s_1_171, -1, 1, 0}, +{ 4, s_1_172, -2, 1, 0}, +{ 4, s_1_173, -3, 1, 0}, +{ 4, s_1_174, 0, 1, 0}, +{ 3, s_1_175, 0, 1, 0}, +{ 2, s_1_176, 0, 1, 0}, +{ 4, s_1_177, -1, 1, 0}, +{ 5, s_1_178, -1, 1, 0}, +{ 5, s_1_179, -3, -1, 0}, +{ 5, s_1_180, -4, 1, 0}, +{ 5, s_1_181, -5, 1, 0}, +{ 3, s_1_182, 0, 1, 0}, +{ 3, s_1_183, 0, 1, 0}, +{ 4, s_1_184, -1, 1, 0}, +{ 4, s_1_185, -2, 1, 0}, +{ 4, s_1_186, 0, 1, 0}, +{ 3, s_1_187, 0, 1, 0}, +{ 2, s_1_188, 0, 1, 0}, +{ 4, s_1_189, -1, 1, 0}, +{ 2, s_1_190, 0, 1, 0}, +{ 3, s_1_191, -1, 1, 0}, +{ 3, s_1_192, -2, 1, 0}, +{ 3, s_1_193, 0, 1, 0}, +{ 4, s_1_194, -1, 1, 0}, +{ 4, s_1_195, -2, 1, 0}, +{ 4, s_1_196, -3, 1, 0}, +{ 5, s_1_197, 0, 2, 0}, +{ 5, s_1_198, 0, 1, 0}, +{ 5, s_1_199, 0, 1, 0}, +{ 4, s_1_200, 0, 1, 0}, +{ 3, s_1_201, 0, 1, 0}, +{ 2, s_1_202, 0, 1, 0}, +{ 5, s_1_203, 0, 1, 0}, +{ 2, s_1_204, 0, 1, 0}, +{ 2, s_1_205, 0, 1, 0}, +{ 2, s_1_206, 0, 1, 0}, +{ 5, s_1_207, 0, 1, 0}, +{ 5, s_1_208, 0, 1, 0}, +{ 3, s_1_209, 0, 1, 0}, +{ 4, s_1_210, -1, 1, 0}, +{ 3, s_1_211, 0, 1, 0}, +{ 3, s_1_212, 0, 1, 0}, +{ 4, s_1_213, -1, 1, 0}, +{ 2, s_1_214, 0, 4, 0}, +{ 3, s_1_215, -1, 2, 0}, +{ 6, s_1_216, -1, 1, 0}, +{ 6, s_1_217, -2, 1, 0}, +{ 5, s_1_218, -3, 1, 0}, +{ 3, s_1_219, -5, 4, 0}, +{ 4, s_1_220, -6, 4, 0}, +{ 4, s_1_221, 0, 1, 0}, +{ 5, s_1_222, -1, 1, 0}, +{ 3, s_1_223, 0, 1, 0}, +{ 3, s_1_224, 0, 1, 0}, +{ 3, s_1_225, 0, 1, 0}, +{ 4, s_1_226, 0, 1, 0}, +{ 5, s_1_227, -1, 1, 0}, +{ 5, s_1_228, 0, 1, 0}, +{ 4, s_1_229, 0, 1, 0}, +{ 5, s_1_230, -1, 1, 0}, +{ 2, s_1_231, 0, 1, 0}, +{ 3, s_1_232, -1, 1, 0}, +{ 3, s_1_233, 0, 1, 0}, +{ 2, s_1_234, 0, 1, 0}, +{ 5, s_1_235, -1, 5, 0}, +{ 4, s_1_236, -2, 1, 0}, +{ 5, s_1_237, -1, 1, 0}, +{ 3, s_1_238, -4, 1, 0}, +{ 6, s_1_239, -5, 1, 0}, +{ 3, s_1_240, -6, 1, 0}, +{ 4, s_1_241, -7, 1, 0}, +{ 8, s_1_242, -1, 6, 0}, +{ 3, s_1_243, -9, 1, 0}, +{ 2, s_1_244, 0, 1, 0}, +{ 4, s_1_245, -1, 1, 0}, +{ 2, s_1_246, 0, 1, 0}, +{ 3, s_1_247, -1, 1, 0}, +{ 5, s_1_248, -1, -1, 0}, +{ 4, s_1_249, -2, 1, 0}, +{ 4, s_1_250, -3, 1, 0}, +{ 3, s_1_251, -5, 1, 0}, +{ 4, s_1_252, -6, 1, 0}, +{ 3, s_1_253, -7, 1, 0}, +{ 3, s_1_254, 0, 1, 0}, +{ 2, s_1_255, 0, 1, 0}, +{ 3, s_1_256, -1, 1, 0}, +{ 3, s_1_257, -2, 1, 0}, +{ 3, s_1_258, 0, 1, 0}, +{ 3, s_1_259, 0, 1, 0}, +{ 6, s_1_260, -1, 1, 0}, +{ 2, s_1_261, 0, 1, 0}, +{ 2, s_1_262, 0, 1, 0}, +{ 2, s_1_263, 0, 1, 0}, +{ 3, s_1_264, -1, 1, 0}, +{ 5, s_1_265, -2, 1, 0}, +{ 5, s_1_266, -3, -1, 0}, +{ 4, s_1_267, -4, 1, 0}, +{ 4, s_1_268, -5, 1, 0}, +{ 3, s_1_269, -6, 1, 0}, +{ 4, s_1_270, -7, 1, 0}, +{ 2, s_1_271, 0, 2, 0}, +{ 3, s_1_272, -1, 1, 0}, +{ 2, s_1_273, 0, 1, 0}, +{ 3, s_1_274, 0, 1, 0}, +{ 2, s_1_275, 0, 1, 0}, +{ 5, s_1_276, -1, 1, 0}, +{ 4, s_1_277, -2, 1, 0}, +{ 4, s_1_278, 0, 1, 0}, +{ 4, s_1_279, 0, 2, 0}, +{ 4, s_1_280, 0, 1, 0}, +{ 3, s_1_281, 0, 1, 0}, +{ 2, s_1_282, 0, 1, 0}, +{ 4, s_1_283, -1, 4, 0}, +{ 5, s_1_284, -2, 1, 0}, +{ 4, s_1_285, -3, 1, 0}, +{ 3, s_1_286, 0, 1, 0}, +{ 2, s_1_287, 0, 1, 0}, +{ 3, s_1_288, -1, 1, 0}, +{ 6, s_1_289, -1, 1, 0}, +{ 1, s_1_290, 0, 1, 0}, +{ 2, s_1_291, -1, 1, 0}, +{ 4, s_1_292, -2, 1, 0}, +{ 2, s_1_293, -3, 1, 0}, +{ 5, s_1_294, -1, 1, 0} +}; + +static const symbol s_2_0[4] = { 'z', 'l', 'e', 'a' }; +static const symbol s_2_1[5] = { 'k', 'e', 'r', 'i', 'a' }; +static const symbol s_2_2[2] = { 'l', 'a' }; +static const symbol s_2_3[3] = { 'e', 'r', 'a' }; +static const symbol s_2_4[4] = { 'd', 'a', 'd', 'e' }; +static const symbol s_2_5[4] = { 't', 'a', 'd', 'e' }; +static const symbol s_2_6[4] = { 'd', 'a', 't', 'e' }; +static const symbol s_2_7[4] = { 't', 'a', 't', 'e' }; +static const symbol s_2_8[2] = { 'g', 'i' }; +static const symbol s_2_9[2] = { 'k', 'i' }; +static const symbol s_2_10[2] = { 'i', 'k' }; +static const symbol s_2_11[5] = { 'l', 'a', 'n', 'i', 'k' }; +static const symbol s_2_12[3] = { 'r', 'i', 'k' }; +static const symbol s_2_13[5] = { 'l', 'a', 'r', 'i', 'k' }; +static const symbol s_2_14[4] = { 'z', 't', 'i', 'k' }; +static const symbol s_2_15[2] = { 'g', 'o' }; +static const symbol s_2_16[2] = { 'r', 'o' }; +static const symbol s_2_17[3] = { 'e', 'r', 'o' }; +static const symbol s_2_18[2] = { 't', 'o' }; +static const struct among a_2[19] = { +{ 4, s_2_0, 0, 2, 0}, +{ 5, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 1, 0}, +{ 3, s_2_3, 0, 1, 0}, +{ 4, s_2_4, 0, 1, 0}, +{ 4, s_2_5, 0, 1, 0}, +{ 4, s_2_6, 0, 1, 0}, +{ 4, s_2_7, 0, 1, 0}, +{ 2, s_2_8, 0, 1, 0}, +{ 2, s_2_9, 0, 1, 0}, +{ 2, s_2_10, 0, 1, 0}, +{ 5, s_2_11, -1, 1, 0}, +{ 3, s_2_12, -2, 1, 0}, +{ 5, s_2_13, -1, 1, 0}, +{ 4, s_2_14, -4, 1, 0}, +{ 2, s_2_15, 0, 1, 0}, +{ 2, s_2_16, 0, 1, 0}, +{ 3, s_2_17, -1, 1, 0}, +{ 2, s_2_18, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16 }; + +static const symbol s_0[] = { 'j', 'o', 'k' }; +static const symbol s_1[] = { 't', 'r', 'a' }; +static const symbol s_2[] = { 'm', 'i', 'n', 'u', 't', 'u' }; +static const symbol s_3[] = { 'z' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_v, 97, 117, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping(z, g_v, 97, 117, 0)) goto lab4; + { + int ret = out_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping(z, g_v, 97, 117, 0)) goto lab2; + { + int ret = in_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping(z, g_v, 97, 117, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping(z, g_v, 97, 117, 0)) goto lab6; + { + int ret = out_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping(z, g_v, 97, 117, 0)) goto lab0; + if (z->c >= z->l) goto lab0; + z->c++; + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_aditzak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((70566434 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_0, 109); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_izenak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((71162402 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 295); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_0); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_adjetiboak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((35362 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_2, 19); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int basque_ISO_8859_1_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + while (1) { + int v_1 = z->l - z->c; + { + int ret = r_aditzak(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + continue; + lab0: + z->c = z->l - v_1; + break; + } + while (1) { + int v_2 = z->l - z->c; + { + int ret = r_izenak(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + continue; + lab1: + z->c = z->l - v_2; + break; + } + { + int v_3 = z->l - z->c; + { + int ret = r_adjetiboak(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * basque_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void basque_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.h new file mode 100644 index 000000000000..c167565da993 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_basque.h @@ -0,0 +1,15 @@ +/* Generated from basque.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_ISO_8859_1_create_env(void); +extern void basque_ISO_8859_1_close_env(struct SN_env * z); + +extern int basque_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.c new file mode 100644 index 000000000000..2290f5c08593 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.c @@ -0,0 +1,1469 @@ +/* Generated from catalan.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int catalan_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_cleaning(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * catalan_ISO_8859_1_create_env(void); +extern void catalan_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xB7 }; +static const symbol s_0_2[1] = { 0xE0 }; +static const symbol s_0_3[1] = { 0xE1 }; +static const symbol s_0_4[1] = { 0xE8 }; +static const symbol s_0_5[1] = { 0xE9 }; +static const symbol s_0_6[1] = { 0xEC }; +static const symbol s_0_7[1] = { 0xED }; +static const symbol s_0_8[1] = { 0xEF }; +static const symbol s_0_9[1] = { 0xF2 }; +static const symbol s_0_10[1] = { 0xF3 }; +static const symbol s_0_11[1] = { 0xFA }; +static const symbol s_0_12[1] = { 0xFC }; +static const struct among a_0[13] = { +{ 0, 0, 0, 7, 0}, +{ 1, s_0_1, -1, 6, 0}, +{ 1, s_0_2, -2, 1, 0}, +{ 1, s_0_3, -3, 1, 0}, +{ 1, s_0_4, -4, 2, 0}, +{ 1, s_0_5, -5, 2, 0}, +{ 1, s_0_6, -6, 3, 0}, +{ 1, s_0_7, -7, 3, 0}, +{ 1, s_0_8, -8, 3, 0}, +{ 1, s_0_9, -9, 4, 0}, +{ 1, s_0_10, -10, 4, 0}, +{ 1, s_0_11, -11, 5, 0}, +{ 1, s_0_12, -12, 5, 0} +}; + +static const symbol s_1_0[2] = { 'l', 'a' }; +static const symbol s_1_1[3] = { '-', 'l', 'a' }; +static const symbol s_1_2[4] = { 's', 'e', 'l', 'a' }; +static const symbol s_1_3[2] = { 'l', 'e' }; +static const symbol s_1_4[2] = { 'm', 'e' }; +static const symbol s_1_5[3] = { '-', 'm', 'e' }; +static const symbol s_1_6[2] = { 's', 'e' }; +static const symbol s_1_7[3] = { '-', 't', 'e' }; +static const symbol s_1_8[2] = { 'h', 'i' }; +static const symbol s_1_9[3] = { '\'', 'h', 'i' }; +static const symbol s_1_10[2] = { 'l', 'i' }; +static const symbol s_1_11[3] = { '-', 'l', 'i' }; +static const symbol s_1_12[2] = { '\'', 'l' }; +static const symbol s_1_13[2] = { '\'', 'm' }; +static const symbol s_1_14[2] = { '-', 'm' }; +static const symbol s_1_15[2] = { '\'', 'n' }; +static const symbol s_1_16[2] = { '-', 'n' }; +static const symbol s_1_17[2] = { 'h', 'o' }; +static const symbol s_1_18[3] = { '\'', 'h', 'o' }; +static const symbol s_1_19[2] = { 'l', 'o' }; +static const symbol s_1_20[4] = { 's', 'e', 'l', 'o' }; +static const symbol s_1_21[2] = { '\'', 's' }; +static const symbol s_1_22[3] = { 'l', 'a', 's' }; +static const symbol s_1_23[5] = { 's', 'e', 'l', 'a', 's' }; +static const symbol s_1_24[3] = { 'l', 'e', 's' }; +static const symbol s_1_25[4] = { '-', 'l', 'e', 's' }; +static const symbol s_1_26[3] = { '\'', 'l', 's' }; +static const symbol s_1_27[3] = { '-', 'l', 's' }; +static const symbol s_1_28[3] = { '\'', 'n', 's' }; +static const symbol s_1_29[3] = { '-', 'n', 's' }; +static const symbol s_1_30[3] = { 'e', 'n', 's' }; +static const symbol s_1_31[3] = { 'l', 'o', 's' }; +static const symbol s_1_32[5] = { 's', 'e', 'l', 'o', 's' }; +static const symbol s_1_33[3] = { 'n', 'o', 's' }; +static const symbol s_1_34[4] = { '-', 'n', 'o', 's' }; +static const symbol s_1_35[3] = { 'v', 'o', 's' }; +static const symbol s_1_36[2] = { 'u', 's' }; +static const symbol s_1_37[3] = { '-', 'u', 's' }; +static const symbol s_1_38[2] = { '\'', 't' }; +static const struct among a_1[39] = { +{ 2, s_1_0, 0, 1, 0}, +{ 3, s_1_1, -1, 1, 0}, +{ 4, s_1_2, -2, 1, 0}, +{ 2, s_1_3, 0, 1, 0}, +{ 2, s_1_4, 0, 1, 0}, +{ 3, s_1_5, -1, 1, 0}, +{ 2, s_1_6, 0, 1, 0}, +{ 3, s_1_7, 0, 1, 0}, +{ 2, s_1_8, 0, 1, 0}, +{ 3, s_1_9, -1, 1, 0}, +{ 2, s_1_10, 0, 1, 0}, +{ 3, s_1_11, -1, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 2, s_1_13, 0, 1, 0}, +{ 2, s_1_14, 0, 1, 0}, +{ 2, s_1_15, 0, 1, 0}, +{ 2, s_1_16, 0, 1, 0}, +{ 2, s_1_17, 0, 1, 0}, +{ 3, s_1_18, -1, 1, 0}, +{ 2, s_1_19, 0, 1, 0}, +{ 4, s_1_20, -1, 1, 0}, +{ 2, s_1_21, 0, 1, 0}, +{ 3, s_1_22, 0, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 3, s_1_24, 0, 1, 0}, +{ 4, s_1_25, -1, 1, 0}, +{ 3, s_1_26, 0, 1, 0}, +{ 3, s_1_27, 0, 1, 0}, +{ 3, s_1_28, 0, 1, 0}, +{ 3, s_1_29, 0, 1, 0}, +{ 3, s_1_30, 0, 1, 0}, +{ 3, s_1_31, 0, 1, 0}, +{ 5, s_1_32, -1, 1, 0}, +{ 3, s_1_33, 0, 1, 0}, +{ 4, s_1_34, -1, 1, 0}, +{ 3, s_1_35, 0, 1, 0}, +{ 2, s_1_36, 0, 1, 0}, +{ 3, s_1_37, -1, 1, 0}, +{ 2, s_1_38, 0, 1, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'c', 'a' }; +static const symbol s_2_1[6] = { 'l', 0xF3, 'g', 'i', 'c', 'a' }; +static const symbol s_2_2[4] = { 'e', 'n', 'c', 'a' }; +static const symbol s_2_3[3] = { 'a', 'd', 'a' }; +static const symbol s_2_4[5] = { 'a', 'n', 'c', 'i', 'a' }; +static const symbol s_2_5[5] = { 'e', 'n', 'c', 'i', 'a' }; +static const symbol s_2_6[5] = { 0xE8, 'n', 'c', 'i', 'a' }; +static const symbol s_2_7[4] = { 0xED, 'c', 'i', 'a' }; +static const symbol s_2_8[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_2_9[4] = { 'i', 'n', 'i', 'a' }; +static const symbol s_2_10[5] = { 0xED, 'i', 'n', 'i', 'a' }; +static const symbol s_2_11[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_2_12[4] = { 0xE0, 'r', 'i', 'a' }; +static const symbol s_2_13[6] = { 'a', 't', 0xF2, 'r', 'i', 'a' }; +static const symbol s_2_14[4] = { 'a', 'l', 'l', 'a' }; +static const symbol s_2_15[4] = { 'e', 'l', 'l', 'a' }; +static const symbol s_2_16[5] = { 0xED, 'v', 'o', 'l', 'a' }; +static const symbol s_2_17[3] = { 'i', 'm', 'a' }; +static const symbol s_2_18[6] = { 0xED, 's', 's', 'i', 'm', 'a' }; +static const symbol s_2_19[8] = { 'q', 'u', 0xED, 's', 's', 'i', 'm', 'a' }; +static const symbol s_2_20[3] = { 'a', 'n', 'a' }; +static const symbol s_2_21[3] = { 'i', 'n', 'a' }; +static const symbol s_2_22[3] = { 'e', 'r', 'a' }; +static const symbol s_2_23[5] = { 's', 'f', 'e', 'r', 'a' }; +static const symbol s_2_24[3] = { 'o', 'r', 'a' }; +static const symbol s_2_25[4] = { 'd', 'o', 'r', 'a' }; +static const symbol s_2_26[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_2_27[5] = { 'a', 'd', 'u', 'r', 'a' }; +static const symbol s_2_28[3] = { 'e', 's', 'a' }; +static const symbol s_2_29[3] = { 'o', 's', 'a' }; +static const symbol s_2_30[4] = { 'a', 's', 's', 'a' }; +static const symbol s_2_31[4] = { 'e', 's', 's', 'a' }; +static const symbol s_2_32[4] = { 'i', 's', 's', 'a' }; +static const symbol s_2_33[3] = { 'e', 't', 'a' }; +static const symbol s_2_34[3] = { 'i', 't', 'a' }; +static const symbol s_2_35[3] = { 'o', 't', 'a' }; +static const symbol s_2_36[4] = { 'i', 's', 't', 'a' }; +static const symbol s_2_37[7] = { 'i', 'a', 'l', 'i', 's', 't', 'a' }; +static const symbol s_2_38[7] = { 'i', 'o', 'n', 'i', 's', 't', 'a' }; +static const symbol s_2_39[3] = { 'i', 'v', 'a' }; +static const symbol s_2_40[5] = { 'a', 't', 'i', 'v', 'a' }; +static const symbol s_2_41[3] = { 'n', 0xE7, 'a' }; +static const symbol s_2_42[5] = { 'l', 'o', 'g', 0xED, 'a' }; +static const symbol s_2_43[2] = { 'i', 'c' }; +static const symbol s_2_44[5] = { 0xED, 's', 't', 'i', 'c' }; +static const symbol s_2_45[3] = { 'e', 'n', 'c' }; +static const symbol s_2_46[3] = { 'e', 's', 'c' }; +static const symbol s_2_47[2] = { 'u', 'd' }; +static const symbol s_2_48[4] = { 'a', 't', 'g', 'e' }; +static const symbol s_2_49[3] = { 'b', 'l', 'e' }; +static const symbol s_2_50[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_2_51[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_2_52[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_2_53[7] = { 'i', 'a', 'l', 'i', 's', 'm', 'e' }; +static const symbol s_2_54[7] = { 'i', 'o', 'n', 'i', 's', 'm', 'e' }; +static const symbol s_2_55[6] = { 'i', 'v', 'i', 's', 'm', 'e' }; +static const symbol s_2_56[4] = { 'a', 'i', 'r', 'e' }; +static const symbol s_2_57[4] = { 'i', 'c', 't', 'e' }; +static const symbol s_2_58[4] = { 'i', 's', 't', 'e' }; +static const symbol s_2_59[3] = { 'i', 'c', 'i' }; +static const symbol s_2_60[3] = { 0xED, 'c', 'i' }; +static const symbol s_2_61[4] = { 'l', 'o', 'g', 'i' }; +static const symbol s_2_62[3] = { 'a', 'r', 'i' }; +static const symbol s_2_63[4] = { 't', 'o', 'r', 'i' }; +static const symbol s_2_64[2] = { 'a', 'l' }; +static const symbol s_2_65[2] = { 'i', 'l' }; +static const symbol s_2_66[3] = { 'a', 'l', 'l' }; +static const symbol s_2_67[3] = { 'e', 'l', 'l' }; +static const symbol s_2_68[4] = { 0xED, 'v', 'o', 'l' }; +static const symbol s_2_69[4] = { 'i', 's', 'a', 'm' }; +static const symbol s_2_70[5] = { 'i', 's', 's', 'e', 'm' }; +static const symbol s_2_71[5] = { 0xEC, 's', 's', 'e', 'm' }; +static const symbol s_2_72[5] = { 0xED, 's', 's', 'e', 'm' }; +static const symbol s_2_73[5] = { 0xED, 's', 's', 'i', 'm' }; +static const symbol s_2_74[7] = { 'q', 'u', 0xED, 's', 's', 'i', 'm' }; +static const symbol s_2_75[4] = { 'a', 'm', 'e', 'n' }; +static const symbol s_2_76[5] = { 0xEC, 's', 's', 'i', 'n' }; +static const symbol s_2_77[2] = { 'a', 'r' }; +static const symbol s_2_78[6] = { 'i', 'f', 'i', 'c', 'a', 'r' }; +static const symbol s_2_79[4] = { 'e', 'g', 'a', 'r' }; +static const symbol s_2_80[4] = { 'e', 'j', 'a', 'r' }; +static const symbol s_2_81[4] = { 'i', 't', 'a', 'r' }; +static const symbol s_2_82[5] = { 'i', 't', 'z', 'a', 'r' }; +static const symbol s_2_83[3] = { 'f', 'e', 'r' }; +static const symbol s_2_84[2] = { 'o', 'r' }; +static const symbol s_2_85[3] = { 'd', 'o', 'r' }; +static const symbol s_2_86[3] = { 'd', 'u', 'r' }; +static const symbol s_2_87[5] = { 'd', 'o', 'r', 'a', 's' }; +static const symbol s_2_88[3] = { 'i', 'c', 's' }; +static const symbol s_2_89[6] = { 'l', 0xF3, 'g', 'i', 'c', 's' }; +static const symbol s_2_90[3] = { 'u', 'd', 's' }; +static const symbol s_2_91[4] = { 'n', 'c', 'e', 's' }; +static const symbol s_2_92[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_2_93[6] = { 'a', 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_94[6] = { 'e', 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_95[6] = { 0xE8, 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_96[5] = { 0xED, 'c', 'i', 'e', 's' }; +static const symbol s_2_97[6] = { 'l', 'o', 'g', 'i', 'e', 's' }; +static const symbol s_2_98[5] = { 'i', 'n', 'i', 'e', 's' }; +static const symbol s_2_99[5] = { 0xED, 'n', 'i', 'e', 's' }; +static const symbol s_2_100[5] = { 'e', 'r', 'i', 'e', 's' }; +static const symbol s_2_101[5] = { 0xE0, 'r', 'i', 'e', 's' }; +static const symbol s_2_102[7] = { 'a', 't', 0xF2, 'r', 'i', 'e', 's' }; +static const symbol s_2_103[4] = { 'b', 'l', 'e', 's' }; +static const symbol s_2_104[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_2_105[5] = { 'i', 'b', 'l', 'e', 's' }; +static const symbol s_2_106[4] = { 'i', 'm', 'e', 's' }; +static const symbol s_2_107[7] = { 0xED, 's', 's', 'i', 'm', 'e', 's' }; +static const symbol s_2_108[9] = { 'q', 'u', 0xED, 's', 's', 'i', 'm', 'e', 's' }; +static const symbol s_2_109[6] = { 'f', 'o', 'r', 'm', 'e', 's' }; +static const symbol s_2_110[5] = { 'i', 's', 'm', 'e', 's' }; +static const symbol s_2_111[8] = { 'i', 'a', 'l', 'i', 's', 'm', 'e', 's' }; +static const symbol s_2_112[4] = { 'i', 'n', 'e', 's' }; +static const symbol s_2_113[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_2_114[4] = { 'o', 'r', 'e', 's' }; +static const symbol s_2_115[5] = { 'd', 'o', 'r', 'e', 's' }; +static const symbol s_2_116[6] = { 'i', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_2_117[5] = { 'd', 'u', 'r', 'e', 's' }; +static const symbol s_2_118[4] = { 'e', 's', 'e', 's' }; +static const symbol s_2_119[4] = { 'o', 's', 'e', 's' }; +static const symbol s_2_120[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_2_121[5] = { 'i', 'c', 't', 'e', 's' }; +static const symbol s_2_122[4] = { 'i', 't', 'e', 's' }; +static const symbol s_2_123[4] = { 'o', 't', 'e', 's' }; +static const symbol s_2_124[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_2_125[8] = { 'i', 'a', 'l', 'i', 's', 't', 'e', 's' }; +static const symbol s_2_126[8] = { 'i', 'o', 'n', 'i', 's', 't', 'e', 's' }; +static const symbol s_2_127[5] = { 'i', 'q', 'u', 'e', 's' }; +static const symbol s_2_128[8] = { 'l', 0xF3, 'g', 'i', 'q', 'u', 'e', 's' }; +static const symbol s_2_129[4] = { 'i', 'v', 'e', 's' }; +static const symbol s_2_130[6] = { 'a', 't', 'i', 'v', 'e', 's' }; +static const symbol s_2_131[6] = { 'l', 'o', 'g', 0xED, 'e', 's' }; +static const symbol s_2_132[9] = { 'a', 'l', 'l', 'e', 'n', 'g', 0xFC, 'e', 's' }; +static const symbol s_2_133[4] = { 'i', 'c', 'i', 's' }; +static const symbol s_2_134[4] = { 0xED, 'c', 'i', 's' }; +static const symbol s_2_135[5] = { 'l', 'o', 'g', 'i', 's' }; +static const symbol s_2_136[4] = { 'a', 'r', 'i', 's' }; +static const symbol s_2_137[5] = { 't', 'o', 'r', 'i', 's' }; +static const symbol s_2_138[2] = { 'l', 's' }; +static const symbol s_2_139[3] = { 'a', 'l', 's' }; +static const symbol s_2_140[4] = { 'e', 'l', 'l', 's' }; +static const symbol s_2_141[3] = { 'i', 'm', 's' }; +static const symbol s_2_142[6] = { 0xED, 's', 's', 'i', 'm', 's' }; +static const symbol s_2_143[8] = { 'q', 'u', 0xED, 's', 's', 'i', 'm', 's' }; +static const symbol s_2_144[4] = { 'i', 'o', 'n', 's' }; +static const symbol s_2_145[5] = { 'c', 'i', 'o', 'n', 's' }; +static const symbol s_2_146[6] = { 'a', 'c', 'i', 'o', 'n', 's' }; +static const symbol s_2_147[4] = { 'e', 's', 'o', 's' }; +static const symbol s_2_148[4] = { 'o', 's', 'o', 's' }; +static const symbol s_2_149[5] = { 'a', 's', 's', 'o', 's' }; +static const symbol s_2_150[5] = { 'i', 's', 's', 'o', 's' }; +static const symbol s_2_151[3] = { 'e', 'r', 's' }; +static const symbol s_2_152[3] = { 'o', 'r', 's' }; +static const symbol s_2_153[4] = { 'd', 'o', 'r', 's' }; +static const symbol s_2_154[5] = { 'a', 'd', 'o', 'r', 's' }; +static const symbol s_2_155[5] = { 'i', 'd', 'o', 'r', 's' }; +static const symbol s_2_156[3] = { 'a', 't', 's' }; +static const symbol s_2_157[5] = { 'i', 't', 'a', 't', 's' }; +static const symbol s_2_158[8] = { 'b', 'i', 'l', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_159[7] = { 'i', 'v', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_160[9] = { 'a', 't', 'i', 'v', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_161[5] = { 0xEF, 't', 'a', 't', 's' }; +static const symbol s_2_162[3] = { 'e', 't', 's' }; +static const symbol s_2_163[4] = { 'a', 'n', 't', 's' }; +static const symbol s_2_164[4] = { 'e', 'n', 't', 's' }; +static const symbol s_2_165[5] = { 'm', 'e', 'n', 't', 's' }; +static const symbol s_2_166[6] = { 'a', 'm', 'e', 'n', 't', 's' }; +static const symbol s_2_167[3] = { 'o', 't', 's' }; +static const symbol s_2_168[3] = { 'u', 't', 's' }; +static const symbol s_2_169[3] = { 'i', 'u', 's' }; +static const symbol s_2_170[5] = { 't', 'r', 'i', 'u', 's' }; +static const symbol s_2_171[5] = { 'a', 't', 'i', 'u', 's' }; +static const symbol s_2_172[2] = { 0xE8, 's' }; +static const symbol s_2_173[2] = { 0xE9, 's' }; +static const symbol s_2_174[2] = { 0xED, 's' }; +static const symbol s_2_175[3] = { 'd', 0xED, 's' }; +static const symbol s_2_176[2] = { 0xF3, 's' }; +static const symbol s_2_177[4] = { 'i', 't', 'a', 't' }; +static const symbol s_2_178[7] = { 'b', 'i', 'l', 'i', 't', 'a', 't' }; +static const symbol s_2_179[6] = { 'i', 'v', 'i', 't', 'a', 't' }; +static const symbol s_2_180[8] = { 'a', 't', 'i', 'v', 'i', 't', 'a', 't' }; +static const symbol s_2_181[4] = { 0xEF, 't', 'a', 't' }; +static const symbol s_2_182[2] = { 'e', 't' }; +static const symbol s_2_183[3] = { 'a', 'n', 't' }; +static const symbol s_2_184[3] = { 'e', 'n', 't' }; +static const symbol s_2_185[4] = { 'i', 'e', 'n', 't' }; +static const symbol s_2_186[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_2_187[5] = { 'a', 'm', 'e', 'n', 't' }; +static const symbol s_2_188[7] = { 'i', 's', 'a', 'm', 'e', 'n', 't' }; +static const symbol s_2_189[2] = { 'o', 't' }; +static const symbol s_2_190[5] = { 'i', 's', 's', 'e', 'u' }; +static const symbol s_2_191[5] = { 0xEC, 's', 's', 'e', 'u' }; +static const symbol s_2_192[5] = { 0xED, 's', 's', 'e', 'u' }; +static const symbol s_2_193[4] = { 't', 'r', 'i', 'u' }; +static const symbol s_2_194[5] = { 0xED, 's', 's', 'i', 'u' }; +static const symbol s_2_195[4] = { 'a', 't', 'i', 'u' }; +static const symbol s_2_196[1] = { 0xF3 }; +static const symbol s_2_197[2] = { 'i', 0xF3 }; +static const symbol s_2_198[3] = { 'c', 'i', 0xF3 }; +static const symbol s_2_199[4] = { 'a', 'c', 'i', 0xF3 }; +static const struct among a_2[200] = { +{ 3, s_2_0, 0, 4, 0}, +{ 6, s_2_1, -1, 3, 0}, +{ 4, s_2_2, 0, 1, 0}, +{ 3, s_2_3, 0, 2, 0}, +{ 5, s_2_4, 0, 1, 0}, +{ 5, s_2_5, 0, 1, 0}, +{ 5, s_2_6, 0, 1, 0}, +{ 4, s_2_7, 0, 1, 0}, +{ 5, s_2_8, 0, 3, 0}, +{ 4, s_2_9, 0, 1, 0}, +{ 5, s_2_10, -1, 1, 0}, +{ 4, s_2_11, 0, 1, 0}, +{ 4, s_2_12, 0, 1, 0}, +{ 6, s_2_13, 0, 1, 0}, +{ 4, s_2_14, 0, 1, 0}, +{ 4, s_2_15, 0, 1, 0}, +{ 5, s_2_16, 0, 1, 0}, +{ 3, s_2_17, 0, 1, 0}, +{ 6, s_2_18, -1, 1, 0}, +{ 8, s_2_19, -1, 5, 0}, +{ 3, s_2_20, 0, 1, 0}, +{ 3, s_2_21, 0, 1, 0}, +{ 3, s_2_22, 0, 1, 0}, +{ 5, s_2_23, -1, 1, 0}, +{ 3, s_2_24, 0, 1, 0}, +{ 4, s_2_25, -1, 1, 0}, +{ 5, s_2_26, -1, 1, 0}, +{ 5, s_2_27, 0, 1, 0}, +{ 3, s_2_28, 0, 1, 0}, +{ 3, s_2_29, 0, 1, 0}, +{ 4, s_2_30, 0, 1, 0}, +{ 4, s_2_31, 0, 1, 0}, +{ 4, s_2_32, 0, 1, 0}, +{ 3, s_2_33, 0, 1, 0}, +{ 3, s_2_34, 0, 1, 0}, +{ 3, s_2_35, 0, 1, 0}, +{ 4, s_2_36, 0, 1, 0}, +{ 7, s_2_37, -1, 1, 0}, +{ 7, s_2_38, -2, 1, 0}, +{ 3, s_2_39, 0, 1, 0}, +{ 5, s_2_40, -1, 1, 0}, +{ 3, s_2_41, 0, 1, 0}, +{ 5, s_2_42, 0, 3, 0}, +{ 2, s_2_43, 0, 4, 0}, +{ 5, s_2_44, -1, 1, 0}, +{ 3, s_2_45, 0, 1, 0}, +{ 3, s_2_46, 0, 1, 0}, +{ 2, s_2_47, 0, 1, 0}, +{ 4, s_2_48, 0, 1, 0}, +{ 3, s_2_49, 0, 1, 0}, +{ 4, s_2_50, -1, 1, 0}, +{ 4, s_2_51, -2, 1, 0}, +{ 4, s_2_52, 0, 1, 0}, +{ 7, s_2_53, -1, 1, 0}, +{ 7, s_2_54, -2, 1, 0}, +{ 6, s_2_55, -3, 1, 0}, +{ 4, s_2_56, 0, 1, 0}, +{ 4, s_2_57, 0, 1, 0}, +{ 4, s_2_58, 0, 1, 0}, +{ 3, s_2_59, 0, 1, 0}, +{ 3, s_2_60, 0, 1, 0}, +{ 4, s_2_61, 0, 3, 0}, +{ 3, s_2_62, 0, 1, 0}, +{ 4, s_2_63, 0, 1, 0}, +{ 2, s_2_64, 0, 1, 0}, +{ 2, s_2_65, 0, 1, 0}, +{ 3, s_2_66, 0, 1, 0}, +{ 3, s_2_67, 0, 1, 0}, +{ 4, s_2_68, 0, 1, 0}, +{ 4, s_2_69, 0, 1, 0}, +{ 5, s_2_70, 0, 1, 0}, +{ 5, s_2_71, 0, 1, 0}, +{ 5, s_2_72, 0, 1, 0}, +{ 5, s_2_73, 0, 1, 0}, +{ 7, s_2_74, -1, 5, 0}, +{ 4, s_2_75, 0, 1, 0}, +{ 5, s_2_76, 0, 1, 0}, +{ 2, s_2_77, 0, 1, 0}, +{ 6, s_2_78, -1, 1, 0}, +{ 4, s_2_79, -2, 1, 0}, +{ 4, s_2_80, -3, 1, 0}, +{ 4, s_2_81, -4, 1, 0}, +{ 5, s_2_82, -5, 1, 0}, +{ 3, s_2_83, 0, 1, 0}, +{ 2, s_2_84, 0, 1, 0}, +{ 3, s_2_85, -1, 1, 0}, +{ 3, s_2_86, 0, 1, 0}, +{ 5, s_2_87, 0, 1, 0}, +{ 3, s_2_88, 0, 4, 0}, +{ 6, s_2_89, -1, 3, 0}, +{ 3, s_2_90, 0, 1, 0}, +{ 4, s_2_91, 0, 1, 0}, +{ 4, s_2_92, 0, 2, 0}, +{ 6, s_2_93, 0, 1, 0}, +{ 6, s_2_94, 0, 1, 0}, +{ 6, s_2_95, 0, 1, 0}, +{ 5, s_2_96, 0, 1, 0}, +{ 6, s_2_97, 0, 3, 0}, +{ 5, s_2_98, 0, 1, 0}, +{ 5, s_2_99, 0, 1, 0}, +{ 5, s_2_100, 0, 1, 0}, +{ 5, s_2_101, 0, 1, 0}, +{ 7, s_2_102, 0, 1, 0}, +{ 4, s_2_103, 0, 1, 0}, +{ 5, s_2_104, -1, 1, 0}, +{ 5, s_2_105, -2, 1, 0}, +{ 4, s_2_106, 0, 1, 0}, +{ 7, s_2_107, -1, 1, 0}, +{ 9, s_2_108, -1, 5, 0}, +{ 6, s_2_109, 0, 1, 0}, +{ 5, s_2_110, 0, 1, 0}, +{ 8, s_2_111, -1, 1, 0}, +{ 4, s_2_112, 0, 1, 0}, +{ 4, s_2_113, 0, 1, 0}, +{ 4, s_2_114, 0, 1, 0}, +{ 5, s_2_115, -1, 1, 0}, +{ 6, s_2_116, -1, 1, 0}, +{ 5, s_2_117, 0, 1, 0}, +{ 4, s_2_118, 0, 1, 0}, +{ 4, s_2_119, 0, 1, 0}, +{ 5, s_2_120, 0, 1, 0}, +{ 5, s_2_121, 0, 1, 0}, +{ 4, s_2_122, 0, 1, 0}, +{ 4, s_2_123, 0, 1, 0}, +{ 5, s_2_124, 0, 1, 0}, +{ 8, s_2_125, -1, 1, 0}, +{ 8, s_2_126, -2, 1, 0}, +{ 5, s_2_127, 0, 4, 0}, +{ 8, s_2_128, -1, 3, 0}, +{ 4, s_2_129, 0, 1, 0}, +{ 6, s_2_130, -1, 1, 0}, +{ 6, s_2_131, 0, 3, 0}, +{ 9, s_2_132, 0, 1, 0}, +{ 4, s_2_133, 0, 1, 0}, +{ 4, s_2_134, 0, 1, 0}, +{ 5, s_2_135, 0, 3, 0}, +{ 4, s_2_136, 0, 1, 0}, +{ 5, s_2_137, 0, 1, 0}, +{ 2, s_2_138, 0, 1, 0}, +{ 3, s_2_139, -1, 1, 0}, +{ 4, s_2_140, -2, 1, 0}, +{ 3, s_2_141, 0, 1, 0}, +{ 6, s_2_142, -1, 1, 0}, +{ 8, s_2_143, -1, 5, 0}, +{ 4, s_2_144, 0, 1, 0}, +{ 5, s_2_145, -1, 1, 0}, +{ 6, s_2_146, -1, 2, 0}, +{ 4, s_2_147, 0, 1, 0}, +{ 4, s_2_148, 0, 1, 0}, +{ 5, s_2_149, 0, 1, 0}, +{ 5, s_2_150, 0, 1, 0}, +{ 3, s_2_151, 0, 1, 0}, +{ 3, s_2_152, 0, 1, 0}, +{ 4, s_2_153, -1, 1, 0}, +{ 5, s_2_154, -1, 1, 0}, +{ 5, s_2_155, -2, 1, 0}, +{ 3, s_2_156, 0, 1, 0}, +{ 5, s_2_157, -1, 1, 0}, +{ 8, s_2_158, -1, 1, 0}, +{ 7, s_2_159, -2, 1, 0}, +{ 9, s_2_160, -1, 1, 0}, +{ 5, s_2_161, -5, 1, 0}, +{ 3, s_2_162, 0, 1, 0}, +{ 4, s_2_163, 0, 1, 0}, +{ 4, s_2_164, 0, 1, 0}, +{ 5, s_2_165, -1, 1, 0}, +{ 6, s_2_166, -1, 1, 0}, +{ 3, s_2_167, 0, 1, 0}, +{ 3, s_2_168, 0, 1, 0}, +{ 3, s_2_169, 0, 1, 0}, +{ 5, s_2_170, -1, 1, 0}, +{ 5, s_2_171, -2, 1, 0}, +{ 2, s_2_172, 0, 1, 0}, +{ 2, s_2_173, 0, 1, 0}, +{ 2, s_2_174, 0, 1, 0}, +{ 3, s_2_175, -1, 1, 0}, +{ 2, s_2_176, 0, 1, 0}, +{ 4, s_2_177, 0, 1, 0}, +{ 7, s_2_178, -1, 1, 0}, +{ 6, s_2_179, -2, 1, 0}, +{ 8, s_2_180, -1, 1, 0}, +{ 4, s_2_181, 0, 1, 0}, +{ 2, s_2_182, 0, 1, 0}, +{ 3, s_2_183, 0, 1, 0}, +{ 3, s_2_184, 0, 1, 0}, +{ 4, s_2_185, -1, 1, 0}, +{ 4, s_2_186, -2, 1, 0}, +{ 5, s_2_187, -1, 1, 0}, +{ 7, s_2_188, -1, 1, 0}, +{ 2, s_2_189, 0, 1, 0}, +{ 5, s_2_190, 0, 1, 0}, +{ 5, s_2_191, 0, 1, 0}, +{ 5, s_2_192, 0, 1, 0}, +{ 4, s_2_193, 0, 1, 0}, +{ 5, s_2_194, 0, 1, 0}, +{ 4, s_2_195, 0, 1, 0}, +{ 1, s_2_196, 0, 1, 0}, +{ 2, s_2_197, -1, 1, 0}, +{ 3, s_2_198, -1, 1, 0}, +{ 4, s_2_199, -1, 1, 0} +}; + +static const symbol s_3_0[3] = { 'a', 'b', 'a' }; +static const symbol s_3_1[4] = { 'e', 's', 'c', 'a' }; +static const symbol s_3_2[4] = { 'i', 's', 'c', 'a' }; +static const symbol s_3_3[4] = { 0xEF, 's', 'c', 'a' }; +static const symbol s_3_4[3] = { 'a', 'd', 'a' }; +static const symbol s_3_5[3] = { 'i', 'd', 'a' }; +static const symbol s_3_6[3] = { 'u', 'd', 'a' }; +static const symbol s_3_7[3] = { 0xEF, 'd', 'a' }; +static const symbol s_3_8[2] = { 'i', 'a' }; +static const symbol s_3_9[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_3_10[4] = { 'i', 'r', 'i', 'a' }; +static const symbol s_3_11[3] = { 'a', 'r', 'a' }; +static const symbol s_3_12[4] = { 'i', 'e', 'r', 'a' }; +static const symbol s_3_13[3] = { 'i', 'r', 'a' }; +static const symbol s_3_14[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_3_15[3] = { 0xEF, 'r', 'a' }; +static const symbol s_3_16[3] = { 'a', 'v', 'a' }; +static const symbol s_3_17[3] = { 'i', 'x', 'a' }; +static const symbol s_3_18[4] = { 'i', 't', 'z', 'a' }; +static const symbol s_3_19[2] = { 0xED, 'a' }; +static const symbol s_3_20[4] = { 'a', 'r', 0xED, 'a' }; +static const symbol s_3_21[4] = { 'e', 'r', 0xED, 'a' }; +static const symbol s_3_22[4] = { 'i', 'r', 0xED, 'a' }; +static const symbol s_3_23[2] = { 0xEF, 'a' }; +static const symbol s_3_24[3] = { 'i', 's', 'c' }; +static const symbol s_3_25[3] = { 0xEF, 's', 'c' }; +static const symbol s_3_26[2] = { 'a', 'd' }; +static const symbol s_3_27[2] = { 'e', 'd' }; +static const symbol s_3_28[2] = { 'i', 'd' }; +static const symbol s_3_29[2] = { 'i', 'e' }; +static const symbol s_3_30[2] = { 'r', 'e' }; +static const symbol s_3_31[3] = { 'd', 'r', 'e' }; +static const symbol s_3_32[3] = { 'a', 's', 'e' }; +static const symbol s_3_33[4] = { 'i', 'e', 's', 'e' }; +static const symbol s_3_34[4] = { 'a', 's', 't', 'e' }; +static const symbol s_3_35[4] = { 'i', 's', 't', 'e' }; +static const symbol s_3_36[2] = { 'i', 'i' }; +static const symbol s_3_37[3] = { 'i', 'n', 'i' }; +static const symbol s_3_38[5] = { 'e', 's', 'q', 'u', 'i' }; +static const symbol s_3_39[4] = { 'e', 'i', 'x', 'i' }; +static const symbol s_3_40[4] = { 'i', 't', 'z', 'i' }; +static const symbol s_3_41[2] = { 'a', 'm' }; +static const symbol s_3_42[2] = { 'e', 'm' }; +static const symbol s_3_43[4] = { 'a', 'r', 'e', 'm' }; +static const symbol s_3_44[4] = { 'i', 'r', 'e', 'm' }; +static const symbol s_3_45[4] = { 0xE0, 'r', 'e', 'm' }; +static const symbol s_3_46[4] = { 0xED, 'r', 'e', 'm' }; +static const symbol s_3_47[5] = { 0xE0, 's', 's', 'e', 'm' }; +static const symbol s_3_48[5] = { 0xE9, 's', 's', 'e', 'm' }; +static const symbol s_3_49[5] = { 'i', 'g', 'u', 'e', 'm' }; +static const symbol s_3_50[5] = { 0xEF, 'g', 'u', 'e', 'm' }; +static const symbol s_3_51[4] = { 'a', 'v', 'e', 'm' }; +static const symbol s_3_52[4] = { 0xE0, 'v', 'e', 'm' }; +static const symbol s_3_53[4] = { 0xE1, 'v', 'e', 'm' }; +static const symbol s_3_54[5] = { 'i', 'r', 0xEC, 'e', 'm' }; +static const symbol s_3_55[3] = { 0xED, 'e', 'm' }; +static const symbol s_3_56[5] = { 'a', 'r', 0xED, 'e', 'm' }; +static const symbol s_3_57[5] = { 'i', 'r', 0xED, 'e', 'm' }; +static const symbol s_3_58[5] = { 'a', 's', 's', 'i', 'm' }; +static const symbol s_3_59[5] = { 'e', 's', 's', 'i', 'm' }; +static const symbol s_3_60[5] = { 'i', 's', 's', 'i', 'm' }; +static const symbol s_3_61[5] = { 0xE0, 's', 's', 'i', 'm' }; +static const symbol s_3_62[5] = { 0xE8, 's', 's', 'i', 'm' }; +static const symbol s_3_63[5] = { 0xE9, 's', 's', 'i', 'm' }; +static const symbol s_3_64[5] = { 0xED, 's', 's', 'i', 'm' }; +static const symbol s_3_65[2] = { 0xEF, 'm' }; +static const symbol s_3_66[2] = { 'a', 'n' }; +static const symbol s_3_67[4] = { 'a', 'b', 'a', 'n' }; +static const symbol s_3_68[5] = { 'a', 'r', 'i', 'a', 'n' }; +static const symbol s_3_69[4] = { 'a', 'r', 'a', 'n' }; +static const symbol s_3_70[5] = { 'i', 'e', 'r', 'a', 'n' }; +static const symbol s_3_71[4] = { 'i', 'r', 'a', 'n' }; +static const symbol s_3_72[3] = { 0xED, 'a', 'n' }; +static const symbol s_3_73[5] = { 'a', 'r', 0xED, 'a', 'n' }; +static const symbol s_3_74[5] = { 'e', 'r', 0xED, 'a', 'n' }; +static const symbol s_3_75[5] = { 'i', 'r', 0xED, 'a', 'n' }; +static const symbol s_3_76[2] = { 'e', 'n' }; +static const symbol s_3_77[3] = { 'i', 'e', 'n' }; +static const symbol s_3_78[5] = { 'a', 'r', 'i', 'e', 'n' }; +static const symbol s_3_79[5] = { 'i', 'r', 'i', 'e', 'n' }; +static const symbol s_3_80[4] = { 'a', 'r', 'e', 'n' }; +static const symbol s_3_81[4] = { 'e', 'r', 'e', 'n' }; +static const symbol s_3_82[4] = { 'i', 'r', 'e', 'n' }; +static const symbol s_3_83[4] = { 0xE0, 'r', 'e', 'n' }; +static const symbol s_3_84[4] = { 0xEF, 'r', 'e', 'n' }; +static const symbol s_3_85[4] = { 'a', 's', 'e', 'n' }; +static const symbol s_3_86[5] = { 'i', 'e', 's', 'e', 'n' }; +static const symbol s_3_87[5] = { 'a', 's', 's', 'e', 'n' }; +static const symbol s_3_88[5] = { 'e', 's', 's', 'e', 'n' }; +static const symbol s_3_89[5] = { 'i', 's', 's', 'e', 'n' }; +static const symbol s_3_90[5] = { 0xE9, 's', 's', 'e', 'n' }; +static const symbol s_3_91[5] = { 0xEF, 's', 's', 'e', 'n' }; +static const symbol s_3_92[6] = { 'e', 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_93[6] = { 'i', 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_94[6] = { 0xEF, 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_95[4] = { 'a', 'v', 'e', 'n' }; +static const symbol s_3_96[4] = { 'i', 'x', 'e', 'n' }; +static const symbol s_3_97[5] = { 'e', 'i', 'x', 'e', 'n' }; +static const symbol s_3_98[4] = { 0xEF, 'x', 'e', 'n' }; +static const symbol s_3_99[3] = { 0xEF, 'e', 'n' }; +static const symbol s_3_100[2] = { 'i', 'n' }; +static const symbol s_3_101[4] = { 'i', 'n', 'i', 'n' }; +static const symbol s_3_102[3] = { 's', 'i', 'n' }; +static const symbol s_3_103[4] = { 'i', 's', 'i', 'n' }; +static const symbol s_3_104[5] = { 'a', 's', 's', 'i', 'n' }; +static const symbol s_3_105[5] = { 'e', 's', 's', 'i', 'n' }; +static const symbol s_3_106[5] = { 'i', 's', 's', 'i', 'n' }; +static const symbol s_3_107[5] = { 0xEF, 's', 's', 'i', 'n' }; +static const symbol s_3_108[6] = { 'e', 's', 'q', 'u', 'i', 'n' }; +static const symbol s_3_109[5] = { 'e', 'i', 'x', 'i', 'n' }; +static const symbol s_3_110[4] = { 'a', 'r', 'o', 'n' }; +static const symbol s_3_111[5] = { 'i', 'e', 'r', 'o', 'n' }; +static const symbol s_3_112[4] = { 'a', 'r', 0xE1, 'n' }; +static const symbol s_3_113[4] = { 'e', 'r', 0xE1, 'n' }; +static const symbol s_3_114[4] = { 'i', 'r', 0xE1, 'n' }; +static const symbol s_3_115[3] = { 'i', 0xEF, 'n' }; +static const symbol s_3_116[3] = { 'a', 'd', 'o' }; +static const symbol s_3_117[3] = { 'i', 'd', 'o' }; +static const symbol s_3_118[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_3_119[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_3_120[2] = { 'i', 'o' }; +static const symbol s_3_121[3] = { 'i', 'x', 'o' }; +static const symbol s_3_122[4] = { 'e', 'i', 'x', 'o' }; +static const symbol s_3_123[3] = { 0xEF, 'x', 'o' }; +static const symbol s_3_124[4] = { 'i', 't', 'z', 'o' }; +static const symbol s_3_125[2] = { 'a', 'r' }; +static const symbol s_3_126[4] = { 't', 'z', 'a', 'r' }; +static const symbol s_3_127[2] = { 'e', 'r' }; +static const symbol s_3_128[5] = { 'e', 'i', 'x', 'e', 'r' }; +static const symbol s_3_129[2] = { 'i', 'r' }; +static const symbol s_3_130[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_3_131[2] = { 'a', 's' }; +static const symbol s_3_132[4] = { 'a', 'b', 'a', 's' }; +static const symbol s_3_133[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_3_134[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_3_135[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_3_136[5] = { 'i', 'e', 'r', 'a', 's' }; +static const symbol s_3_137[3] = { 0xED, 'a', 's' }; +static const symbol s_3_138[5] = { 'a', 'r', 0xED, 'a', 's' }; +static const symbol s_3_139[5] = { 'e', 'r', 0xED, 'a', 's' }; +static const symbol s_3_140[5] = { 'i', 'r', 0xED, 'a', 's' }; +static const symbol s_3_141[3] = { 'i', 'd', 's' }; +static const symbol s_3_142[2] = { 'e', 's' }; +static const symbol s_3_143[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_3_144[4] = { 'i', 'd', 'e', 's' }; +static const symbol s_3_145[4] = { 'u', 'd', 'e', 's' }; +static const symbol s_3_146[4] = { 0xEF, 'd', 'e', 's' }; +static const symbol s_3_147[5] = { 'a', 't', 'g', 'e', 's' }; +static const symbol s_3_148[3] = { 'i', 'e', 's' }; +static const symbol s_3_149[5] = { 'a', 'r', 'i', 'e', 's' }; +static const symbol s_3_150[5] = { 'i', 'r', 'i', 'e', 's' }; +static const symbol s_3_151[4] = { 'a', 'r', 'e', 's' }; +static const symbol s_3_152[4] = { 'i', 'r', 'e', 's' }; +static const symbol s_3_153[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_3_154[4] = { 0xEF, 'r', 'e', 's' }; +static const symbol s_3_155[4] = { 'a', 's', 'e', 's' }; +static const symbol s_3_156[5] = { 'i', 'e', 's', 'e', 's' }; +static const symbol s_3_157[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_3_158[5] = { 'e', 's', 's', 'e', 's' }; +static const symbol s_3_159[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_3_160[5] = { 0xEF, 's', 's', 'e', 's' }; +static const symbol s_3_161[4] = { 'q', 'u', 'e', 's' }; +static const symbol s_3_162[6] = { 'e', 's', 'q', 'u', 'e', 's' }; +static const symbol s_3_163[6] = { 0xEF, 's', 'q', 'u', 'e', 's' }; +static const symbol s_3_164[4] = { 'a', 'v', 'e', 's' }; +static const symbol s_3_165[4] = { 'i', 'x', 'e', 's' }; +static const symbol s_3_166[5] = { 'e', 'i', 'x', 'e', 's' }; +static const symbol s_3_167[4] = { 0xEF, 'x', 'e', 's' }; +static const symbol s_3_168[3] = { 0xEF, 'e', 's' }; +static const symbol s_3_169[5] = { 'a', 'b', 'a', 'i', 's' }; +static const symbol s_3_170[5] = { 'a', 'r', 'a', 'i', 's' }; +static const symbol s_3_171[6] = { 'i', 'e', 'r', 'a', 'i', 's' }; +static const symbol s_3_172[4] = { 0xED, 'a', 'i', 's' }; +static const symbol s_3_173[6] = { 'a', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_3_174[6] = { 'e', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_3_175[6] = { 'i', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_3_176[5] = { 'a', 's', 'e', 'i', 's' }; +static const symbol s_3_177[6] = { 'i', 'e', 's', 'e', 'i', 's' }; +static const symbol s_3_178[6] = { 'a', 's', 't', 'e', 'i', 's' }; +static const symbol s_3_179[6] = { 'i', 's', 't', 'e', 'i', 's' }; +static const symbol s_3_180[4] = { 'i', 'n', 'i', 's' }; +static const symbol s_3_181[3] = { 's', 'i', 's' }; +static const symbol s_3_182[4] = { 'i', 's', 'i', 's' }; +static const symbol s_3_183[5] = { 'a', 's', 's', 'i', 's' }; +static const symbol s_3_184[5] = { 'e', 's', 's', 'i', 's' }; +static const symbol s_3_185[5] = { 'i', 's', 's', 'i', 's' }; +static const symbol s_3_186[5] = { 0xEF, 's', 's', 'i', 's' }; +static const symbol s_3_187[6] = { 'e', 's', 'q', 'u', 'i', 's' }; +static const symbol s_3_188[5] = { 'e', 'i', 'x', 'i', 's' }; +static const symbol s_3_189[5] = { 'i', 't', 'z', 'i', 's' }; +static const symbol s_3_190[3] = { 0xE1, 'i', 's' }; +static const symbol s_3_191[5] = { 'a', 'r', 0xE9, 'i', 's' }; +static const symbol s_3_192[5] = { 'e', 'r', 0xE9, 'i', 's' }; +static const symbol s_3_193[5] = { 'i', 'r', 0xE9, 'i', 's' }; +static const symbol s_3_194[3] = { 'a', 'm', 's' }; +static const symbol s_3_195[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_3_196[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_3_197[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_3_198[6] = { 0xE1, 'b', 'a', 'm', 'o', 's' }; +static const symbol s_3_199[6] = { 0xE1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_3_200[7] = { 'i', 0xE9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_3_201[5] = { 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_3_202[7] = { 'a', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_3_203[7] = { 'e', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_3_204[7] = { 'i', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_3_205[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_206[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_207[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_208[6] = { 0xE1, 's', 'e', 'm', 'o', 's' }; +static const symbol s_3_209[7] = { 'i', 0xE9, 's', 'e', 'm', 'o', 's' }; +static const symbol s_3_210[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_3_211[5] = { 'a', 'd', 'o', 'r', 's' }; +static const symbol s_3_212[3] = { 'a', 's', 's' }; +static const symbol s_3_213[5] = { 'e', 'r', 'a', 's', 's' }; +static const symbol s_3_214[3] = { 'e', 's', 's' }; +static const symbol s_3_215[3] = { 'a', 't', 's' }; +static const symbol s_3_216[3] = { 'i', 't', 's' }; +static const symbol s_3_217[4] = { 'e', 'n', 't', 's' }; +static const symbol s_3_218[2] = { 0xE0, 's' }; +static const symbol s_3_219[4] = { 'a', 'r', 0xE0, 's' }; +static const symbol s_3_220[4] = { 'i', 'r', 0xE0, 's' }; +static const symbol s_3_221[4] = { 'a', 'r', 0xE1, 's' }; +static const symbol s_3_222[4] = { 'e', 'r', 0xE1, 's' }; +static const symbol s_3_223[4] = { 'i', 'r', 0xE1, 's' }; +static const symbol s_3_224[2] = { 0xE9, 's' }; +static const symbol s_3_225[4] = { 'a', 'r', 0xE9, 's' }; +static const symbol s_3_226[2] = { 0xED, 's' }; +static const symbol s_3_227[3] = { 'i', 0xEF, 's' }; +static const symbol s_3_228[2] = { 'a', 't' }; +static const symbol s_3_229[2] = { 'i', 't' }; +static const symbol s_3_230[3] = { 'a', 'n', 't' }; +static const symbol s_3_231[3] = { 'e', 'n', 't' }; +static const symbol s_3_232[3] = { 'i', 'n', 't' }; +static const symbol s_3_233[2] = { 'u', 't' }; +static const symbol s_3_234[2] = { 0xEF, 't' }; +static const symbol s_3_235[2] = { 'a', 'u' }; +static const symbol s_3_236[4] = { 'e', 'r', 'a', 'u' }; +static const symbol s_3_237[3] = { 'i', 'e', 'u' }; +static const symbol s_3_238[4] = { 'i', 'n', 'e', 'u' }; +static const symbol s_3_239[4] = { 'a', 'r', 'e', 'u' }; +static const symbol s_3_240[4] = { 'i', 'r', 'e', 'u' }; +static const symbol s_3_241[4] = { 0xE0, 'r', 'e', 'u' }; +static const symbol s_3_242[4] = { 0xED, 'r', 'e', 'u' }; +static const symbol s_3_243[5] = { 'a', 's', 's', 'e', 'u' }; +static const symbol s_3_244[5] = { 'e', 's', 's', 'e', 'u' }; +static const symbol s_3_245[7] = { 'e', 'r', 'e', 's', 's', 'e', 'u' }; +static const symbol s_3_246[5] = { 0xE0, 's', 's', 'e', 'u' }; +static const symbol s_3_247[5] = { 0xE9, 's', 's', 'e', 'u' }; +static const symbol s_3_248[5] = { 'i', 'g', 'u', 'e', 'u' }; +static const symbol s_3_249[5] = { 0xEF, 'g', 'u', 'e', 'u' }; +static const symbol s_3_250[4] = { 0xE0, 'v', 'e', 'u' }; +static const symbol s_3_251[4] = { 0xE1, 'v', 'e', 'u' }; +static const symbol s_3_252[5] = { 'i', 't', 'z', 'e', 'u' }; +static const symbol s_3_253[3] = { 0xEC, 'e', 'u' }; +static const symbol s_3_254[5] = { 'i', 'r', 0xEC, 'e', 'u' }; +static const symbol s_3_255[3] = { 0xED, 'e', 'u' }; +static const symbol s_3_256[5] = { 'a', 'r', 0xED, 'e', 'u' }; +static const symbol s_3_257[5] = { 'i', 'r', 0xED, 'e', 'u' }; +static const symbol s_3_258[5] = { 'a', 's', 's', 'i', 'u' }; +static const symbol s_3_259[5] = { 'i', 's', 's', 'i', 'u' }; +static const symbol s_3_260[5] = { 0xE0, 's', 's', 'i', 'u' }; +static const symbol s_3_261[5] = { 0xE8, 's', 's', 'i', 'u' }; +static const symbol s_3_262[5] = { 0xE9, 's', 's', 'i', 'u' }; +static const symbol s_3_263[5] = { 0xED, 's', 's', 'i', 'u' }; +static const symbol s_3_264[2] = { 0xEF, 'u' }; +static const symbol s_3_265[2] = { 'i', 'x' }; +static const symbol s_3_266[3] = { 'e', 'i', 'x' }; +static const symbol s_3_267[2] = { 0xEF, 'x' }; +static const symbol s_3_268[3] = { 'i', 't', 'z' }; +static const symbol s_3_269[2] = { 'i', 0xE0 }; +static const symbol s_3_270[3] = { 'a', 'r', 0xE0 }; +static const symbol s_3_271[3] = { 'i', 'r', 0xE0 }; +static const symbol s_3_272[4] = { 'i', 't', 'z', 0xE0 }; +static const symbol s_3_273[3] = { 'a', 'r', 0xE1 }; +static const symbol s_3_274[3] = { 'e', 'r', 0xE1 }; +static const symbol s_3_275[3] = { 'i', 'r', 0xE1 }; +static const symbol s_3_276[3] = { 'i', 'r', 0xE8 }; +static const symbol s_3_277[3] = { 'a', 'r', 0xE9 }; +static const symbol s_3_278[3] = { 'e', 'r', 0xE9 }; +static const symbol s_3_279[3] = { 'i', 'r', 0xE9 }; +static const symbol s_3_280[1] = { 0xED }; +static const symbol s_3_281[2] = { 'i', 0xEF }; +static const symbol s_3_282[2] = { 'i', 0xF3 }; +static const struct among a_3[283] = { +{ 3, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 4, s_3_2, 0, 1, 0}, +{ 4, s_3_3, 0, 1, 0}, +{ 3, s_3_4, 0, 1, 0}, +{ 3, s_3_5, 0, 1, 0}, +{ 3, s_3_6, 0, 1, 0}, +{ 3, s_3_7, 0, 1, 0}, +{ 2, s_3_8, 0, 1, 0}, +{ 4, s_3_9, -1, 1, 0}, +{ 4, s_3_10, -2, 1, 0}, +{ 3, s_3_11, 0, 1, 0}, +{ 4, s_3_12, 0, 1, 0}, +{ 3, s_3_13, 0, 1, 0}, +{ 5, s_3_14, 0, 1, 0}, +{ 3, s_3_15, 0, 1, 0}, +{ 3, s_3_16, 0, 1, 0}, +{ 3, s_3_17, 0, 1, 0}, +{ 4, s_3_18, 0, 1, 0}, +{ 2, s_3_19, 0, 1, 0}, +{ 4, s_3_20, -1, 1, 0}, +{ 4, s_3_21, -2, 1, 0}, +{ 4, s_3_22, -3, 1, 0}, +{ 2, s_3_23, 0, 1, 0}, +{ 3, s_3_24, 0, 1, 0}, +{ 3, s_3_25, 0, 1, 0}, +{ 2, s_3_26, 0, 1, 0}, +{ 2, s_3_27, 0, 1, 0}, +{ 2, s_3_28, 0, 1, 0}, +{ 2, s_3_29, 0, 1, 0}, +{ 2, s_3_30, 0, 1, 0}, +{ 3, s_3_31, -1, 1, 0}, +{ 3, s_3_32, 0, 1, 0}, +{ 4, s_3_33, 0, 1, 0}, +{ 4, s_3_34, 0, 1, 0}, +{ 4, s_3_35, 0, 1, 0}, +{ 2, s_3_36, 0, 1, 0}, +{ 3, s_3_37, 0, 1, 0}, +{ 5, s_3_38, 0, 1, 0}, +{ 4, s_3_39, 0, 1, 0}, +{ 4, s_3_40, 0, 1, 0}, +{ 2, s_3_41, 0, 1, 0}, +{ 2, s_3_42, 0, 1, 0}, +{ 4, s_3_43, -1, 1, 0}, +{ 4, s_3_44, -2, 1, 0}, +{ 4, s_3_45, -3, 1, 0}, +{ 4, s_3_46, -4, 1, 0}, +{ 5, s_3_47, -5, 1, 0}, +{ 5, s_3_48, -6, 1, 0}, +{ 5, s_3_49, -7, 1, 0}, +{ 5, s_3_50, -8, 1, 0}, +{ 4, s_3_51, -9, 1, 0}, +{ 4, s_3_52, -10, 1, 0}, +{ 4, s_3_53, -11, 1, 0}, +{ 5, s_3_54, -12, 1, 0}, +{ 3, s_3_55, -13, 1, 0}, +{ 5, s_3_56, -1, 1, 0}, +{ 5, s_3_57, -2, 1, 0}, +{ 5, s_3_58, 0, 1, 0}, +{ 5, s_3_59, 0, 1, 0}, +{ 5, s_3_60, 0, 1, 0}, +{ 5, s_3_61, 0, 1, 0}, +{ 5, s_3_62, 0, 1, 0}, +{ 5, s_3_63, 0, 1, 0}, +{ 5, s_3_64, 0, 1, 0}, +{ 2, s_3_65, 0, 1, 0}, +{ 2, s_3_66, 0, 1, 0}, +{ 4, s_3_67, -1, 1, 0}, +{ 5, s_3_68, -2, 1, 0}, +{ 4, s_3_69, -3, 1, 0}, +{ 5, s_3_70, -4, 1, 0}, +{ 4, s_3_71, -5, 1, 0}, +{ 3, s_3_72, -6, 1, 0}, +{ 5, s_3_73, -1, 1, 0}, +{ 5, s_3_74, -2, 1, 0}, +{ 5, s_3_75, -3, 1, 0}, +{ 2, s_3_76, 0, 1, 0}, +{ 3, s_3_77, -1, 1, 0}, +{ 5, s_3_78, -1, 1, 0}, +{ 5, s_3_79, -2, 1, 0}, +{ 4, s_3_80, -4, 1, 0}, +{ 4, s_3_81, -5, 1, 0}, +{ 4, s_3_82, -6, 1, 0}, +{ 4, s_3_83, -7, 1, 0}, +{ 4, s_3_84, -8, 1, 0}, +{ 4, s_3_85, -9, 1, 0}, +{ 5, s_3_86, -10, 1, 0}, +{ 5, s_3_87, -11, 1, 0}, +{ 5, s_3_88, -12, 1, 0}, +{ 5, s_3_89, -13, 1, 0}, +{ 5, s_3_90, -14, 1, 0}, +{ 5, s_3_91, -15, 1, 0}, +{ 6, s_3_92, -16, 1, 0}, +{ 6, s_3_93, -17, 1, 0}, +{ 6, s_3_94, -18, 1, 0}, +{ 4, s_3_95, -19, 1, 0}, +{ 4, s_3_96, -20, 1, 0}, +{ 5, s_3_97, -1, 1, 0}, +{ 4, s_3_98, -22, 1, 0}, +{ 3, s_3_99, -23, 1, 0}, +{ 2, s_3_100, 0, 1, 0}, +{ 4, s_3_101, -1, 1, 0}, +{ 3, s_3_102, -2, 1, 0}, +{ 4, s_3_103, -1, 1, 0}, +{ 5, s_3_104, -2, 1, 0}, +{ 5, s_3_105, -3, 1, 0}, +{ 5, s_3_106, -4, 1, 0}, +{ 5, s_3_107, -5, 1, 0}, +{ 6, s_3_108, -8, 1, 0}, +{ 5, s_3_109, -9, 1, 0}, +{ 4, s_3_110, 0, 1, 0}, +{ 5, s_3_111, 0, 1, 0}, +{ 4, s_3_112, 0, 1, 0}, +{ 4, s_3_113, 0, 1, 0}, +{ 4, s_3_114, 0, 1, 0}, +{ 3, s_3_115, 0, 1, 0}, +{ 3, s_3_116, 0, 1, 0}, +{ 3, s_3_117, 0, 1, 0}, +{ 4, s_3_118, 0, 2, 0}, +{ 5, s_3_119, 0, 1, 0}, +{ 2, s_3_120, 0, 1, 0}, +{ 3, s_3_121, 0, 1, 0}, +{ 4, s_3_122, -1, 1, 0}, +{ 3, s_3_123, 0, 1, 0}, +{ 4, s_3_124, 0, 1, 0}, +{ 2, s_3_125, 0, 1, 0}, +{ 4, s_3_126, -1, 1, 0}, +{ 2, s_3_127, 0, 1, 0}, +{ 5, s_3_128, -1, 1, 0}, +{ 2, s_3_129, 0, 1, 0}, +{ 4, s_3_130, 0, 1, 0}, +{ 2, s_3_131, 0, 1, 0}, +{ 4, s_3_132, -1, 1, 0}, +{ 4, s_3_133, -2, 1, 0}, +{ 4, s_3_134, -3, 1, 0}, +{ 4, s_3_135, -4, 1, 0}, +{ 5, s_3_136, -5, 1, 0}, +{ 3, s_3_137, -6, 1, 0}, +{ 5, s_3_138, -1, 1, 0}, +{ 5, s_3_139, -2, 1, 0}, +{ 5, s_3_140, -3, 1, 0}, +{ 3, s_3_141, 0, 1, 0}, +{ 2, s_3_142, 0, 1, 0}, +{ 4, s_3_143, -1, 1, 0}, +{ 4, s_3_144, -2, 1, 0}, +{ 4, s_3_145, -3, 1, 0}, +{ 4, s_3_146, -4, 1, 0}, +{ 5, s_3_147, -5, 1, 0}, +{ 3, s_3_148, -6, 1, 0}, +{ 5, s_3_149, -1, 1, 0}, +{ 5, s_3_150, -2, 1, 0}, +{ 4, s_3_151, -9, 1, 0}, +{ 4, s_3_152, -10, 1, 0}, +{ 6, s_3_153, -11, 1, 0}, +{ 4, s_3_154, -12, 1, 0}, +{ 4, s_3_155, -13, 1, 0}, +{ 5, s_3_156, -14, 1, 0}, +{ 5, s_3_157, -15, 1, 0}, +{ 5, s_3_158, -16, 1, 0}, +{ 5, s_3_159, -17, 1, 0}, +{ 5, s_3_160, -18, 1, 0}, +{ 4, s_3_161, -19, 1, 0}, +{ 6, s_3_162, -1, 1, 0}, +{ 6, s_3_163, -2, 1, 0}, +{ 4, s_3_164, -22, 1, 0}, +{ 4, s_3_165, -23, 1, 0}, +{ 5, s_3_166, -1, 1, 0}, +{ 4, s_3_167, -25, 1, 0}, +{ 3, s_3_168, -26, 1, 0}, +{ 5, s_3_169, 0, 1, 0}, +{ 5, s_3_170, 0, 1, 0}, +{ 6, s_3_171, 0, 1, 0}, +{ 4, s_3_172, 0, 1, 0}, +{ 6, s_3_173, -1, 1, 0}, +{ 6, s_3_174, -2, 1, 0}, +{ 6, s_3_175, -3, 1, 0}, +{ 5, s_3_176, 0, 1, 0}, +{ 6, s_3_177, 0, 1, 0}, +{ 6, s_3_178, 0, 1, 0}, +{ 6, s_3_179, 0, 1, 0}, +{ 4, s_3_180, 0, 1, 0}, +{ 3, s_3_181, 0, 1, 0}, +{ 4, s_3_182, -1, 1, 0}, +{ 5, s_3_183, -2, 1, 0}, +{ 5, s_3_184, -3, 1, 0}, +{ 5, s_3_185, -4, 1, 0}, +{ 5, s_3_186, -5, 1, 0}, +{ 6, s_3_187, 0, 1, 0}, +{ 5, s_3_188, 0, 1, 0}, +{ 5, s_3_189, 0, 1, 0}, +{ 3, s_3_190, 0, 1, 0}, +{ 5, s_3_191, 0, 1, 0}, +{ 5, s_3_192, 0, 1, 0}, +{ 5, s_3_193, 0, 1, 0}, +{ 3, s_3_194, 0, 1, 0}, +{ 4, s_3_195, 0, 1, 0}, +{ 4, s_3_196, 0, 1, 0}, +{ 4, s_3_197, 0, 1, 0}, +{ 6, s_3_198, -1, 1, 0}, +{ 6, s_3_199, -2, 1, 0}, +{ 7, s_3_200, -3, 1, 0}, +{ 5, s_3_201, -4, 1, 0}, +{ 7, s_3_202, -1, 1, 0}, +{ 7, s_3_203, -2, 1, 0}, +{ 7, s_3_204, -3, 1, 0}, +{ 6, s_3_205, 0, 1, 0}, +{ 6, s_3_206, 0, 1, 0}, +{ 6, s_3_207, 0, 1, 0}, +{ 6, s_3_208, 0, 1, 0}, +{ 7, s_3_209, 0, 1, 0}, +{ 4, s_3_210, 0, 1, 0}, +{ 5, s_3_211, 0, 1, 0}, +{ 3, s_3_212, 0, 1, 0}, +{ 5, s_3_213, -1, 1, 0}, +{ 3, s_3_214, 0, 1, 0}, +{ 3, s_3_215, 0, 1, 0}, +{ 3, s_3_216, 0, 1, 0}, +{ 4, s_3_217, 0, 1, 0}, +{ 2, s_3_218, 0, 1, 0}, +{ 4, s_3_219, -1, 1, 0}, +{ 4, s_3_220, -2, 1, 0}, +{ 4, s_3_221, 0, 1, 0}, +{ 4, s_3_222, 0, 1, 0}, +{ 4, s_3_223, 0, 1, 0}, +{ 2, s_3_224, 0, 1, 0}, +{ 4, s_3_225, -1, 1, 0}, +{ 2, s_3_226, 0, 1, 0}, +{ 3, s_3_227, 0, 1, 0}, +{ 2, s_3_228, 0, 1, 0}, +{ 2, s_3_229, 0, 1, 0}, +{ 3, s_3_230, 0, 1, 0}, +{ 3, s_3_231, 0, 1, 0}, +{ 3, s_3_232, 0, 1, 0}, +{ 2, s_3_233, 0, 1, 0}, +{ 2, s_3_234, 0, 1, 0}, +{ 2, s_3_235, 0, 1, 0}, +{ 4, s_3_236, -1, 1, 0}, +{ 3, s_3_237, 0, 1, 0}, +{ 4, s_3_238, 0, 1, 0}, +{ 4, s_3_239, 0, 1, 0}, +{ 4, s_3_240, 0, 1, 0}, +{ 4, s_3_241, 0, 1, 0}, +{ 4, s_3_242, 0, 1, 0}, +{ 5, s_3_243, 0, 1, 0}, +{ 5, s_3_244, 0, 1, 0}, +{ 7, s_3_245, -1, 1, 0}, +{ 5, s_3_246, 0, 1, 0}, +{ 5, s_3_247, 0, 1, 0}, +{ 5, s_3_248, 0, 1, 0}, +{ 5, s_3_249, 0, 1, 0}, +{ 4, s_3_250, 0, 1, 0}, +{ 4, s_3_251, 0, 1, 0}, +{ 5, s_3_252, 0, 1, 0}, +{ 3, s_3_253, 0, 1, 0}, +{ 5, s_3_254, -1, 1, 0}, +{ 3, s_3_255, 0, 1, 0}, +{ 5, s_3_256, -1, 1, 0}, +{ 5, s_3_257, -2, 1, 0}, +{ 5, s_3_258, 0, 1, 0}, +{ 5, s_3_259, 0, 1, 0}, +{ 5, s_3_260, 0, 1, 0}, +{ 5, s_3_261, 0, 1, 0}, +{ 5, s_3_262, 0, 1, 0}, +{ 5, s_3_263, 0, 1, 0}, +{ 2, s_3_264, 0, 1, 0}, +{ 2, s_3_265, 0, 1, 0}, +{ 3, s_3_266, -1, 1, 0}, +{ 2, s_3_267, 0, 1, 0}, +{ 3, s_3_268, 0, 1, 0}, +{ 2, s_3_269, 0, 1, 0}, +{ 3, s_3_270, 0, 1, 0}, +{ 3, s_3_271, 0, 1, 0}, +{ 4, s_3_272, 0, 1, 0}, +{ 3, s_3_273, 0, 1, 0}, +{ 3, s_3_274, 0, 1, 0}, +{ 3, s_3_275, 0, 1, 0}, +{ 3, s_3_276, 0, 1, 0}, +{ 3, s_3_277, 0, 1, 0}, +{ 3, s_3_278, 0, 1, 0}, +{ 3, s_3_279, 0, 1, 0}, +{ 1, s_3_280, 0, 1, 0}, +{ 2, s_3_281, 0, 1, 0}, +{ 2, s_3_282, 0, 1, 0} +}; + +static const symbol s_4_0[1] = { 'a' }; +static const symbol s_4_1[1] = { 'e' }; +static const symbol s_4_2[1] = { 'i' }; +static const symbol s_4_3[2] = { 0xEF, 'n' }; +static const symbol s_4_4[1] = { 'o' }; +static const symbol s_4_5[2] = { 'i', 'r' }; +static const symbol s_4_6[1] = { 's' }; +static const symbol s_4_7[2] = { 'i', 's' }; +static const symbol s_4_8[2] = { 'o', 's' }; +static const symbol s_4_9[2] = { 0xEF, 's' }; +static const symbol s_4_10[2] = { 'i', 't' }; +static const symbol s_4_11[2] = { 'e', 'u' }; +static const symbol s_4_12[2] = { 'i', 'u' }; +static const symbol s_4_13[3] = { 'i', 'q', 'u' }; +static const symbol s_4_14[3] = { 'i', 't', 'z' }; +static const symbol s_4_15[1] = { 0xE0 }; +static const symbol s_4_16[1] = { 0xE1 }; +static const symbol s_4_17[1] = { 0xE9 }; +static const symbol s_4_18[1] = { 0xEC }; +static const symbol s_4_19[1] = { 0xED }; +static const symbol s_4_20[1] = { 0xEF }; +static const symbol s_4_21[1] = { 0xF3 }; +static const struct among a_4[22] = { +{ 1, s_4_0, 0, 1, 0}, +{ 1, s_4_1, 0, 1, 0}, +{ 1, s_4_2, 0, 1, 0}, +{ 2, s_4_3, 0, 1, 0}, +{ 1, s_4_4, 0, 1, 0}, +{ 2, s_4_5, 0, 1, 0}, +{ 1, s_4_6, 0, 1, 0}, +{ 2, s_4_7, -1, 1, 0}, +{ 2, s_4_8, -2, 1, 0}, +{ 2, s_4_9, -3, 1, 0}, +{ 2, s_4_10, 0, 1, 0}, +{ 2, s_4_11, 0, 1, 0}, +{ 2, s_4_12, 0, 1, 0}, +{ 3, s_4_13, 0, 2, 0}, +{ 3, s_4_14, 0, 1, 0}, +{ 1, s_4_15, 0, 1, 0}, +{ 1, s_4_16, 0, 1, 0}, +{ 1, s_4_17, 0, 1, 0}, +{ 1, s_4_18, 0, 1, 0}, +{ 1, s_4_19, 0, 1, 0}, +{ 1, s_4_20, 0, 1, 0}, +{ 1, s_4_21, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 81, 6, 10 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { '.' }; +static const symbol s_6[] = { 'l', 'o', 'g' }; +static const symbol s_7[] = { 'i', 'c' }; +static const symbol s_8[] = { 'c' }; +static const symbol s_9[] = { 'i', 'c' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_cleaning(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 13); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 7: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1634850 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 39)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_2, 200); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_6); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_3, 283); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_4, 22); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int catalan_ISO_8859_1_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + { + int ret = r_residual_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + { + int v_5 = z->c; + { + int ret = r_cleaning(z); + if (ret < 0) return ret; + } + z->c = v_5; + } + return 1; +} + +extern struct SN_env * catalan_ISO_8859_1_create_env(void) { return SN_create_env(0, 2); } + +extern void catalan_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.h new file mode 100644 index 000000000000..8742fcf225f3 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_catalan.h @@ -0,0 +1,15 @@ +/* Generated from catalan.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_ISO_8859_1_create_env(void); +extern void catalan_ISO_8859_1_close_env(struct SN_env * z); + +extern int catalan_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.c new file mode 100644 index 000000000000..c2ec6ad1349d --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.c @@ -0,0 +1,336 @@ +/* Generated from danish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int danish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_undouble(struct SN_env * z); +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * danish_ISO_8859_1_create_env(void); +extern void danish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'h', 'e', 'd' }; +static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' }; +static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' }; +static const symbol s_0_3[1] = { 'e' }; +static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' }; +static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' }; +static const symbol s_0_7[3] = { 'e', 'n', 'e' }; +static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' }; +static const symbol s_0_9[3] = { 'e', 'r', 'e' }; +static const symbol s_0_10[2] = { 'e', 'n' }; +static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' }; +static const symbol s_0_13[2] = { 'e', 'r' }; +static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' }; +static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' }; +static const symbol s_0_16[1] = { 's' }; +static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' }; +static const symbol s_0_18[2] = { 'e', 's' }; +static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' }; +static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_0_24[3] = { 'e', 'n', 's' }; +static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' }; +static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' }; +static const symbol s_0_27[3] = { 'e', 'r', 's' }; +static const symbol s_0_28[3] = { 'e', 't', 's' }; +static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' }; +static const symbol s_0_30[2] = { 'e', 't' }; +static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' }; +static const struct among a_0[32] = { +{ 3, s_0_0, 0, 1, 0}, +{ 5, s_0_1, -1, 1, 0}, +{ 4, s_0_2, 0, 1, 0}, +{ 1, s_0_3, 0, 1, 0}, +{ 5, s_0_4, -1, 1, 0}, +{ 4, s_0_5, -2, 1, 0}, +{ 6, s_0_6, -1, 1, 0}, +{ 3, s_0_7, -4, 1, 0}, +{ 4, s_0_8, -5, 1, 0}, +{ 3, s_0_9, -6, 1, 0}, +{ 2, s_0_10, 0, 1, 0}, +{ 5, s_0_11, -1, 1, 0}, +{ 4, s_0_12, -2, 1, 0}, +{ 2, s_0_13, 0, 1, 0}, +{ 5, s_0_14, -1, 1, 0}, +{ 4, s_0_15, -2, 1, 0}, +{ 1, s_0_16, 0, 2, 0}, +{ 4, s_0_17, -1, 1, 0}, +{ 2, s_0_18, -2, 1, 0}, +{ 5, s_0_19, -1, 1, 0}, +{ 7, s_0_20, -1, 1, 0}, +{ 4, s_0_21, -3, 1, 0}, +{ 5, s_0_22, -4, 1, 0}, +{ 4, s_0_23, -5, 1, 0}, +{ 3, s_0_24, -8, 1, 0}, +{ 6, s_0_25, -1, 1, 0}, +{ 5, s_0_26, -2, 1, 0}, +{ 3, s_0_27, -11, 1, 0}, +{ 3, s_0_28, -12, 1, 0}, +{ 5, s_0_29, -1, 1, 0}, +{ 2, s_0_30, 0, 1, 0}, +{ 4, s_0_31, -1, 1, 0} +}; + +static const symbol s_1_0[2] = { 'g', 'd' }; +static const symbol s_1_1[2] = { 'd', 't' }; +static const symbol s_1_2[2] = { 'g', 't' }; +static const symbol s_1_3[2] = { 'k', 't' }; +static const struct among a_1[4] = { +{ 2, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'g' }; +static const symbol s_2_1[3] = { 'l', 'i', 'g' }; +static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_2_3[3] = { 'e', 'l', 's' }; +static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' }; +static const struct among a_2[5] = { +{ 2, s_2_0, 0, 1, 0}, +{ 3, s_2_1, -1, 1, 0}, +{ 4, s_2_2, -1, 1, 0}, +{ 3, s_2_3, 0, 1, 0}, +{ 4, s_2_4, 0, 2, 0} +}; + +static const unsigned char g_c[] = { 119, 223, 119, 1 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; + +static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }; + +static const symbol s_0[] = { 's', 't' }; +static const symbol s_1[] = { 'i', 'g' }; +static const symbol s_2[] = { 'l', 0xF8, 's' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_0, 32); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { + int v_1 = z->l - z->c; + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = v_2; return 0; } + if (!find_among_b(z, a_1, 4)) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + z->c = z->l - v_1; + } + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_0))) goto lab0; + z->bra = z->c; + if (!(eq_s_b(z, 2, s_1))) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_2; return 0; } + among_var = find_among_b(z, a_2, 5); + if (!among_var) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (in_grouping_b(z, g_c, 98, 122, 0)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + z->lb = v_1; + } + if (!(eq_v_b(z, z->S[0]))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int danish_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_undouble(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2); } + +extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.h new file mode 100644 index 000000000000..a4ab6e444c20 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_danish.h @@ -0,0 +1,15 @@ +/* Generated from danish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_ISO_8859_1_create_env(void); +extern void danish_ISO_8859_1_close_env(struct SN_env * z); + +extern int danish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.c new file mode 100644 index 000000000000..52706d0af653 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.c @@ -0,0 +1,2015 @@ +/* Generated from dutch.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int dutch_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_measure(struct SN_env * z); +static int r_Lose_infix(struct SN_env * z); +static int r_Lose_prefix(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_6(struct SN_env * z); +static int r_Step_7(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1(struct SN_env * z); +static int r_lengthen_V(struct SN_env * z); +static int r_VX(struct SN_env * z); +static int r_V(struct SN_env * z); +static int r_C(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * dutch_ISO_8859_1_create_env(void); +extern void dutch_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 'a' }; +static const symbol s_0_1[1] = { 'e' }; +static const symbol s_0_2[1] = { 'o' }; +static const symbol s_0_3[1] = { 'u' }; +static const symbol s_0_4[1] = { 0xE0 }; +static const symbol s_0_5[1] = { 0xE1 }; +static const symbol s_0_6[1] = { 0xE2 }; +static const symbol s_0_7[1] = { 0xE4 }; +static const symbol s_0_8[1] = { 0xE8 }; +static const symbol s_0_9[1] = { 0xE9 }; +static const symbol s_0_10[1] = { 0xEA }; +static const symbol s_0_11[2] = { 'e', 0xEB }; +static const symbol s_0_12[2] = { 'i', 0xEB }; +static const symbol s_0_13[1] = { 0xF2 }; +static const symbol s_0_14[1] = { 0xF3 }; +static const symbol s_0_15[1] = { 0xF4 }; +static const symbol s_0_16[1] = { 0xF6 }; +static const symbol s_0_17[1] = { 0xF9 }; +static const symbol s_0_18[1] = { 0xFA }; +static const symbol s_0_19[1] = { 0xFB }; +static const symbol s_0_20[1] = { 0xFC }; +static const struct among a_0[21] = { +{ 1, s_0_0, 0, 1, 0}, +{ 1, s_0_1, 0, 2, 0}, +{ 1, s_0_2, 0, 1, 0}, +{ 1, s_0_3, 0, 1, 0}, +{ 1, s_0_4, 0, 1, 0}, +{ 1, s_0_5, 0, 1, 0}, +{ 1, s_0_6, 0, 1, 0}, +{ 1, s_0_7, 0, 1, 0}, +{ 1, s_0_8, 0, 2, 0}, +{ 1, s_0_9, 0, 2, 0}, +{ 1, s_0_10, 0, 2, 0}, +{ 2, s_0_11, 0, 3, 0}, +{ 2, s_0_12, 0, 4, 0}, +{ 1, s_0_13, 0, 1, 0}, +{ 1, s_0_14, 0, 1, 0}, +{ 1, s_0_15, 0, 1, 0}, +{ 1, s_0_16, 0, 1, 0}, +{ 1, s_0_17, 0, 1, 0}, +{ 1, s_0_18, 0, 1, 0}, +{ 1, s_0_19, 0, 1, 0}, +{ 1, s_0_20, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'n', 'd', 'e' }; +static const symbol s_1_1[2] = { 'e', 'n' }; +static const symbol s_1_2[1] = { 's' }; +static const symbol s_1_3[2] = { '\'', 's' }; +static const symbol s_1_4[2] = { 'e', 's' }; +static const symbol s_1_5[3] = { 'i', 'e', 's' }; +static const symbol s_1_6[3] = { 'a', 'u', 's' }; +static const symbol s_1_7[2] = { 0xE9, 's' }; +static const struct among a_1[8] = { +{ 3, s_1_0, 0, 8, 0}, +{ 2, s_1_1, 0, 7, 0}, +{ 1, s_1_2, 0, 2, 0}, +{ 2, s_1_3, -1, 1, 0}, +{ 2, s_1_4, -2, 4, 0}, +{ 3, s_1_5, -1, 3, 0}, +{ 3, s_1_6, -4, 6, 0}, +{ 2, s_1_7, -5, 5, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'e' }; +static const symbol s_2_1[2] = { 'g', 'e' }; +static const symbol s_2_2[5] = { 'i', 's', 'c', 'h', 'e' }; +static const symbol s_2_3[2] = { 'j', 'e' }; +static const symbol s_2_4[5] = { 'l', 'i', 'j', 'k', 'e' }; +static const symbol s_2_5[2] = { 'l', 'e' }; +static const symbol s_2_6[3] = { 'e', 'n', 'e' }; +static const symbol s_2_7[2] = { 'r', 'e' }; +static const symbol s_2_8[2] = { 's', 'e' }; +static const symbol s_2_9[2] = { 't', 'e' }; +static const symbol s_2_10[4] = { 'i', 'e', 'v', 'e' }; +static const struct among a_2[11] = { +{ 2, s_2_0, 0, 5, 0}, +{ 2, s_2_1, 0, 2, 0}, +{ 5, s_2_2, 0, 4, 0}, +{ 2, s_2_3, 0, 1, 0}, +{ 5, s_2_4, 0, 3, 0}, +{ 2, s_2_5, 0, 9, 0}, +{ 3, s_2_6, 0, 10, 0}, +{ 2, s_2_7, 0, 8, 0}, +{ 2, s_2_8, 0, 7, 0}, +{ 2, s_2_9, 0, 6, 0}, +{ 4, s_2_10, 0, 11, 0} +}; + +static const symbol s_3_0[4] = { 'h', 'e', 'i', 'd' }; +static const symbol s_3_1[3] = { 'f', 'i', 'e' }; +static const symbol s_3_2[3] = { 'g', 'i', 'e' }; +static const symbol s_3_3[4] = { 'a', 't', 'i', 'e' }; +static const symbol s_3_4[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_3_5[3] = { 'i', 'n', 'g' }; +static const symbol s_3_6[4] = { 'a', 'r', 'i', 'j' }; +static const symbol s_3_7[4] = { 'e', 'r', 'i', 'j' }; +static const symbol s_3_8[3] = { 's', 'e', 'l' }; +static const symbol s_3_9[4] = { 'r', 'd', 'e', 'r' }; +static const symbol s_3_10[4] = { 's', 't', 'e', 'r' }; +static const symbol s_3_11[5] = { 'i', 't', 'e', 'i', 't' }; +static const symbol s_3_12[3] = { 'd', 's', 't' }; +static const symbol s_3_13[3] = { 't', 's', 't' }; +static const struct among a_3[14] = { +{ 4, s_3_0, 0, 3, 0}, +{ 3, s_3_1, 0, 7, 0}, +{ 3, s_3_2, 0, 8, 0}, +{ 4, s_3_3, 0, 1, 0}, +{ 4, s_3_4, 0, 5, 0}, +{ 3, s_3_5, 0, 5, 0}, +{ 4, s_3_6, 0, 6, 0}, +{ 4, s_3_7, 0, 5, 0}, +{ 3, s_3_8, 0, 3, 0}, +{ 4, s_3_9, 0, 4, 0}, +{ 4, s_3_10, 0, 3, 0}, +{ 5, s_3_11, 0, 2, 0}, +{ 3, s_3_12, 0, 10, 0}, +{ 3, s_3_13, 0, 9, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[5] = { 'a', 't', 'i', 'e', 'f' }; +static const symbol s_4_2[4] = { 'e', 'r', 'i', 'g' }; +static const symbol s_4_3[6] = { 'a', 'c', 'h', 't', 'i', 'g' }; +static const symbol s_4_4[6] = { 'i', 'o', 'n', 'e', 'e', 'l' }; +static const symbol s_4_5[4] = { 'b', 'a', 'a', 'r' }; +static const symbol s_4_6[4] = { 'l', 'a', 'a', 'r' }; +static const symbol s_4_7[4] = { 'n', 'a', 'a', 'r' }; +static const symbol s_4_8[4] = { 'r', 'a', 'a', 'r' }; +static const symbol s_4_9[6] = { 'e', 'r', 'i', 'g', 'e', 'r' }; +static const symbol s_4_10[8] = { 'a', 'c', 'h', 't', 'i', 'g', 'e', 'r' }; +static const symbol s_4_11[6] = { 'l', 'i', 'j', 'k', 'e', 'r' }; +static const symbol s_4_12[4] = { 't', 'a', 'n', 't' }; +static const symbol s_4_13[6] = { 'e', 'r', 'i', 'g', 's', 't' }; +static const symbol s_4_14[8] = { 'a', 'c', 'h', 't', 'i', 'g', 's', 't' }; +static const symbol s_4_15[6] = { 'l', 'i', 'j', 'k', 's', 't' }; +static const struct among a_4[16] = { +{ 3, s_4_0, 0, 9, 0}, +{ 5, s_4_1, 0, 2, 0}, +{ 4, s_4_2, 0, 9, 0}, +{ 6, s_4_3, 0, 3, 0}, +{ 6, s_4_4, 0, 1, 0}, +{ 4, s_4_5, 0, 3, 0}, +{ 4, s_4_6, 0, 5, 0}, +{ 4, s_4_7, 0, 4, 0}, +{ 4, s_4_8, 0, 6, 0}, +{ 6, s_4_9, 0, 9, 0}, +{ 8, s_4_10, 0, 3, 0}, +{ 6, s_4_11, 0, 8, 0}, +{ 4, s_4_12, 0, 7, 0}, +{ 6, s_4_13, 0, 9, 0}, +{ 8, s_4_14, 0, 3, 0}, +{ 6, s_4_15, 0, 8, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'g' }; +static const symbol s_5_1[4] = { 'i', 'g', 'e', 'r' }; +static const symbol s_5_2[4] = { 'i', 'g', 's', 't' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[2] = { 'f', 't' }; +static const symbol s_6_1[2] = { 'k', 't' }; +static const symbol s_6_2[2] = { 'p', 't' }; +static const struct among a_6[3] = { +{ 2, s_6_0, 0, 2, 0}, +{ 2, s_6_1, 0, 1, 0}, +{ 2, s_6_2, 0, 3, 0} +}; + +static const symbol s_7_0[2] = { 'b', 'b' }; +static const symbol s_7_1[2] = { 'c', 'c' }; +static const symbol s_7_2[2] = { 'd', 'd' }; +static const symbol s_7_3[2] = { 'f', 'f' }; +static const symbol s_7_4[2] = { 'g', 'g' }; +static const symbol s_7_5[2] = { 'h', 'h' }; +static const symbol s_7_6[2] = { 'j', 'j' }; +static const symbol s_7_7[2] = { 'k', 'k' }; +static const symbol s_7_8[2] = { 'l', 'l' }; +static const symbol s_7_9[2] = { 'm', 'm' }; +static const symbol s_7_10[2] = { 'n', 'n' }; +static const symbol s_7_11[2] = { 'p', 'p' }; +static const symbol s_7_12[2] = { 'q', 'q' }; +static const symbol s_7_13[2] = { 'r', 'r' }; +static const symbol s_7_14[2] = { 's', 's' }; +static const symbol s_7_15[2] = { 't', 't' }; +static const symbol s_7_16[1] = { 'v' }; +static const symbol s_7_17[2] = { 'v', 'v' }; +static const symbol s_7_18[2] = { 'w', 'w' }; +static const symbol s_7_19[2] = { 'x', 'x' }; +static const symbol s_7_20[1] = { 'z' }; +static const symbol s_7_21[2] = { 'z', 'z' }; +static const struct among a_7[22] = { +{ 2, s_7_0, 0, 1, 0}, +{ 2, s_7_1, 0, 2, 0}, +{ 2, s_7_2, 0, 3, 0}, +{ 2, s_7_3, 0, 4, 0}, +{ 2, s_7_4, 0, 5, 0}, +{ 2, s_7_5, 0, 6, 0}, +{ 2, s_7_6, 0, 7, 0}, +{ 2, s_7_7, 0, 8, 0}, +{ 2, s_7_8, 0, 9, 0}, +{ 2, s_7_9, 0, 10, 0}, +{ 2, s_7_10, 0, 11, 0}, +{ 2, s_7_11, 0, 12, 0}, +{ 2, s_7_12, 0, 13, 0}, +{ 2, s_7_13, 0, 14, 0}, +{ 2, s_7_14, 0, 15, 0}, +{ 2, s_7_15, 0, 16, 0}, +{ 1, s_7_16, 0, 4, 0}, +{ 2, s_7_17, -1, 17, 0}, +{ 2, s_7_18, 0, 18, 0}, +{ 2, s_7_19, 0, 19, 0}, +{ 1, s_7_20, 0, 15, 0}, +{ 2, s_7_21, -1, 20, 0} +}; + +static const symbol s_8_0[1] = { 'd' }; +static const symbol s_8_1[1] = { 't' }; +static const struct among a_8[2] = { +{ 1, s_8_0, 0, 1, 0}, +{ 1, s_8_1, 0, 2, 0} +}; + +static const symbol s_9_1[3] = { 'e', 'f', 't' }; +static const symbol s_9_2[3] = { 'v', 'a', 'a' }; +static const symbol s_9_3[3] = { 'v', 'a', 'l' }; +static const symbol s_9_4[4] = { 'v', 'a', 'l', 'i' }; +static const symbol s_9_5[4] = { 'v', 'a', 'r', 'e' }; +static const struct among a_9[6] = { +{ 0, 0, 0, -1, 0}, +{ 3, s_9_1, -1, 1, 0}, +{ 3, s_9_2, -2, 1, 0}, +{ 3, s_9_3, -3, 1, 0}, +{ 4, s_9_4, -1, -1, 0}, +{ 4, s_9_5, -5, 1, 0} +}; + +static const symbol s_10_0[1] = { 0xEB }; +static const symbol s_10_1[1] = { 0xEF }; +static const struct among a_10[2] = { +{ 1, s_10_0, 0, 1, 0}, +{ 1, s_10_1, 0, 2, 0} +}; + +static const symbol s_11_0[1] = { 0xEB }; +static const symbol s_11_1[1] = { 0xEF }; +static const struct among a_11[2] = { +{ 1, s_11_0, 0, 1, 0}, +{ 1, s_11_1, 0, 2, 0} +}; + +static const unsigned char g_E[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120 }; + +static const unsigned char g_AIOU[] = { 1, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 11, 120, 46, 15 }; + +static const unsigned char g_AEIOU[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const unsigned char g_v_WX[] = { 17, 65, 208, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const symbol s_0[] = { 'i', 'j' }; +static const symbol s_1[] = { 'i', 'j' }; +static const symbol s_2[] = { 'i', 'j' }; +static const symbol s_3[] = { 'e', 0xEB, 'e' }; +static const symbol s_4[] = { 'i', 'e', 'e' }; +static const symbol s_5[] = { 'i', 'e' }; +static const symbol s_6[] = { 'a', 'r' }; +static const symbol s_7[] = { 'e', 'r' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 0xE9 }; +static const symbol s_10[] = { 'a', 'u' }; +static const symbol s_11[] = { 'h', 'e', 'd' }; +static const symbol s_12[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_13[] = { 'n', 'd' }; +static const symbol s_14[] = { 'n', 'd' }; +static const symbol s_15[] = { '\'', 't' }; +static const symbol s_16[] = { 'e', 't' }; +static const symbol s_17[] = { 'r', 'n', 't' }; +static const symbol s_18[] = { 'r', 'n' }; +static const symbol s_19[] = { 'i', 'n', 'k' }; +static const symbol s_20[] = { 'i', 'n', 'g' }; +static const symbol s_21[] = { 'm', 'p' }; +static const symbol s_22[] = { 'm' }; +static const symbol s_23[] = { 'g' }; +static const symbol s_24[] = { 'l', 'i', 'j', 'k' }; +static const symbol s_25[] = { 'i', 's', 'c', 'h' }; +static const symbol s_26[] = { 't' }; +static const symbol s_27[] = { 's' }; +static const symbol s_28[] = { 'r' }; +static const symbol s_29[] = { 'l' }; +static const symbol s_30[] = { 'e', 'n' }; +static const symbol s_31[] = { 'i', 'e', 'f' }; +static const symbol s_32[] = { 'e', 'e', 'r' }; +static const symbol s_33[] = { 'r' }; +static const symbol s_34[] = { 'i', 'l', 'd' }; +static const symbol s_35[] = { 'e', 'r' }; +static const symbol s_36[] = { 'a', 'a', 'r' }; +static const symbol s_37[] = { 'f' }; +static const symbol s_38[] = { 'g' }; +static const symbol s_39[] = { 't' }; +static const symbol s_40[] = { 'd' }; +static const symbol s_41[] = { 'i', 'e' }; +static const symbol s_42[] = { 'e', 'e', 'r' }; +static const symbol s_43[] = { 'n' }; +static const symbol s_44[] = { 'l' }; +static const symbol s_45[] = { 'r' }; +static const symbol s_46[] = { 't', 'e', 'e', 'r' }; +static const symbol s_47[] = { 'l', 'i', 'j', 'k' }; +static const symbol s_48[] = { 'i', 'n', 'n' }; +static const symbol s_49[] = { 'k' }; +static const symbol s_50[] = { 'f' }; +static const symbol s_51[] = { 'p' }; +static const symbol s_52[] = { 'b' }; +static const symbol s_53[] = { 'c' }; +static const symbol s_54[] = { 'd' }; +static const symbol s_55[] = { 'f' }; +static const symbol s_56[] = { 'g' }; +static const symbol s_57[] = { 'h' }; +static const symbol s_58[] = { 'j' }; +static const symbol s_59[] = { 'k' }; +static const symbol s_60[] = { 'l' }; +static const symbol s_61[] = { 'm' }; +static const symbol s_62[] = { 'n' }; +static const symbol s_63[] = { 'p' }; +static const symbol s_64[] = { 'q' }; +static const symbol s_65[] = { 'r' }; +static const symbol s_66[] = { 's' }; +static const symbol s_67[] = { 't' }; +static const symbol s_68[] = { 'v' }; +static const symbol s_69[] = { 'w' }; +static const symbol s_70[] = { 'x' }; +static const symbol s_71[] = { 'z' }; +static const symbol s_72[] = { 'i', 'n' }; +static const symbol s_73[] = { 'n' }; +static const symbol s_74[] = { 'e', 'n' }; +static const symbol s_75[] = { 'g', 'e' }; +static const symbol s_76[] = { 'i', 'j' }; +static const symbol s_77[] = { 'i', 'j' }; +static const symbol s_78[] = { 'e' }; +static const symbol s_79[] = { 'i' }; +static const symbol s_80[] = { 'g', 'e' }; +static const symbol s_81[] = { 'i', 'j' }; +static const symbol s_82[] = { 'i', 'j' }; +static const symbol s_83[] = { 'e' }; +static const symbol s_84[] = { 'i' }; +static const symbol s_85[] = { 'i', 'j' }; +static const symbol s_86[] = { 'i', 'j' }; + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_V(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + if (in_grouping_b(z, g_v, 97, 252, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_0))) return 0; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_VX(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c <= z->lb) return 0; + z->c--; + { + int v_2 = z->l - z->c; + if (in_grouping_b(z, g_v, 97, 252, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_1))) return 0; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_C(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_2))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + if (out_grouping_b(z, g_v, 97, 252, 0)) return 0; + z->c = z->l - v_1; + } + return 1; +} + +static int r_lengthen_V(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + if (out_grouping_b(z, g_v_WX, 97, 252, 0)) goto lab0; + z->ket = z->c; + among_var = find_among_b(z, a_0, 21); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (out_grouping_b(z, g_AEIOU, 97, 252, 0)) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + if (z->c > z->lb) goto lab0; + } + lab1: + z->c = z->l - v_2; + } + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + { + int saved_c = z->c; + int ret = insert_v(z, z->c, z->c, z->S[0]); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 2: + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + if (out_grouping_b(z, g_AEIOU, 97, 252, 0)) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_5; + if (z->c > z->lb) goto lab0; + } + lab3: + { + int v_6 = z->l - z->c; + { + int v_7 = z->l - z->c; + if (in_grouping_b(z, g_AIOU, 97, 252, 0)) goto lab7; + goto lab6; + lab7: + z->c = z->l - v_7; + if (in_grouping_b(z, g_E, 101, 235, 0)) goto lab5; + if (z->c > z->lb) goto lab5; + } + lab6: + goto lab0; + lab5: + z->c = z->l - v_6; + } + { + int v_8 = z->l - z->c; + if (z->c <= z->lb) goto lab8; + z->c--; + if (in_grouping_b(z, g_AIOU, 97, 252, 0)) goto lab8; + if (out_grouping_b(z, g_AEIOU, 97, 252, 0)) goto lab8; + goto lab0; + lab8: + z->c = z->l - v_8; + } + z->c = z->l - v_4; + } + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + { + int saved_c = z->c; + int ret = insert_v(z, z->c, z->c, z->S[0]); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_3); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 3, s_4); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_Step_1(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 8); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 't') goto lab0; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 4: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 2, s_6))) goto lab2; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_7))) goto lab3; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab1; + lab3: + z->c = z->l - v_2; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + } + lab1: + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_V(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + break; + case 7: + { + int v_5 = z->l - z->c; + if (!(eq_s_b(z, 3, s_11))) goto lab5; + { + int ret = r_R1(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_from_s(z, 4, s_12); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_5; + if (!(eq_s_b(z, 2, s_13))) goto lab6; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab6: + z->c = z->l - v_5; + if (z->c <= z->lb || z->p[z->c - 1] != 'd') goto lab7; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab7: + z->c = z->l - v_5; + { + int v_6 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab10; + z->c--; + goto lab9; + lab10: + z->c = z->l - v_6; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab8; + z->c--; + } + lab9: + { + int ret = r_V(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab8: + z->c = z->l - v_5; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } + lab4: + break; + case 8: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 101) return 0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 2, s_15))) goto lab1; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_16))) goto lab2; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab2: + z->c = z->l - v_1; + if (!(eq_s_b(z, 3, s_17))) goto lab3; + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + goto lab0; + lab3: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') goto lab4; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + { + int ret = r_VX(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab4: + z->c = z->l - v_1; + if (!(eq_s_b(z, 3, s_19))) goto lab5; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_20); + if (ret < 0) return ret; + } + goto lab0; + lab5: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_21))) goto lab6; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_22); + if (ret < 0) return ret; + } + goto lab0; + lab6: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != '\'') goto lab7; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab7: + z->c = z->l - v_1; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_23); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_24); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_25); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_26); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_27); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_28); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_29); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 2, s_30); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 11: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1316016 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 14); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_32); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_33); + if (ret < 0) return ret; + } + break; + case 5: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 3, s_34))) goto lab1; + { + int ret = slice_from_s(z, 2, s_35); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } + lab0: + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_36); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_37); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_38); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_39); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_40); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1315024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_4, 16); + if (!among_var) goto lab1; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_41); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_42); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_43); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_44); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_45); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_46); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_47); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret < 0) return ret; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1310848 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_5, 3)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 3, s_48))) goto lab2; + if (z->c > z->lb) goto lab2; + return 0; + lab2: + z->c = z->l - v_2; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } +lab0: + return 1; +} + +static int r_Step_7(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) return 0; + among_var = find_among_b(z, a_6, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_49); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_50); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_51); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_6(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((98532828 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 22); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_52); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_53); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_54); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_55); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_56); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_57); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_58); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 1, s_59); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_60); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_61); + if (ret < 0) return ret; + } + break; + case 11: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab0; + z->c--; + if (z->c > z->lb) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = slice_from_s(z, 1, s_62); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 1, s_63); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 1, s_64); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 1, s_65); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 1, s_66); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 1, s_67); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 1, s_68); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 1, s_69); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 1, s_70); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 1, s_71); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) return 0; + among_var = find_among_b(z, a_8, 2); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') goto lab0; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_72))) goto lab2; + if (z->c > z->lb) goto lab2; + { + int ret = slice_from_s(z, 1, s_73); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab1: + break; + case 2: + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'h') goto lab3; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + return 0; + lab3: + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_74))) goto lab4; + if (z->c > z->lb) goto lab4; + return 0; + lab4: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Lose_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (!(eq_s(z, 2, s_75))) return 0; + z->ket = z->c; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_76))) goto lab2; + goto lab1; + lab2: + z->c = v_4; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab0; + } + lab1: + break; + lab0: + z->c = v_3; + if (z->c >= z->l) return 0; + z->c++; + } + while (1) { + int v_5 = z->c; + { + int v_6 = z->c; + if (!(eq_s(z, 2, s_77))) goto lab5; + goto lab4; + lab5: + z->c = v_6; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab3; + } + lab4: + continue; + lab3: + z->c = v_5; + break; + } + if (z->c < z->l) goto lab6; + return 0; + lab6: + z->c = v_2; + } + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((1314818 >> (z->p[z->c + 2] & 0x1f)) & 1)) among_var = -1; else + among_var = find_among(z, a_9, 6); + switch (among_var) { + case 1: + return 0; + break; + } + z->I[2] = 1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_7 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 235 && z->p[z->c + 0] != 239)) goto lab7; + among_var = find_among(z, a_10, 2); + if (!among_var) goto lab7; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_78); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_79); + if (ret < 0) return ret; + } + break; + } + lab7: + z->c = v_7; + } + return 1; +} + +static int r_Lose_infix(struct SN_env * z) { + int among_var; + if (z->c >= z->l) return 0; + z->c++; + while (1) { + z->bra = z->c; + if (!(eq_s(z, 2, s_80))) goto lab0; + z->ket = z->c; + break; + lab0: + if (z->c >= z->l) return 0; + z->c++; + } + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_81))) goto lab3; + goto lab2; + lab3: + z->c = v_4; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab1; + } + lab2: + break; + lab1: + z->c = v_3; + if (z->c >= z->l) return 0; + z->c++; + } + while (1) { + int v_5 = z->c; + { + int v_6 = z->c; + if (!(eq_s(z, 2, s_82))) goto lab6; + goto lab5; + lab6: + z->c = v_6; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab4; + } + lab5: + continue; + lab4: + z->c = v_5; + break; + } + if (z->c < z->l) goto lab7; + return 0; + lab7: + z->c = v_2; + } + z->I[2] = 1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_7 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 235 && z->p[z->c + 0] != 239)) goto lab8; + among_var = find_among(z, a_11, 2); + if (!among_var) goto lab8; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_83); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_84); + if (ret < 0) return ret; + } + break; + } + lab8: + z->c = v_7; + } + return 1; +} + +static int r_measure(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + while (1) { + if (out_grouping(z, g_v, 97, 252, 0)) goto lab1; + continue; + lab1: + break; + } + { + int v_2 = 1; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_85))) goto lab4; + goto lab3; + lab4: + z->c = v_4; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab2; + } + lab3: + v_2--; + continue; + lab2: + z->c = v_3; + break; + } + if (v_2 > 0) goto lab0; + } + if (out_grouping(z, g_v, 97, 252, 0)) goto lab0; + z->I[1] = z->c; + while (1) { + if (out_grouping(z, g_v, 97, 252, 0)) goto lab5; + continue; + lab5: + break; + } + { + int v_5 = 1; + while (1) { + int v_6 = z->c; + { + int v_7 = z->c; + if (!(eq_s(z, 2, s_86))) goto lab8; + goto lab7; + lab8: + z->c = v_7; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab6; + } + lab7: + v_5--; + continue; + lab6: + z->c = v_6; + break; + } + if (v_5 > 0) goto lab0; + } + if (out_grouping(z, g_v, 97, 252, 0)) goto lab0; + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +extern int dutch_ISO_8859_1_stem(struct SN_env * z) { + z->I[3] = 0; + { + int ret = r_measure(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_Step_1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab1: + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab2: + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab3: + z->c = z->l - v_4; + } + z->c = z->lb; + z->I[2] = 0; + { + int v_5 = z->c; + { + int v_6 = z->c; + { + int ret = r_Lose_prefix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + z->c = v_6; + { + int ret = r_measure(z); + if (ret < 0) return ret; + } + } + lab4: + z->c = v_5; + } + z->lb = z->c; z->c = z->l; + { + int v_7 = z->l - z->c; + if (!(z->I[2])) goto lab5; + z->I[3] = 1; + { + int ret = r_Step_1c(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_7; + } + z->c = z->lb; + z->I[2] = 0; + { + int v_8 = z->c; + { + int v_9 = z->c; + { + int ret = r_Lose_infix(z); + if (ret == 0) goto lab6; + if (ret < 0) return ret; + } + z->c = v_9; + { + int ret = r_measure(z); + if (ret < 0) return ret; + } + } + lab6: + z->c = v_8; + } + z->lb = z->c; z->c = z->l; + { + int v_10 = z->l - z->c; + if (!(z->I[2])) goto lab7; + z->I[3] = 1; + { + int ret = r_Step_1c(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + lab7: + z->c = z->l - v_10; + } + z->c = z->lb; + z->lb = z->c; z->c = z->l; + { + int v_11 = z->l - z->c; + { + int ret = r_Step_7(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab8: + z->c = z->l - v_11; + } + { + int v_12 = z->l - z->c; + if (!(z->I[3])) goto lab9; + { + int ret = r_Step_6(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + lab9: + z->c = z->l - v_12; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * dutch_ISO_8859_1_create_env(void) { return SN_create_env(1, 4); } + +extern void dutch_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.h new file mode 100644 index 000000000000..8bc556d05fd7 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch.h @@ -0,0 +1,15 @@ +/* Generated from dutch.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_ISO_8859_1_create_env(void); +extern void dutch_ISO_8859_1_close_env(struct SN_env * z); + +extern int dutch_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.c new file mode 100644 index 000000000000..0427505dae08 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.c @@ -0,0 +1,661 @@ +/* Generated from dutch_porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int dutch_porter_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_en_ending(struct SN_env * z); +static int r_e_ending(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * dutch_porter_ISO_8859_1_create_env(void); +extern void dutch_porter_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xE1 }; +static const symbol s_0_2[1] = { 0xE4 }; +static const symbol s_0_3[1] = { 0xE9 }; +static const symbol s_0_4[1] = { 0xEB }; +static const symbol s_0_5[1] = { 0xED }; +static const symbol s_0_6[1] = { 0xEF }; +static const symbol s_0_7[1] = { 0xF3 }; +static const symbol s_0_8[1] = { 0xF6 }; +static const symbol s_0_9[1] = { 0xFA }; +static const symbol s_0_10[1] = { 0xFC }; +static const struct among a_0[11] = { +{ 0, 0, 0, 6, 0}, +{ 1, s_0_1, -1, 1, 0}, +{ 1, s_0_2, -2, 1, 0}, +{ 1, s_0_3, -3, 2, 0}, +{ 1, s_0_4, -4, 2, 0}, +{ 1, s_0_5, -5, 3, 0}, +{ 1, s_0_6, -6, 3, 0}, +{ 1, s_0_7, -7, 4, 0}, +{ 1, s_0_8, -8, 4, 0}, +{ 1, s_0_9, -9, 5, 0}, +{ 1, s_0_10, -10, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'Y' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_1_1, -1, 2, 0}, +{ 1, s_1_2, -2, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'd' }; +static const symbol s_2_1[2] = { 'k', 'k' }; +static const symbol s_2_2[2] = { 't', 't' }; +static const struct among a_2[3] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0} +}; + +static const symbol s_3_0[3] = { 'e', 'n', 'e' }; +static const symbol s_3_1[2] = { 's', 'e' }; +static const symbol s_3_2[2] = { 'e', 'n' }; +static const symbol s_3_3[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_3_4[1] = { 's' }; +static const struct among a_3[5] = { +{ 3, s_3_0, 0, 2, 0}, +{ 2, s_3_1, 0, 3, 0}, +{ 2, s_3_2, 0, 2, 0}, +{ 5, s_3_3, -1, 1, 0}, +{ 1, s_3_4, 0, 3, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[2] = { 'i', 'g' }; +static const symbol s_4_2[3] = { 'i', 'n', 'g' }; +static const symbol s_4_3[4] = { 'l', 'i', 'j', 'k' }; +static const symbol s_4_4[4] = { 'b', 'a', 'a', 'r' }; +static const symbol s_4_5[3] = { 'b', 'a', 'r' }; +static const struct among a_4[6] = { +{ 3, s_4_0, 0, 1, 0}, +{ 2, s_4_1, 0, 2, 0}, +{ 3, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 3, 0}, +{ 4, s_4_4, 0, 4, 0}, +{ 3, s_4_5, 0, 5, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'o', 'o' }; +static const symbol s_5_3[2] = { 'u', 'u' }; +static const struct among a_5[4] = { +{ 2, s_5_0, 0, -1, 0}, +{ 2, s_5_1, 0, -1, 0}, +{ 2, s_5_2, 0, -1, 0}, +{ 2, s_5_3, 0, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_I[] = { 1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_j[] = { 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { 'Y' }; +static const symbol s_6[] = { 'I' }; +static const symbol s_7[] = { 'Y' }; +static const symbol s_8[] = { 'y' }; +static const symbol s_9[] = { 'i' }; +static const symbol s_10[] = { 'g', 'e', 'm' }; +static const symbol s_11[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_12[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_13[] = { 'e', 'n' }; +static const symbol s_14[] = { 'i', 'g' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 7 || !((340306450 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 6; else + among_var = find_among(z, a_0, 11); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int v_3 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_3; goto lab1; } + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + lab1: + ; + } + while (1) { + int v_4 = z->c; + { + int ret = out_grouping(z, g_v, 97, 232, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + { + int v_5 = z->c; + z->bra = z->c; + { + int v_6 = z->c; + if (z->c == z->l || z->p[z->c] != 'i') goto lab5; + z->c++; + z->ket = z->c; + { + int v_7 = z->c; + if (in_grouping(z, g_v, 97, 232, 0)) goto lab6; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + lab6: + z->c = v_7; + } + goto lab4; + lab5: + z->c = v_6; + if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_5; goto lab3; } + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + } + lab4: + lab3: + ; + } + continue; + lab2: + z->c = v_4; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[2] = z->c; + if (z->I[2] >= z->I[0]) goto lab0; + z->I[2] = z->I[0]; +lab0: + { + int ret = out_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 89)) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_undouble(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1050640 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_2, 3)) return 0; + z->c = z->l - v_1; + } + z->ket = z->c; + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_e_ending(struct SN_env * z) { + z->I[3] = 0; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (out_grouping_b(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[3] = 1; + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_en_ending(struct SN_env * z) { + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (out_grouping_b(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - v_1; + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 3, s_10))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_3, 5); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_en_ending(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + if (out_grouping_b(z, g_v_j, 97, 232, 0)) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_e_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 4, s_12))) goto lab1; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') goto lab2; + z->c--; + goto lab1; + lab2: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_13))) goto lab1; + z->bra = z->c; + { + int ret = r_en_ending(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + lab1: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((264336 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among_b(z, a_4, 6); + if (!among_var) goto lab3; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_6 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_14))) goto lab5; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int v_7 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab6; + z->c--; + goto lab5; + lab6: + z->c = z->l - v_7; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_6; + { + int ret = r_undouble(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + } + lab4: + break; + case 2: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab7; + z->c--; + goto lab3; + lab7: + z->c = z->l - v_8; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_e_ending(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + if (!(z->I[3])) goto lab3; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab3: + z->c = z->l - v_5; + } + { + int v_9 = z->l - z->c; + if (out_grouping_b(z, g_v_I, 73, 232, 0)) goto lab8; + { + int v_10 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2129954 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab8; + if (!find_among_b(z, a_5, 4)) goto lab8; + if (out_grouping_b(z, g_v, 97, 232, 0)) goto lab8; + z->c = z->l - v_10; + } + z->ket = z->c; + if (z->c <= z->lb) goto lab8; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab8: + z->c = z->l - v_9; + } + return 1; +} + +extern int dutch_porter_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->lb; + { + int v_3 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_3; + } + return 1; +} + +extern struct SN_env * dutch_porter_ISO_8859_1_create_env(void) { return SN_create_env(0, 4); } + +extern void dutch_porter_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.h new file mode 100644 index 000000000000..07f20d3e0039 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_dutch_porter.h @@ -0,0 +1,15 @@ +/* Generated from dutch_porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_porter_ISO_8859_1_create_env(void); +extern void dutch_porter_ISO_8859_1_close_env(struct SN_env * z); + +extern int dutch_porter_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.c new file mode 100644 index 000000000000..7b407f46f01c --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.c @@ -0,0 +1,1155 @@ +/* Generated from english.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int english_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_exception1(struct SN_env * z); +static int r_Step_5(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * english_ISO_8859_1_create_env(void); +extern void english_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[5] = { 'a', 'r', 's', 'e', 'n' }; +static const symbol s_0_1[6] = { 'c', 'o', 'm', 'm', 'u', 'n' }; +static const symbol s_0_2[5] = { 'e', 'm', 'e', 'r', 'g' }; +static const symbol s_0_3[5] = { 'g', 'e', 'n', 'e', 'r' }; +static const symbol s_0_4[5] = { 'l', 'a', 't', 'e', 'r' }; +static const symbol s_0_5[5] = { 'o', 'r', 'g', 'a', 'n' }; +static const symbol s_0_6[4] = { 'p', 'a', 's', 't' }; +static const symbol s_0_7[7] = { 'u', 'n', 'i', 'v', 'e', 'r', 's' }; +static const struct among a_0[8] = { +{ 5, s_0_0, 0, -1, 0}, +{ 6, s_0_1, 0, -1, 0}, +{ 5, s_0_2, 0, -1, 0}, +{ 5, s_0_3, 0, -1, 0}, +{ 5, s_0_4, 0, -1, 0}, +{ 5, s_0_5, 0, -1, 0}, +{ 4, s_0_6, 0, -1, 0}, +{ 7, s_0_7, 0, -1, 0} +}; + +static const symbol s_1_0[1] = { '\'' }; +static const symbol s_1_1[3] = { '\'', 's', '\'' }; +static const symbol s_1_2[2] = { '\'', 's' }; +static const struct among a_1[3] = { +{ 1, s_1_0, 0, 1, 0}, +{ 3, s_1_1, -1, 1, 0}, +{ 2, s_1_2, 0, 1, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'e', 'd' }; +static const symbol s_2_1[1] = { 's' }; +static const symbol s_2_2[3] = { 'i', 'e', 's' }; +static const symbol s_2_3[4] = { 's', 's', 'e', 's' }; +static const symbol s_2_4[2] = { 's', 's' }; +static const symbol s_2_5[2] = { 'u', 's' }; +static const struct among a_2[6] = { +{ 3, s_2_0, 0, 2, 0}, +{ 1, s_2_1, 0, 3, 0}, +{ 3, s_2_2, -1, 2, 0}, +{ 4, s_2_3, -2, 1, 0}, +{ 2, s_2_4, -3, -1, 0}, +{ 2, s_2_5, -4, -1, 0} +}; + +static const symbol s_3_0[4] = { 's', 'u', 'c', 'c' }; +static const symbol s_3_1[4] = { 'p', 'r', 'o', 'c' }; +static const symbol s_3_2[3] = { 'e', 'x', 'c' }; +static const struct among a_3[3] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 3, s_3_2, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 'e', 'v', 'e', 'n' }; +static const symbol s_4_1[4] = { 'c', 'a', 'n', 'n' }; +static const symbol s_4_2[3] = { 'i', 'n', 'n' }; +static const symbol s_4_3[4] = { 'e', 'a', 'r', 'r' }; +static const symbol s_4_4[4] = { 'h', 'e', 'r', 'r' }; +static const symbol s_4_5[3] = { 'o', 'u', 't' }; +static const symbol s_4_6[1] = { 'y' }; +static const struct among a_4[7] = { +{ 4, s_4_0, 0, 2, 0}, +{ 4, s_4_1, 0, 2, 0}, +{ 3, s_4_2, 0, 2, 0}, +{ 4, s_4_3, 0, 2, 0}, +{ 4, s_4_4, 0, 2, 0}, +{ 3, s_4_5, 0, 2, 0}, +{ 1, s_4_6, 0, 1, 0} +}; + +static const symbol s_5_1[2] = { 'e', 'd' }; +static const symbol s_5_2[3] = { 'e', 'e', 'd' }; +static const symbol s_5_3[3] = { 'i', 'n', 'g' }; +static const symbol s_5_4[4] = { 'e', 'd', 'l', 'y' }; +static const symbol s_5_5[5] = { 'e', 'e', 'd', 'l', 'y' }; +static const symbol s_5_6[5] = { 'i', 'n', 'g', 'l', 'y' }; +static const struct among a_5[7] = { +{ 0, 0, 0, -1, 0}, +{ 2, s_5_1, -1, 2, 0}, +{ 3, s_5_2, -1, 1, 0}, +{ 3, s_5_3, -3, 3, 0}, +{ 4, s_5_4, -4, 2, 0}, +{ 5, s_5_5, -1, 1, 0}, +{ 5, s_5_6, -6, 2, 0} +}; + +static const symbol s_6_1[2] = { 'b', 'b' }; +static const symbol s_6_2[2] = { 'd', 'd' }; +static const symbol s_6_3[2] = { 'f', 'f' }; +static const symbol s_6_4[2] = { 'g', 'g' }; +static const symbol s_6_5[2] = { 'b', 'l' }; +static const symbol s_6_6[2] = { 'm', 'm' }; +static const symbol s_6_7[2] = { 'n', 'n' }; +static const symbol s_6_8[2] = { 'p', 'p' }; +static const symbol s_6_9[2] = { 'r', 'r' }; +static const symbol s_6_10[2] = { 'a', 't' }; +static const symbol s_6_11[2] = { 't', 't' }; +static const symbol s_6_12[2] = { 'i', 'z' }; +static const struct among a_6[13] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_6_1, -1, 2, 0}, +{ 2, s_6_2, -2, 2, 0}, +{ 2, s_6_3, -3, 2, 0}, +{ 2, s_6_4, -4, 2, 0}, +{ 2, s_6_5, -5, 1, 0}, +{ 2, s_6_6, -6, 2, 0}, +{ 2, s_6_7, -7, 2, 0}, +{ 2, s_6_8, -8, 2, 0}, +{ 2, s_6_9, -9, 2, 0}, +{ 2, s_6_10, -10, 1, 0}, +{ 2, s_6_11, -11, 2, 0}, +{ 2, s_6_12, -12, 1, 0} +}; + +static const symbol s_7_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_7_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_7_2[3] = { 'o', 'g', 'i' }; +static const symbol s_7_3[2] = { 'l', 'i' }; +static const symbol s_7_4[3] = { 'b', 'l', 'i' }; +static const symbol s_7_5[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_7_6[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_7_7[5] = { 'f', 'u', 'l', 'l', 'i' }; +static const symbol s_7_8[6] = { 'l', 'e', 's', 's', 'l', 'i' }; +static const symbol s_7_9[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_7_10[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_7_11[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_7_12[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_7_13[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_7_14[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_7_15[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_7_16[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_7_17[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_7_18[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_7_19[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_7_20[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_7_21[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_7_22[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_7_23[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; +static const symbol s_7_24[5] = { 'o', 'g', 'i', 's', 't' }; +static const struct among a_7[25] = { +{ 4, s_7_0, 0, 3, 0}, +{ 4, s_7_1, 0, 2, 0}, +{ 3, s_7_2, 0, 14, 0}, +{ 2, s_7_3, 0, 16, 0}, +{ 3, s_7_4, -1, 12, 0}, +{ 4, s_7_5, -1, 4, 0}, +{ 4, s_7_6, -3, 8, 0}, +{ 5, s_7_7, -4, 9, 0}, +{ 6, s_7_8, -5, 15, 0}, +{ 5, s_7_9, -6, 10, 0}, +{ 5, s_7_10, -7, 5, 0}, +{ 5, s_7_11, 0, 8, 0}, +{ 6, s_7_12, 0, 12, 0}, +{ 5, s_7_13, 0, 11, 0}, +{ 6, s_7_14, 0, 1, 0}, +{ 7, s_7_15, -1, 7, 0}, +{ 5, s_7_16, 0, 8, 0}, +{ 5, s_7_17, 0, 7, 0}, +{ 7, s_7_18, -1, 6, 0}, +{ 4, s_7_19, 0, 6, 0}, +{ 4, s_7_20, 0, 7, 0}, +{ 7, s_7_21, 0, 11, 0}, +{ 7, s_7_22, 0, 9, 0}, +{ 7, s_7_23, 0, 10, 0}, +{ 5, s_7_24, 0, 13, 0} +}; + +static const symbol s_8_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_8_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_8_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_8_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_8_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_8_5[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_8_6[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_8_7[3] = { 'f', 'u', 'l' }; +static const symbol s_8_8[4] = { 'n', 'e', 's', 's' }; +static const struct among a_8[9] = { +{ 5, s_8_0, 0, 4, 0}, +{ 5, s_8_1, 0, 6, 0}, +{ 5, s_8_2, 0, 3, 0}, +{ 5, s_8_3, 0, 4, 0}, +{ 4, s_8_4, 0, 4, 0}, +{ 6, s_8_5, 0, 1, 0}, +{ 7, s_8_6, -1, 2, 0}, +{ 3, s_8_7, 0, 5, 0}, +{ 4, s_8_8, 0, 5, 0} +}; + +static const symbol s_9_0[2] = { 'i', 'c' }; +static const symbol s_9_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_9_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_9_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_9_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_9_5[3] = { 'a', 't', 'e' }; +static const symbol s_9_6[3] = { 'i', 'v', 'e' }; +static const symbol s_9_7[3] = { 'i', 'z', 'e' }; +static const symbol s_9_8[3] = { 'i', 't', 'i' }; +static const symbol s_9_9[2] = { 'a', 'l' }; +static const symbol s_9_10[3] = { 'i', 's', 'm' }; +static const symbol s_9_11[3] = { 'i', 'o', 'n' }; +static const symbol s_9_12[2] = { 'e', 'r' }; +static const symbol s_9_13[3] = { 'o', 'u', 's' }; +static const symbol s_9_14[3] = { 'a', 'n', 't' }; +static const symbol s_9_15[3] = { 'e', 'n', 't' }; +static const symbol s_9_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_9_17[5] = { 'e', 'm', 'e', 'n', 't' }; +static const struct among a_9[18] = { +{ 2, s_9_0, 0, 1, 0}, +{ 4, s_9_1, 0, 1, 0}, +{ 4, s_9_2, 0, 1, 0}, +{ 4, s_9_3, 0, 1, 0}, +{ 4, s_9_4, 0, 1, 0}, +{ 3, s_9_5, 0, 1, 0}, +{ 3, s_9_6, 0, 1, 0}, +{ 3, s_9_7, 0, 1, 0}, +{ 3, s_9_8, 0, 1, 0}, +{ 2, s_9_9, 0, 1, 0}, +{ 3, s_9_10, 0, 1, 0}, +{ 3, s_9_11, 0, 2, 0}, +{ 2, s_9_12, 0, 1, 0}, +{ 3, s_9_13, 0, 1, 0}, +{ 3, s_9_14, 0, 1, 0}, +{ 3, s_9_15, 0, 1, 0}, +{ 4, s_9_16, -1, 1, 0}, +{ 5, s_9_17, -1, 1, 0} +}; + +static const symbol s_10_0[1] = { 'e' }; +static const symbol s_10_1[1] = { 'l' }; +static const struct among a_10[2] = { +{ 1, s_10_0, 0, 1, 0}, +{ 1, s_10_1, 0, 2, 0} +}; + +static const symbol s_11_0[5] = { 'a', 'n', 'd', 'e', 's' }; +static const symbol s_11_1[5] = { 'a', 't', 'l', 'a', 's' }; +static const symbol s_11_2[4] = { 'b', 'i', 'a', 's' }; +static const symbol s_11_3[6] = { 'c', 'o', 's', 'm', 'o', 's' }; +static const symbol s_11_4[5] = { 'e', 'a', 'r', 'l', 'y' }; +static const symbol s_11_5[6] = { 'g', 'e', 'n', 't', 'l', 'y' }; +static const symbol s_11_6[4] = { 'h', 'o', 'w', 'e' }; +static const symbol s_11_7[4] = { 'i', 'd', 'l', 'y' }; +static const symbol s_11_8[4] = { 'n', 'e', 'w', 's' }; +static const symbol s_11_9[4] = { 'o', 'n', 'l', 'y' }; +static const symbol s_11_10[6] = { 's', 'i', 'n', 'g', 'l', 'y' }; +static const symbol s_11_11[5] = { 's', 'k', 'i', 'e', 's' }; +static const symbol s_11_12[3] = { 's', 'k', 'y' }; +static const symbol s_11_13[4] = { 'u', 'g', 'l', 'y' }; +static const struct among a_11[14] = { +{ 5, s_11_0, 0, -1, 0}, +{ 5, s_11_1, 0, -1, 0}, +{ 4, s_11_2, 0, -1, 0}, +{ 6, s_11_3, 0, -1, 0}, +{ 5, s_11_4, 0, 5, 0}, +{ 6, s_11_5, 0, 3, 0}, +{ 4, s_11_6, 0, -1, 0}, +{ 4, s_11_7, 0, 2, 0}, +{ 4, s_11_8, 0, -1, 0}, +{ 4, s_11_9, 0, 6, 0}, +{ 6, s_11_10, 0, 7, 0}, +{ 5, s_11_11, 0, 1, 0}, +{ 3, s_11_12, 0, -1, 0}, +{ 4, s_11_13, 0, 4, 0} +}; + +static const unsigned char g_aeo[] = { 17, 64 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const unsigned char g_valid_LI[] = { 55, 141, 2 }; + +static const symbol s_0[] = { 'Y' }; +static const symbol s_1[] = { 'Y' }; +static const symbol s_2[] = { 'p', 'a', 's', 't' }; +static const symbol s_3[] = { 's', 's' }; +static const symbol s_4[] = { 'i' }; +static const symbol s_5[] = { 'i', 'e' }; +static const symbol s_6[] = { 'e', 'e' }; +static const symbol s_7[] = { 'i', 'e' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 'e' }; +static const symbol s_10[] = { 'i' }; +static const symbol s_11[] = { 't', 'i', 'o', 'n' }; +static const symbol s_12[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_13[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_14[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_15[] = { 'e', 'n', 't' }; +static const symbol s_16[] = { 'i', 'z', 'e' }; +static const symbol s_17[] = { 'a', 't', 'e' }; +static const symbol s_18[] = { 'a', 'l' }; +static const symbol s_19[] = { 'f', 'u', 'l' }; +static const symbol s_20[] = { 'o', 'u', 's' }; +static const symbol s_21[] = { 'i', 'v', 'e' }; +static const symbol s_22[] = { 'b', 'l', 'e' }; +static const symbol s_23[] = { 'o', 'g' }; +static const symbol s_24[] = { 'o', 'g' }; +static const symbol s_25[] = { 'l', 'e', 's', 's' }; +static const symbol s_26[] = { 't', 'i', 'o', 'n' }; +static const symbol s_27[] = { 'a', 't', 'e' }; +static const symbol s_28[] = { 'a', 'l' }; +static const symbol s_29[] = { 'i', 'c' }; +static const symbol s_30[] = { 's', 'k', 'y' }; +static const symbol s_31[] = { 'i', 'd', 'l' }; +static const symbol s_32[] = { 'g', 'e', 'n', 't', 'l' }; +static const symbol s_33[] = { 'u', 'g', 'l', 'i' }; +static const symbol s_34[] = { 'e', 'a', 'r', 'l', 'i' }; +static const symbol s_35[] = { 'o', 'n', 'l', 'i' }; +static const symbol s_36[] = { 's', 'i', 'n', 'g', 'l' }; +static const symbol s_37[] = { 'y' }; + +static int r_prelude(struct SN_env * z) { + z->I[2] = 0; + { + int v_1 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != '\'') goto lab0; + z->c++; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab1; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + z->I[2] = 1; + lab1: + z->c = v_2; + } + { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + while (1) { + int v_5 = z->c; + if (in_grouping(z, g_v, 97, 121, 0)) goto lab4; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab4; + z->c++; + z->ket = z->c; + z->c = v_5; + break; + lab4: + z->c = v_5; + if (z->c >= z->l) goto lab3; + z->c++; + } + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + z->I[2] = 1; + continue; + lab3: + z->c = v_4; + break; + } + z->c = v_3; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (z->c + 3 >= z->l || z->p[z->c + 3] >> 5 != 3 || !((5513250 >> (z->p[z->c + 3] & 0x1f)) & 1)) goto lab2; + if (!find_among(z, a_0, 8)) goto lab2; + goto lab1; + lab2: + z->c = v_2; + { + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_shortv(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (out_grouping_b(z, g_v_WXY, 89, 121, 0)) goto lab1; + if (in_grouping_b(z, g_v, 97, 121, 0)) goto lab1; + if (out_grouping_b(z, g_v, 97, 121, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (out_grouping_b(z, g_v, 97, 121, 0)) goto lab2; + if (in_grouping_b(z, g_v, 97, 121, 0)) goto lab2; + if (z->c > z->lb) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_1; + if (!(eq_s_b(z, 4, s_2))) return 0; + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 39 && z->p[z->c - 1] != 115)) { z->c = z->l - v_1; goto lab0; } + if (!find_among_b(z, a_1, 3)) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 115)) return 0; + among_var = find_among_b(z, a_2, 6); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; +z->c = z->c - 2; + if (z->c < z->lb) goto lab2; + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + } + lab1: + break; + case 3: + if (z->c <= z->lb) return 0; + z->c--; + { + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33554576 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = -1; else + among_var = find_among_b(z, a_5, 7); + z->bra = z->c; + { + int v_1 = z->l - z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 99) goto lab4; + if (!find_among_b(z, a_3, 3)) goto lab4; + if (z->c > z->lb) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_3; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_6); + if (ret < 0) return ret; + } + } + lab3: + lab2: + z->c = z->l - v_2; + } + break; + case 2: + goto lab1; + break; + case 3: + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((34881536 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_4, 7); + if (!among_var) goto lab1; + switch (among_var) { + case 1: + { + int v_4 = z->l - z->c; + if (out_grouping_b(z, g_v, 97, 121, 0)) goto lab1; + if (z->c > z->lb) goto lab1; + z->c = z->l - v_4; + } + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 2: + if (z->c > z->lb) goto lab1; + break; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_5 = z->l - z->c; + { + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - v_5; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + z->bra = z->c; + { + int v_6 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_6, 13); + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + return 0; + break; + case 2: + { + int v_7 = z->l - z->c; + if (in_grouping_b(z, g_aeo, 97, 111, 0)) goto lab5; + if (z->c > z->lb) goto lab5; + return 0; + lab5: + z->c = z->l - v_7; + } + break; + case 3: + if (z->c != z->I[1]) return 0; + { + int v_8 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_8; + } + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + return 0; + break; + } + z->c = z->l - v_6; + } + z->ket = z->c; + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') return 0; + z->c--; + } +lab0: + z->bra = z->c; + if (out_grouping_b(z, g_v, 97, 121, 0)) return 0; + if (z->c > z->lb) goto lab2; + return 0; +lab2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1864192 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 25); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_12); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_14); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_15); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 3, s_19); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 3, s_20); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 3, s_22); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 2, s_23); + if (ret < 0) return ret; + } + break; + case 14: + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_from_s(z, 2, s_24); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 4, s_25); + if (ret < 0) return ret; + } + break; + case 16: + if (in_grouping_b(z, g_valid_LI, 99, 116, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_8, 9); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_26); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_27); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_28); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_29); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1864232 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_9, 18); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 101 && z->p[z->c - 1] != 108)) return 0; + among_var = find_among_b(z, a_10, 2); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; + lab1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - v_1; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_exception1(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((42750482 >> (z->p[z->c + 2] & 0x1f)) & 1)) return 0; + among_var = find_among(z, a_11, 14); + if (!among_var) return 0; + z->ket = z->c; + if (z->c < z->l) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_30); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 5, s_32); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_33); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_34); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 4, s_35); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 5, s_36); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + if (!(z->I[2])) return 0; + while (1) { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'Y') goto lab1; + z->c++; + z->ket = z->c; + z->c = v_2; + break; + lab1: + z->c = v_2; + if (z->c >= z->l) goto lab0; + z->c++; + } + { + int ret = slice_from_s(z, 1, s_37); + if (ret < 0) return ret; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +extern int english_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_exception1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = v_1; + { + int v_2 = z->c; +z->c = z->c + 3; + if (z->c > z->l) goto lab3; + goto lab2; + lab3: + z->c = v_2; + } + goto lab0; + lab2: + z->c = v_1; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int ret = r_Step_1a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_Step_1b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_Step_1c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_Step_5(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + z->c = z->lb; + { + int v_10 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_10; + } + } +lab0: + return 1; +} + +extern struct SN_env * english_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void english_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.h new file mode 100644 index 000000000000..a446a71248a1 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_english.h @@ -0,0 +1,15 @@ +/* Generated from english.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_ISO_8859_1_create_env(void); +extern void english_ISO_8859_1_close_env(struct SN_env * z); + +extern int english_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.c new file mode 100644 index 000000000000..b8cedeb23a8e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.c @@ -0,0 +1,761 @@ +/* Generated from finnish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int finnish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_tidy(struct SN_env * z); +static int r_other_endings(struct SN_env * z); +static int r_t_plural(struct SN_env * z); +static int r_i_plural(struct SN_env * z); +static int r_case_ending(struct SN_env * z); +static int r_VI(struct SN_env * z); +static int r_LONG(struct SN_env * z); +static int r_possessive(struct SN_env * z); +static int r_particle_etc(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * finnish_ISO_8859_1_create_env(void); +extern void finnish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'p', 'a' }; +static const symbol s_0_1[3] = { 's', 't', 'i' }; +static const symbol s_0_2[4] = { 'k', 'a', 'a', 'n' }; +static const symbol s_0_3[3] = { 'h', 'a', 'n' }; +static const symbol s_0_4[3] = { 'k', 'i', 'n' }; +static const symbol s_0_5[3] = { 'h', 0xE4, 'n' }; +static const symbol s_0_6[4] = { 'k', 0xE4, 0xE4, 'n' }; +static const symbol s_0_7[2] = { 'k', 'o' }; +static const symbol s_0_8[2] = { 'p', 0xE4 }; +static const symbol s_0_9[2] = { 'k', 0xF6 }; +static const struct among a_0[10] = { +{ 2, s_0_0, 0, 1, 0}, +{ 3, s_0_1, 0, 2, 0}, +{ 4, s_0_2, 0, 1, 0}, +{ 3, s_0_3, 0, 1, 0}, +{ 3, s_0_4, 0, 1, 0}, +{ 3, s_0_5, 0, 1, 0}, +{ 4, s_0_6, 0, 1, 0}, +{ 2, s_0_7, 0, 1, 0}, +{ 2, s_0_8, 0, 1, 0}, +{ 2, s_0_9, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'l', 'l', 'a' }; +static const symbol s_1_1[2] = { 'n', 'a' }; +static const symbol s_1_2[3] = { 's', 's', 'a' }; +static const symbol s_1_3[2] = { 't', 'a' }; +static const symbol s_1_4[3] = { 'l', 't', 'a' }; +static const symbol s_1_5[3] = { 's', 't', 'a' }; +static const struct among a_1[6] = { +{ 3, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 3, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 3, s_1_4, -1, -1, 0}, +{ 3, s_1_5, -2, -1, 0} +}; + +static const symbol s_2_0[3] = { 'l', 'l', 0xE4 }; +static const symbol s_2_1[2] = { 'n', 0xE4 }; +static const symbol s_2_2[3] = { 's', 's', 0xE4 }; +static const symbol s_2_3[2] = { 't', 0xE4 }; +static const symbol s_2_4[3] = { 'l', 't', 0xE4 }; +static const symbol s_2_5[3] = { 's', 't', 0xE4 }; +static const struct among a_2[6] = { +{ 3, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 3, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, -1, 0}, +{ 3, s_2_4, -1, -1, 0}, +{ 3, s_2_5, -2, -1, 0} +}; + +static const symbol s_3_0[3] = { 'l', 'l', 'e' }; +static const symbol s_3_1[3] = { 'i', 'n', 'e' }; +static const struct among a_3[2] = { +{ 3, s_3_0, 0, -1, 0}, +{ 3, s_3_1, 0, -1, 0} +}; + +static const symbol s_4_0[3] = { 'n', 's', 'a' }; +static const symbol s_4_1[3] = { 'm', 'm', 'e' }; +static const symbol s_4_2[3] = { 'n', 'n', 'e' }; +static const symbol s_4_3[2] = { 'n', 'i' }; +static const symbol s_4_4[2] = { 's', 'i' }; +static const symbol s_4_5[2] = { 'a', 'n' }; +static const symbol s_4_6[2] = { 'e', 'n' }; +static const symbol s_4_7[2] = { 0xE4, 'n' }; +static const symbol s_4_8[3] = { 'n', 's', 0xE4 }; +static const struct among a_4[9] = { +{ 3, s_4_0, 0, 3, 0}, +{ 3, s_4_1, 0, 3, 0}, +{ 3, s_4_2, 0, 3, 0}, +{ 2, s_4_3, 0, 2, 0}, +{ 2, s_4_4, 0, 1, 0}, +{ 2, s_4_5, 0, 4, 0}, +{ 2, s_4_6, 0, 6, 0}, +{ 2, s_4_7, 0, 5, 0}, +{ 3, s_4_8, 0, 3, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'i', 'i' }; +static const symbol s_5_3[2] = { 'o', 'o' }; +static const symbol s_5_4[2] = { 'u', 'u' }; +static const symbol s_5_5[2] = { 0xE4, 0xE4 }; +static const symbol s_5_6[2] = { 0xF6, 0xF6 }; +static const struct among a_5[7] = { +{ 2, s_5_0, 0, -1, 0}, +{ 2, s_5_1, 0, -1, 0}, +{ 2, s_5_2, 0, -1, 0}, +{ 2, s_5_3, 0, -1, 0}, +{ 2, s_5_4, 0, -1, 0}, +{ 2, s_5_5, 0, -1, 0}, +{ 2, s_5_6, 0, -1, 0} +}; + +static const symbol s_6_0[1] = { 'a' }; +static const symbol s_6_1[3] = { 'l', 'l', 'a' }; +static const symbol s_6_2[2] = { 'n', 'a' }; +static const symbol s_6_3[3] = { 's', 's', 'a' }; +static const symbol s_6_4[2] = { 't', 'a' }; +static const symbol s_6_5[3] = { 'l', 't', 'a' }; +static const symbol s_6_6[3] = { 's', 't', 'a' }; +static const symbol s_6_7[3] = { 't', 't', 'a' }; +static const symbol s_6_8[3] = { 'l', 'l', 'e' }; +static const symbol s_6_9[3] = { 'i', 'n', 'e' }; +static const symbol s_6_10[3] = { 'k', 's', 'i' }; +static const symbol s_6_11[1] = { 'n' }; +static const symbol s_6_12[3] = { 'h', 'a', 'n' }; +static const symbol s_6_13[3] = { 'd', 'e', 'n' }; +static const symbol s_6_14[4] = { 's', 'e', 'e', 'n' }; +static const symbol s_6_15[3] = { 'h', 'e', 'n' }; +static const symbol s_6_16[4] = { 't', 't', 'e', 'n' }; +static const symbol s_6_17[3] = { 'h', 'i', 'n' }; +static const symbol s_6_18[4] = { 's', 'i', 'i', 'n' }; +static const symbol s_6_19[3] = { 'h', 'o', 'n' }; +static const symbol s_6_20[3] = { 'h', 0xE4, 'n' }; +static const symbol s_6_21[3] = { 'h', 0xF6, 'n' }; +static const symbol s_6_22[1] = { 0xE4 }; +static const symbol s_6_23[3] = { 'l', 'l', 0xE4 }; +static const symbol s_6_24[2] = { 'n', 0xE4 }; +static const symbol s_6_25[3] = { 's', 's', 0xE4 }; +static const symbol s_6_26[2] = { 't', 0xE4 }; +static const symbol s_6_27[3] = { 'l', 't', 0xE4 }; +static const symbol s_6_28[3] = { 's', 't', 0xE4 }; +static const symbol s_6_29[3] = { 't', 't', 0xE4 }; +static const struct among a_6[30] = { +{ 1, s_6_0, 0, 8, 0}, +{ 3, s_6_1, -1, -1, 0}, +{ 2, s_6_2, -2, -1, 0}, +{ 3, s_6_3, -3, -1, 0}, +{ 2, s_6_4, -4, -1, 0}, +{ 3, s_6_5, -1, -1, 0}, +{ 3, s_6_6, -2, -1, 0}, +{ 3, s_6_7, -3, 2, 0}, +{ 3, s_6_8, 0, -1, 0}, +{ 3, s_6_9, 0, -1, 0}, +{ 3, s_6_10, 0, -1, 0}, +{ 1, s_6_11, 0, 7, 0}, +{ 3, s_6_12, -1, 1, 0}, +{ 3, s_6_13, -2, -1, r_VI}, +{ 4, s_6_14, -3, -1, r_LONG}, +{ 3, s_6_15, -4, 2, 0}, +{ 4, s_6_16, -5, -1, r_VI}, +{ 3, s_6_17, -6, 3, 0}, +{ 4, s_6_18, -7, -1, r_VI}, +{ 3, s_6_19, -8, 4, 0}, +{ 3, s_6_20, -9, 5, 0}, +{ 3, s_6_21, -10, 6, 0}, +{ 1, s_6_22, 0, 8, 0}, +{ 3, s_6_23, -1, -1, 0}, +{ 2, s_6_24, -2, -1, 0}, +{ 3, s_6_25, -3, -1, 0}, +{ 2, s_6_26, -4, -1, 0}, +{ 3, s_6_27, -1, -1, 0}, +{ 3, s_6_28, -2, -1, 0}, +{ 3, s_6_29, -3, 2, 0} +}; + +static const symbol s_7_0[3] = { 'e', 'j', 'a' }; +static const symbol s_7_1[3] = { 'm', 'm', 'a' }; +static const symbol s_7_2[4] = { 'i', 'm', 'm', 'a' }; +static const symbol s_7_3[3] = { 'm', 'p', 'a' }; +static const symbol s_7_4[4] = { 'i', 'm', 'p', 'a' }; +static const symbol s_7_5[3] = { 'm', 'm', 'i' }; +static const symbol s_7_6[4] = { 'i', 'm', 'm', 'i' }; +static const symbol s_7_7[3] = { 'm', 'p', 'i' }; +static const symbol s_7_8[4] = { 'i', 'm', 'p', 'i' }; +static const symbol s_7_9[3] = { 'e', 'j', 0xE4 }; +static const symbol s_7_10[3] = { 'm', 'm', 0xE4 }; +static const symbol s_7_11[4] = { 'i', 'm', 'm', 0xE4 }; +static const symbol s_7_12[3] = { 'm', 'p', 0xE4 }; +static const symbol s_7_13[4] = { 'i', 'm', 'p', 0xE4 }; +static const struct among a_7[14] = { +{ 3, s_7_0, 0, -1, 0}, +{ 3, s_7_1, 0, 1, 0}, +{ 4, s_7_2, -1, -1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 4, s_7_4, -1, -1, 0}, +{ 3, s_7_5, 0, 1, 0}, +{ 4, s_7_6, -1, -1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 4, s_7_8, -1, -1, 0}, +{ 3, s_7_9, 0, -1, 0}, +{ 3, s_7_10, 0, 1, 0}, +{ 4, s_7_11, -1, -1, 0}, +{ 3, s_7_12, 0, 1, 0}, +{ 4, s_7_13, -1, -1, 0} +}; + +static const symbol s_8_0[1] = { 'i' }; +static const symbol s_8_1[1] = { 'j' }; +static const struct among a_8[2] = { +{ 1, s_8_0, 0, -1, 0}, +{ 1, s_8_1, 0, -1, 0} +}; + +static const symbol s_9_0[3] = { 'm', 'm', 'a' }; +static const symbol s_9_1[4] = { 'i', 'm', 'm', 'a' }; +static const struct among a_9[2] = { +{ 3, s_9_0, 0, 1, 0}, +{ 4, s_9_1, -1, -1, 0} +}; + +static const unsigned char g_AEI[] = { 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 }; + +static const unsigned char g_C[] = { 119, 223, 119, 1 }; + +static const unsigned char g_V1[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_V2[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_particle_end[] = { 17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const symbol s_0[] = { 'k', 's', 'e' }; +static const symbol s_1[] = { 'k', 's', 'i' }; +static const symbol s_2[] = { 'i', 'e' }; +static const symbol s_3[] = { 'p', 'o' }; +static const symbol s_4[] = { 'p', 'o' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int ret = out_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; + return 1; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_particle_etc(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_0, 10); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + if (in_grouping_b(z, g_particle_end, 97, 246, 0)) return 0; + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_possessive(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_4, 9); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'k') goto lab0; + z->c--; + return 0; + lab0: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 3, s_0))) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 97) return 0; + if (!find_among_b(z, a_1, 6)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 228) return 0; + if (!find_among_b(z, a_2, 6)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 101) return 0; + if (!find_among_b(z, a_3, 2)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_LONG(struct SN_env * z) { + if (!find_among_b(z, a_5, 7)) return 0; + return 1; +} + +static int r_VI(struct SN_env * z) { + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + if (in_grouping_b(z, g_V2, 97, 246, 0)) return 0; + return 1; +} + +static int r_case_ending(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_6, 30); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + if (z->c <= z->lb || z->p[z->c - 1] != 'a') return 0; + z->c--; + break; + case 2: + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + break; + case 3: + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + break; + case 4: + if (z->c <= z->lb || z->p[z->c - 1] != 'o') return 0; + z->c--; + break; + case 5: + if (z->c <= z->lb || z->p[z->c - 1] != 0xE4) return 0; + z->c--; + break; + case 6: + if (z->c <= z->lb || z->p[z->c - 1] != 0xF6) return 0; + z->c--; + break; + case 7: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int ret = r_LONG(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_4; + if (!(eq_s_b(z, 2, s_2))) { z->c = z->l - v_2; goto lab0; } + } + lab1: + z->c = z->l - v_3; + if (z->c <= z->lb) { z->c = z->l - v_2; goto lab0; } + z->c--; + } + z->bra = z->c; + lab0: + ; + } + break; + case 8: + if (in_grouping_b(z, g_V1, 97, 246, 0)) return 0; + if (in_grouping_b(z, g_C, 98, 122, 0)) return 0; + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[2] = 1; + return 1; +} + +static int r_other_endings(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + among_var = find_among_b(z, a_7, 14); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_3))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_i_plural(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 106)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_8, 2)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_t_plural(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_1; return 0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (in_grouping_b(z, g_V1, 97, 246, 0)) { z->lb = v_1; return 0; } + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + + { + int v_3; + if (z->c < z->I[0]) return 0; + v_3 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 97) { z->lb = v_3; return 0; } + among_var = find_among_b(z, a_9, 2); + if (!among_var) { z->lb = v_3; return 0; } + z->bra = z->c; + z->lb = v_3; + } + switch (among_var) { + case 1: + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_4))) goto lab0; + return 0; + lab0: + z->c = z->l - v_4; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_tidy(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_LONG(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + z->c = z->l - v_3; + z->ket = z->c; + if (z->c <= z->lb) goto lab0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (in_grouping_b(z, g_AEI, 97, 228, 0)) goto lab1; + z->bra = z->c; + if (in_grouping_b(z, g_C, 98, 122, 0)) goto lab1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab2; + z->c--; + z->bra = z->c; + { + int v_6 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab4; + z->c--; + goto lab3; + lab4: + z->c = z->l - v_6; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab2; + z->c--; + } + lab3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + z->c = z->l - v_5; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab5; + z->c--; + z->bra = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab5; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_7; + } + z->lb = v_1; + } + if (in_grouping_b(z, g_V1, 97, 246, 1) < 0) return 0; + z->ket = z->c; + if (in_grouping_b(z, g_C, 98, 122, 0)) return 0; + z->bra = z->c; + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + if (!(eq_v_b(z, z->S[0]))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int finnish_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->I[2] = 0; + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_particle_etc(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_possessive(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_case_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_other_endings(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + if (!(z->I[2])) goto lab1; + { + int v_6 = z->l - z->c; + { + int ret = r_i_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + goto lab0; +lab1: + { + int v_7 = z->l - z->c; + { + int ret = r_t_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } +lab0: + { + int v_8 = z->l - z->c; + { + int ret = r_tidy(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * finnish_ISO_8859_1_create_env(void) { return SN_create_env(1, 3); } + +extern void finnish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.h new file mode 100644 index 000000000000..d7500ab19df9 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_finnish.h @@ -0,0 +1,15 @@ +/* Generated from finnish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_ISO_8859_1_create_env(void); +extern void finnish_ISO_8859_1_close_env(struct SN_env * z); + +extern int finnish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.c new file mode 100644 index 000000000000..6bf94dd1a236 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.c @@ -0,0 +1,1455 @@ +/* Generated from french.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int french_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_un_accent(struct SN_env * z); +static int r_un_double(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_i_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +static int r_elisions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * french_ISO_8859_1_create_env(void); +extern void french_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'c', 'o', 'l' }; +static const symbol s_0_1[2] = { 'n', 'i' }; +static const symbol s_0_2[3] = { 'p', 'a', 'r' }; +static const symbol s_0_3[3] = { 't', 'a', 'p' }; +static const struct among a_0[4] = { +{ 3, s_0_0, 0, -1, 0}, +{ 2, s_0_1, 0, 1, 0}, +{ 3, s_0_2, 0, -1, 0}, +{ 3, s_0_3, 0, -1, 0} +}; + +static const symbol s_1_1[1] = { 'H' }; +static const symbol s_1_2[2] = { 'H', 'e' }; +static const symbol s_1_3[2] = { 'H', 'i' }; +static const symbol s_1_4[1] = { 'I' }; +static const symbol s_1_5[1] = { 'U' }; +static const symbol s_1_6[1] = { 'Y' }; +static const struct among a_1[7] = { +{ 0, 0, 0, 7, 0}, +{ 1, s_1_1, -1, 6, 0}, +{ 2, s_1_2, -1, 4, 0}, +{ 2, s_1_3, -2, 5, 0}, +{ 1, s_1_4, -4, 1, 0}, +{ 1, s_1_5, -5, 2, 0}, +{ 1, s_1_6, -6, 3, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'q', 'U' }; +static const symbol s_2_1[3] = { 'a', 'b', 'l' }; +static const symbol s_2_2[3] = { 'I', 0xE8, 'r' }; +static const symbol s_2_3[3] = { 'i', 0xE8, 'r' }; +static const symbol s_2_4[3] = { 'e', 'u', 's' }; +static const symbol s_2_5[2] = { 'i', 'v' }; +static const struct among a_2[6] = { +{ 3, s_2_0, 0, 3, 0}, +{ 3, s_2_1, 0, 3, 0}, +{ 3, s_2_2, 0, 4, 0}, +{ 3, s_2_3, 0, 4, 0}, +{ 3, s_2_4, 0, 2, 0}, +{ 2, s_2_5, 0, 1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'c' }; +static const symbol s_3_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_3_2[2] = { 'i', 'v' }; +static const struct among a_3[3] = { +{ 2, s_3_0, 0, 2, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 2, s_3_2, 0, 3, 0} +}; + +static const symbol s_4_0[4] = { 'i', 'q', 'U', 'e' }; +static const symbol s_4_1[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_4_2[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_4_3[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_4_4[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_4_5[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_4_6[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_4_7[4] = { 'e', 'u', 's', 'e' }; +static const symbol s_4_8[4] = { 'i', 's', 't', 'e' }; +static const symbol s_4_9[3] = { 'i', 'v', 'e' }; +static const symbol s_4_10[2] = { 'i', 'f' }; +static const symbol s_4_11[5] = { 'u', 's', 'i', 'o', 'n' }; +static const symbol s_4_12[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_4_13[5] = { 'u', 't', 'i', 'o', 'n' }; +static const symbol s_4_14[5] = { 'a', 't', 'e', 'u', 'r' }; +static const symbol s_4_15[5] = { 'i', 'q', 'U', 'e', 's' }; +static const symbol s_4_16[7] = { 'a', 't', 'r', 'i', 'c', 'e', 's' }; +static const symbol s_4_17[5] = { 'a', 'n', 'c', 'e', 's' }; +static const symbol s_4_18[5] = { 'e', 'n', 'c', 'e', 's' }; +static const symbol s_4_19[6] = { 'l', 'o', 'g', 'i', 'e', 's' }; +static const symbol s_4_20[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_4_21[5] = { 'i', 's', 'm', 'e', 's' }; +static const symbol s_4_22[5] = { 'e', 'u', 's', 'e', 's' }; +static const symbol s_4_23[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_4_24[4] = { 'i', 'v', 'e', 's' }; +static const symbol s_4_25[3] = { 'i', 'f', 's' }; +static const symbol s_4_26[6] = { 'u', 's', 'i', 'o', 'n', 's' }; +static const symbol s_4_27[6] = { 'a', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_28[6] = { 'u', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_29[6] = { 'a', 't', 'e', 'u', 'r', 's' }; +static const symbol s_4_30[5] = { 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_31[6] = { 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_32[9] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_33[4] = { 'i', 't', 0xE9, 's' }; +static const symbol s_4_34[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_4_35[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_36[8] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_37[6] = { 'a', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_38[6] = { 'e', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_39[3] = { 'a', 'u', 'x' }; +static const symbol s_4_40[4] = { 'e', 'a', 'u', 'x' }; +static const symbol s_4_41[3] = { 'e', 'u', 'x' }; +static const symbol s_4_42[3] = { 'o', 'u', 'x' }; +static const symbol s_4_43[3] = { 'i', 't', 0xE9 }; +static const struct among a_4[44] = { +{ 4, s_4_0, 0, 1, 0}, +{ 6, s_4_1, 0, 2, 0}, +{ 4, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 5, 0}, +{ 5, s_4_4, 0, 3, 0}, +{ 4, s_4_5, 0, 1, 0}, +{ 4, s_4_6, 0, 1, 0}, +{ 4, s_4_7, 0, 12, 0}, +{ 4, s_4_8, 0, 1, 0}, +{ 3, s_4_9, 0, 8, 0}, +{ 2, s_4_10, 0, 8, 0}, +{ 5, s_4_11, 0, 4, 0}, +{ 5, s_4_12, 0, 2, 0}, +{ 5, s_4_13, 0, 4, 0}, +{ 5, s_4_14, 0, 2, 0}, +{ 5, s_4_15, 0, 1, 0}, +{ 7, s_4_16, 0, 2, 0}, +{ 5, s_4_17, 0, 1, 0}, +{ 5, s_4_18, 0, 5, 0}, +{ 6, s_4_19, 0, 3, 0}, +{ 5, s_4_20, 0, 1, 0}, +{ 5, s_4_21, 0, 1, 0}, +{ 5, s_4_22, 0, 12, 0}, +{ 5, s_4_23, 0, 1, 0}, +{ 4, s_4_24, 0, 8, 0}, +{ 3, s_4_25, 0, 8, 0}, +{ 6, s_4_26, 0, 4, 0}, +{ 6, s_4_27, 0, 2, 0}, +{ 6, s_4_28, 0, 4, 0}, +{ 6, s_4_29, 0, 2, 0}, +{ 5, s_4_30, 0, 16, 0}, +{ 6, s_4_31, -1, 6, 0}, +{ 9, s_4_32, -1, 13, 0}, +{ 4, s_4_33, 0, 7, 0}, +{ 4, s_4_34, 0, 16, 0}, +{ 5, s_4_35, -1, 6, 0}, +{ 8, s_4_36, -1, 13, 0}, +{ 6, s_4_37, -3, 14, 0}, +{ 6, s_4_38, -4, 15, 0}, +{ 3, s_4_39, 0, 10, 0}, +{ 4, s_4_40, -1, 9, 0}, +{ 3, s_4_41, 0, 1, 0}, +{ 3, s_4_42, 0, 11, 0}, +{ 3, s_4_43, 0, 7, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'r', 'a' }; +static const symbol s_5_1[2] = { 'i', 'e' }; +static const symbol s_5_2[4] = { 'i', 's', 's', 'e' }; +static const symbol s_5_3[7] = { 'i', 's', 's', 'a', 'n', 't', 'e' }; +static const symbol s_5_4[1] = { 'i' }; +static const symbol s_5_5[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_5_6[2] = { 'i', 'r' }; +static const symbol s_5_7[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_8[3] = { 'i', 'e', 's' }; +static const symbol s_5_9[4] = { 0xEE, 'm', 'e', 's' }; +static const symbol s_5_10[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_5_11[8] = { 'i', 's', 's', 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_12[4] = { 0xEE, 't', 'e', 's' }; +static const symbol s_5_13[2] = { 'i', 's' }; +static const symbol s_5_14[5] = { 'i', 'r', 'a', 'i', 's' }; +static const symbol s_5_15[6] = { 'i', 's', 's', 'a', 'i', 's' }; +static const symbol s_5_16[6] = { 'i', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_5_17[7] = { 'i', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_5_18[5] = { 'i', 'r', 'o', 'n', 's' }; +static const symbol s_5_19[6] = { 'i', 's', 's', 'o', 'n', 's' }; +static const symbol s_5_20[7] = { 'i', 's', 's', 'a', 'n', 't', 's' }; +static const symbol s_5_21[2] = { 'i', 't' }; +static const symbol s_5_22[5] = { 'i', 'r', 'a', 'i', 't' }; +static const symbol s_5_23[6] = { 'i', 's', 's', 'a', 'i', 't' }; +static const symbol s_5_24[6] = { 'i', 's', 's', 'a', 'n', 't' }; +static const symbol s_5_25[7] = { 'i', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_26[8] = { 'i', 's', 's', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_27[5] = { 'i', 'r', 'e', 'n', 't' }; +static const symbol s_5_28[6] = { 'i', 's', 's', 'e', 'n', 't' }; +static const symbol s_5_29[5] = { 'i', 'r', 'o', 'n', 't' }; +static const symbol s_5_30[2] = { 0xEE, 't' }; +static const symbol s_5_31[5] = { 'i', 'r', 'i', 'e', 'z' }; +static const symbol s_5_32[6] = { 'i', 's', 's', 'i', 'e', 'z' }; +static const symbol s_5_33[4] = { 'i', 'r', 'e', 'z' }; +static const symbol s_5_34[5] = { 'i', 's', 's', 'e', 'z' }; +static const struct among a_5[35] = { +{ 3, s_5_0, 0, 1, 0}, +{ 2, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0}, +{ 7, s_5_3, 0, 1, 0}, +{ 1, s_5_4, 0, 1, 0}, +{ 4, s_5_5, -1, 1, 0}, +{ 2, s_5_6, 0, 1, 0}, +{ 4, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 1, 0}, +{ 4, s_5_9, 0, 1, 0}, +{ 5, s_5_10, 0, 1, 0}, +{ 8, s_5_11, 0, 1, 0}, +{ 4, s_5_12, 0, 1, 0}, +{ 2, s_5_13, 0, 1, 0}, +{ 5, s_5_14, -1, 1, 0}, +{ 6, s_5_15, -2, 1, 0}, +{ 6, s_5_16, 0, 1, 0}, +{ 7, s_5_17, 0, 1, 0}, +{ 5, s_5_18, 0, 1, 0}, +{ 6, s_5_19, 0, 1, 0}, +{ 7, s_5_20, 0, 1, 0}, +{ 2, s_5_21, 0, 1, 0}, +{ 5, s_5_22, -1, 1, 0}, +{ 6, s_5_23, -2, 1, 0}, +{ 6, s_5_24, 0, 1, 0}, +{ 7, s_5_25, 0, 1, 0}, +{ 8, s_5_26, 0, 1, 0}, +{ 5, s_5_27, 0, 1, 0}, +{ 6, s_5_28, 0, 1, 0}, +{ 5, s_5_29, 0, 1, 0}, +{ 2, s_5_30, 0, 1, 0}, +{ 5, s_5_31, 0, 1, 0}, +{ 6, s_5_32, 0, 1, 0}, +{ 4, s_5_33, 0, 1, 0}, +{ 5, s_5_34, 0, 1, 0} +}; + +static const symbol s_6_0[2] = { 'a', 'l' }; +static const symbol s_6_1[3] = { 0xE9, 'p', 'l' }; +static const symbol s_6_2[3] = { 'a', 'u', 'v' }; +static const struct among a_6[3] = { +{ 2, s_6_0, 0, 1, 0}, +{ 3, s_6_1, 0, -1, 0}, +{ 3, s_6_2, 0, -1, 0} +}; + +static const symbol s_7_0[1] = { 'a' }; +static const symbol s_7_1[3] = { 'e', 'r', 'a' }; +static const symbol s_7_2[4] = { 'a', 'i', 's', 'e' }; +static const symbol s_7_3[4] = { 'a', 's', 's', 'e' }; +static const symbol s_7_4[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_7_5[2] = { 0xE9, 'e' }; +static const symbol s_7_6[2] = { 'a', 'i' }; +static const symbol s_7_7[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_7_8[2] = { 'e', 'r' }; +static const symbol s_7_9[2] = { 'a', 's' }; +static const symbol s_7_10[4] = { 'e', 'r', 'a', 's' }; +static const symbol s_7_11[4] = { 0xE2, 'm', 'e', 's' }; +static const symbol s_7_12[5] = { 'a', 'i', 's', 'e', 's' }; +static const symbol s_7_13[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_7_14[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_7_15[4] = { 0xE2, 't', 'e', 's' }; +static const symbol s_7_16[3] = { 0xE9, 'e', 's' }; +static const symbol s_7_17[3] = { 'a', 'i', 's' }; +static const symbol s_7_18[4] = { 'e', 'a', 'i', 's' }; +static const symbol s_7_19[5] = { 'e', 'r', 'a', 'i', 's' }; +static const symbol s_7_20[4] = { 'i', 'o', 'n', 's' }; +static const symbol s_7_21[6] = { 'e', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_7_22[7] = { 'a', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_7_23[5] = { 'e', 'r', 'o', 'n', 's' }; +static const symbol s_7_24[4] = { 'a', 'n', 't', 's' }; +static const symbol s_7_25[2] = { 0xE9, 's' }; +static const symbol s_7_26[3] = { 'a', 'i', 't' }; +static const symbol s_7_27[5] = { 'e', 'r', 'a', 'i', 't' }; +static const symbol s_7_28[3] = { 'a', 'n', 't' }; +static const symbol s_7_29[5] = { 'a', 'I', 'e', 'n', 't' }; +static const symbol s_7_30[7] = { 'e', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_7_31[5] = { 0xE8, 'r', 'e', 'n', 't' }; +static const symbol s_7_32[6] = { 'a', 's', 's', 'e', 'n', 't' }; +static const symbol s_7_33[5] = { 'e', 'r', 'o', 'n', 't' }; +static const symbol s_7_34[2] = { 0xE2, 't' }; +static const symbol s_7_35[2] = { 'e', 'z' }; +static const symbol s_7_36[3] = { 'i', 'e', 'z' }; +static const symbol s_7_37[5] = { 'e', 'r', 'i', 'e', 'z' }; +static const symbol s_7_38[6] = { 'a', 's', 's', 'i', 'e', 'z' }; +static const symbol s_7_39[4] = { 'e', 'r', 'e', 'z' }; +static const symbol s_7_40[1] = { 0xE9 }; +static const struct among a_7[41] = { +{ 1, s_7_0, 0, 3, 0}, +{ 3, s_7_1, -1, 2, 0}, +{ 4, s_7_2, 0, 4, 0}, +{ 4, s_7_3, 0, 3, 0}, +{ 4, s_7_4, 0, 3, 0}, +{ 2, s_7_5, 0, 2, 0}, +{ 2, s_7_6, 0, 3, 0}, +{ 4, s_7_7, -1, 2, 0}, +{ 2, s_7_8, 0, 2, 0}, +{ 2, s_7_9, 0, 3, 0}, +{ 4, s_7_10, -1, 2, 0}, +{ 4, s_7_11, 0, 3, 0}, +{ 5, s_7_12, 0, 4, 0}, +{ 5, s_7_13, 0, 3, 0}, +{ 5, s_7_14, 0, 3, 0}, +{ 4, s_7_15, 0, 3, 0}, +{ 3, s_7_16, 0, 2, 0}, +{ 3, s_7_17, 0, 4, 0}, +{ 4, s_7_18, -1, 2, 0}, +{ 5, s_7_19, -2, 2, 0}, +{ 4, s_7_20, 0, 1, 0}, +{ 6, s_7_21, -1, 2, 0}, +{ 7, s_7_22, -2, 3, 0}, +{ 5, s_7_23, 0, 2, 0}, +{ 4, s_7_24, 0, 3, 0}, +{ 2, s_7_25, 0, 2, 0}, +{ 3, s_7_26, 0, 3, 0}, +{ 5, s_7_27, -1, 2, 0}, +{ 3, s_7_28, 0, 3, 0}, +{ 5, s_7_29, 0, 3, 0}, +{ 7, s_7_30, -1, 2, 0}, +{ 5, s_7_31, 0, 2, 0}, +{ 6, s_7_32, 0, 3, 0}, +{ 5, s_7_33, 0, 2, 0}, +{ 2, s_7_34, 0, 3, 0}, +{ 2, s_7_35, 0, 2, 0}, +{ 3, s_7_36, -1, 2, 0}, +{ 5, s_7_37, -1, 2, 0}, +{ 6, s_7_38, -2, 3, 0}, +{ 4, s_7_39, -4, 2, 0}, +{ 1, s_7_40, 0, 2, 0} +}; + +static const symbol s_8_0[1] = { 'e' }; +static const symbol s_8_1[4] = { 'I', 0xE8, 'r', 'e' }; +static const symbol s_8_2[4] = { 'i', 0xE8, 'r', 'e' }; +static const symbol s_8_3[3] = { 'i', 'o', 'n' }; +static const symbol s_8_4[3] = { 'I', 'e', 'r' }; +static const symbol s_8_5[3] = { 'i', 'e', 'r' }; +static const struct among a_8[6] = { +{ 1, s_8_0, 0, 3, 0}, +{ 4, s_8_1, -1, 2, 0}, +{ 4, s_8_2, -2, 2, 0}, +{ 3, s_8_3, 0, 1, 0}, +{ 3, s_8_4, 0, 2, 0}, +{ 3, s_8_5, 0, 2, 0} +}; + +static const symbol s_9_0[3] = { 'e', 'l', 'l' }; +static const symbol s_9_1[4] = { 'e', 'i', 'l', 'l' }; +static const symbol s_9_2[3] = { 'e', 'n', 'n' }; +static const symbol s_9_3[3] = { 'o', 'n', 'n' }; +static const symbol s_9_4[3] = { 'e', 't', 't' }; +static const struct among a_9[5] = { +{ 3, s_9_0, 0, -1, 0}, +{ 4, s_9_1, 0, -1, 0}, +{ 3, s_9_2, 0, -1, 0}, +{ 3, s_9_3, 0, -1, 0}, +{ 3, s_9_4, 0, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 130, 103, 8, 5 }; + +static const unsigned char g_oux_ending[] = { 65, 85 }; + +static const unsigned char g_elision_char[] = { 131, 14, 3 }; + +static const unsigned char g_keep_with_s[] = { 1, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'q', 'u' }; +static const symbol s_1[] = { 'U' }; +static const symbol s_2[] = { 'I' }; +static const symbol s_3[] = { 'Y' }; +static const symbol s_4[] = { 'H', 'e' }; +static const symbol s_5[] = { 'H', 'i' }; +static const symbol s_6[] = { 'Y' }; +static const symbol s_7[] = { 'U' }; +static const symbol s_8[] = { 'i' }; +static const symbol s_9[] = { 'u' }; +static const symbol s_10[] = { 'y' }; +static const symbol s_11[] = { 0xEB }; +static const symbol s_12[] = { 0xEF }; +static const symbol s_13[] = { 'i', 'c' }; +static const symbol s_14[] = { 'i', 'q', 'U' }; +static const symbol s_15[] = { 'l', 'o', 'g' }; +static const symbol s_16[] = { 'u' }; +static const symbol s_17[] = { 'e', 'n', 't' }; +static const symbol s_18[] = { 'a', 't' }; +static const symbol s_19[] = { 'e', 'u', 'x' }; +static const symbol s_20[] = { 'i' }; +static const symbol s_21[] = { 'a', 'b', 'l' }; +static const symbol s_22[] = { 'i', 'q', 'U' }; +static const symbol s_23[] = { 'a', 't' }; +static const symbol s_24[] = { 'i', 'c' }; +static const symbol s_25[] = { 'i', 'q', 'U' }; +static const symbol s_26[] = { 'e', 'a', 'u' }; +static const symbol s_27[] = { 'a', 'l' }; +static const symbol s_28[] = { 'o', 'u' }; +static const symbol s_29[] = { 'e', 'u', 'x' }; +static const symbol s_30[] = { 'a', 'n', 't' }; +static const symbol s_31[] = { 'e', 'n', 't' }; +static const symbol s_32[] = { 'H', 'i' }; +static const symbol s_33[] = { 'i' }; +static const symbol s_34[] = { 'e' }; +static const symbol s_35[] = { 'i' }; +static const symbol s_36[] = { 'c' }; + +static int r_elisions(struct SN_env * z) { + z->bra = z->c; + { + int v_1 = z->c; + if (in_grouping(z, g_elision_char, 99, 116, 0)) goto lab1; + goto lab0; + lab1: + z->c = v_1; + if (!(eq_s(z, 2, s_0))) return 0; + } +lab0: + if (z->c == z->l || z->p[z->c] != '\'') return 0; + z->c++; + z->ket = z->c; + if (z->c < z->l) goto lab2; + return 0; +lab2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_prelude(struct SN_env * z) { + while (1) { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + { + int v_3 = z->c; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab3; + z->bra = z->c; + { + int v_4 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab5; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab5; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'i') goto lab6; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab6; + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + goto lab4; + lab6: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'y') goto lab3; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + } + lab4: + goto lab2; + lab3: + z->c = v_3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 0xEB) goto lab7; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_4); + if (ret < 0) return ret; + } + goto lab2; + lab7: + z->c = v_3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 0xEF) goto lab8; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + goto lab2; + lab8: + z->c = v_3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab9; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab9; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + goto lab2; + lab9: + z->c = v_3; + if (z->c == z->l || z->p[z->c] != 'q') goto lab1; + z->c++; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab1; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + } + lab2: + z->c = v_2; + break; + lab1: + z->c = v_2; + if (z->c >= z->l) goto lab0; + z->c++; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + int among_var; + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab2; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab2; + if (z->c >= z->l) goto lab2; + z->c++; + goto lab1; + lab2: + z->c = v_2; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 3 || !((33282 >> (z->p[z->c + 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among(z, a_0, 4); + if (!among_var) goto lab3; + switch (among_var) { + case 1: + if (in_grouping(z, g_v, 97, 251, 0)) goto lab3; + break; + } + goto lab1; + lab3: + z->c = v_2; + if (z->c >= z->l) goto lab0; + z->c++; + { + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_3 = z->c; + { + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[0] = z->c; + lab4: + z->c = v_3; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 2 || !((35652352 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 7; else + among_var = find_among(z, a_1, 7); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_4, 44); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_13))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int v_2 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_from_s(z, 3, s_14); + if (ret < 0) return ret; + } + } + lab1: + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_15); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_16); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_2, 6); + if (!among_var) { z->c = z->l - v_3; goto lab3; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_18))) { z->c = z->l - v_3; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_4 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_4; + { + int ret = r_R1(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_19); + if (ret < 0) return ret; + } + } + lab4: + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_20); + if (ret < 0) return ret; + } + break; + } + lab3: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_5; goto lab6; } + among_var = find_among_b(z, a_3, 3); + if (!among_var) { z->c = z->l - v_5; goto lab6; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_6 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_6; + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + } + lab7: + break; + case 2: + { + int v_7 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab9; + lab10: + z->c = z->l - v_7; + { + int ret = slice_from_s(z, 3, s_22); + if (ret < 0) return ret; + } + } + lab9: + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_5; goto lab6; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab6: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_23))) { z->c = z->l - v_8; goto lab11; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_8; goto lab11; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_24))) { z->c = z->l - v_8; goto lab11; } + z->bra = z->c; + { + int v_9 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - v_9; + { + int ret = slice_from_s(z, 3, s_25); + if (ret < 0) return ret; + } + } + lab12: + lab11: + ; + } + break; + case 9: + { + int ret = slice_from_s(z, 3, s_26); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_27); + if (ret < 0) return ret; + } + break; + case 11: + if (in_grouping_b(z, g_oux_ending, 98, 112, 0)) return 0; + { + int ret = slice_from_s(z, 2, s_28); + if (ret < 0) return ret; + } + break; + case 12: + { + int v_10 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab15; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab14; + lab15: + z->c = z->l - v_10; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_29); + if (ret < 0) return ret; + } + } + lab14: + break; + case 13: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + if (out_grouping_b(z, g_v, 97, 251, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_30); + if (ret < 0) return ret; + } + return 0; + break; + case 15: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + return 0; + break; + case 16: + { + int v_11 = z->l - z->c; + if (in_grouping_b(z, g_v, 97, 251, 0)) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_11; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 0; + break; + } + return 1; +} + +static int r_i_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68944418 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_5, 35)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'H') goto lab0; + z->c--; + { z->lb = v_1; return 0; } + lab0: + z->c = z->l - v_2; + } + if (out_grouping_b(z, g_v, 97, 251, 0)) { z->lb = v_1; return 0; } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + among_var = find_among_b(z, a_7, 41); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') { z->c = z->l - v_2; goto lab0; } + z->c--; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_2; goto lab0; } + if (ret < 0) return ret; + } + z->bra = z->c; + lab0: + ; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int v_3 = z->l - z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 108 && z->p[z->c - 1] != 118)) goto lab1; + among_var = find_among_b(z, a_6, 3); + if (!among_var) goto lab1; + switch (among_var) { + case 1: + if (z->c <= z->lb) goto lab1; + z->c--; + if (z->c > z->lb) goto lab1; + break; + } + return 0; + lab1: + z->c = z->l - v_3; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 2, s_32))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + if (out_grouping_b(z, g_keep_with_s, 97, 232, 0)) { z->c = z->l - v_1; goto lab0; } + } + lab1: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + + { + int v_4; + if (z->c < z->I[2]) return 0; + v_4 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((278560 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_4; return 0; } + among_var = find_among_b(z, a_8, 6); + if (!among_var) { z->lb = v_4; return 0; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) { z->lb = v_4; return 0; } + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab4; + z->c--; + goto lab3; + lab4: + z->c = z->l - v_5; + if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_4; return 0; } + z->c--; + } + lab3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_33); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->lb = v_4; + } + return 1; +} + +static int r_un_double(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1069056 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_9, 5)) return 0; + z->c = z->l - v_1; + } + z->ket = z->c; + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_un_accent(struct SN_env * z) { + { + int v_1 = 1; + while (1) { + if (out_grouping_b(z, g_v, 97, 251, 0)) goto lab0; + v_1--; + continue; + lab0: + break; + } + if (v_1 > 0) return 0; + } + z->ket = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xE9) goto lab2; + z->c--; + goto lab1; + lab2: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 0xE8) return 0; + z->c--; + } +lab1: + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_34); + if (ret < 0) return ret; + } + return 1; +} + +extern int french_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_elisions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + { + int v_6 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = z->l - v_6; + { + int ret = r_i_verb_suffix(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + goto lab3; + lab5: + z->c = z->l - v_6; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + } + lab3: + z->c = z->l - v_5; + { + int v_7 = z->l - z->c; + z->ket = z->c; + { + int v_8 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') goto lab8; + z->c--; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_35); + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_8; + if (z->c <= z->lb || z->p[z->c - 1] != 0xE7) { z->c = z->l - v_7; goto lab6; } + z->c--; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_36); + if (ret < 0) return ret; + } + } + lab7: + lab6: + ; + } + } + goto lab1; + lab2: + z->c = z->l - v_4; + { + int ret = r_residual_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_3; + } + { + int v_9 = z->l - z->c; + { + int ret = r_un_double(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_un_accent(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + z->c = z->lb; + { + int v_11 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_11; + } + return 1; +} + +extern struct SN_env * french_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void french_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.h new file mode 100644 index 000000000000..adf28724439b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_french.h @@ -0,0 +1,15 @@ +/* Generated from french.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_ISO_8859_1_create_env(void); +extern void french_ISO_8859_1_close_env(struct SN_env * z); + +extern int french_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.c new file mode 100644 index 000000000000..d7378ba97221 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.c @@ -0,0 +1,620 @@ +/* Generated from german.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int german_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * german_ISO_8859_1_create_env(void); +extern void german_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 'a', 'e' }; +static const symbol s_0_2[2] = { 'o', 'e' }; +static const symbol s_0_3[2] = { 'q', 'u' }; +static const symbol s_0_4[2] = { 'u', 'e' }; +static const symbol s_0_5[1] = { 0xDF }; +static const struct among a_0[6] = { +{ 0, 0, 0, 5, 0}, +{ 2, s_0_1, -1, 2, 0}, +{ 2, s_0_2, -2, 3, 0}, +{ 2, s_0_3, -3, -1, 0}, +{ 2, s_0_4, -4, 4, 0}, +{ 1, s_0_5, -5, 1, 0} +}; + +static const symbol s_1_1[1] = { 'U' }; +static const symbol s_1_2[1] = { 'Y' }; +static const symbol s_1_3[1] = { 0xE4 }; +static const symbol s_1_4[1] = { 0xF6 }; +static const symbol s_1_5[1] = { 0xFC }; +static const struct among a_1[6] = { +{ 0, 0, 0, 5, 0}, +{ 1, s_1_1, -1, 2, 0}, +{ 1, s_1_2, -2, 1, 0}, +{ 1, s_1_3, -3, 3, 0}, +{ 1, s_1_4, -4, 4, 0}, +{ 1, s_1_5, -5, 2, 0} +}; + +static const symbol s_2_0[1] = { 'e' }; +static const symbol s_2_1[2] = { 'e', 'm' }; +static const symbol s_2_2[2] = { 'e', 'n' }; +static const symbol s_2_3[7] = { 'e', 'r', 'i', 'n', 'n', 'e', 'n' }; +static const symbol s_2_4[4] = { 'e', 'r', 'i', 'n' }; +static const symbol s_2_5[2] = { 'l', 'n' }; +static const symbol s_2_6[3] = { 'e', 'r', 'n' }; +static const symbol s_2_7[2] = { 'e', 'r' }; +static const symbol s_2_8[1] = { 's' }; +static const symbol s_2_9[2] = { 'e', 's' }; +static const symbol s_2_10[3] = { 'l', 'n', 's' }; +static const struct among a_2[11] = { +{ 1, s_2_0, 0, 3, 0}, +{ 2, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 3, 0}, +{ 7, s_2_3, -1, 2, 0}, +{ 4, s_2_4, 0, 2, 0}, +{ 2, s_2_5, 0, 5, 0}, +{ 3, s_2_6, 0, 2, 0}, +{ 2, s_2_7, 0, 2, 0}, +{ 1, s_2_8, 0, 4, 0}, +{ 2, s_2_9, -1, 3, 0}, +{ 3, s_2_10, -2, 5, 0} +}; + +static const symbol s_3_0[4] = { 't', 'i', 'c', 'k' }; +static const symbol s_3_1[4] = { 'p', 'l', 'a', 'n' }; +static const symbol s_3_2[6] = { 'g', 'e', 'o', 'r', 'd', 'n' }; +static const symbol s_3_3[6] = { 'i', 'n', 't', 'e', 'r', 'n' }; +static const symbol s_3_4[2] = { 't', 'r' }; +static const struct among a_3[5] = { +{ 4, s_3_0, 0, -1, 0}, +{ 4, s_3_1, 0, -1, 0}, +{ 6, s_3_2, 0, -1, 0}, +{ 6, s_3_3, 0, -1, 0}, +{ 2, s_3_4, 0, -1, 0} +}; + +static const symbol s_4_0[2] = { 'e', 'n' }; +static const symbol s_4_1[2] = { 'e', 'r' }; +static const symbol s_4_2[2] = { 'e', 't' }; +static const symbol s_4_3[2] = { 's', 't' }; +static const symbol s_4_4[3] = { 'e', 's', 't' }; +static const struct among a_4[5] = { +{ 2, s_4_0, 0, 1, 0}, +{ 2, s_4_1, 0, 1, 0}, +{ 2, s_4_2, 0, 3, 0}, +{ 2, s_4_3, 0, 2, 0}, +{ 3, s_4_4, -1, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'g' }; +static const symbol s_5_1[4] = { 'l', 'i', 'c', 'h' }; +static const struct among a_5[2] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'e', 'n', 'd' }; +static const symbol s_6_1[2] = { 'i', 'g' }; +static const symbol s_6_2[3] = { 'u', 'n', 'g' }; +static const symbol s_6_3[4] = { 'l', 'i', 'c', 'h' }; +static const symbol s_6_4[4] = { 'i', 's', 'c', 'h' }; +static const symbol s_6_5[2] = { 'i', 'k' }; +static const symbol s_6_6[4] = { 'h', 'e', 'i', 't' }; +static const symbol s_6_7[4] = { 'k', 'e', 'i', 't' }; +static const struct among a_6[8] = { +{ 3, s_6_0, 0, 1, 0}, +{ 2, s_6_1, 0, 2, 0}, +{ 3, s_6_2, 0, 1, 0}, +{ 4, s_6_3, 0, 3, 0}, +{ 4, s_6_4, 0, 2, 0}, +{ 2, s_6_5, 0, 2, 0}, +{ 4, s_6_6, 0, 3, 0}, +{ 4, s_6_7, 0, 4, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 }; + +static const unsigned char g_et_ending[] = { 1, 128, 198, 227, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_s_ending[] = { 117, 30, 5 }; + +static const unsigned char g_st_ending[] = { 117, 30, 4 }; + +static const symbol s_0[] = { 'U' }; +static const symbol s_1[] = { 'Y' }; +static const symbol s_2[] = { 's', 's' }; +static const symbol s_3[] = { 0xE4 }; +static const symbol s_4[] = { 0xF6 }; +static const symbol s_5[] = { 0xFC }; +static const symbol s_6[] = { 'y' }; +static const symbol s_7[] = { 'u' }; +static const symbol s_8[] = { 'a' }; +static const symbol s_9[] = { 'o' }; +static const symbol s_10[] = { 's', 'y', 's', 't' }; +static const symbol s_11[] = { 'n', 'i', 's' }; +static const symbol s_12[] = { 'l' }; +static const symbol s_13[] = { 'i', 'g' }; +static const symbol s_14[] = { 'e', 'r' }; +static const symbol s_15[] = { 'e', 'n' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab1; + z->bra = z->c; + { + int v_4 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab3; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab3; + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'y') goto lab1; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab1; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + } + lab2: + z->c = v_3; + break; + lab1: + z->c = v_3; + if (z->c >= z->l) goto lab0; + z->c++; + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + while (1) { + int v_5 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 5: + if (z->c >= z->l) goto lab4; + z->c++; + break; + } + continue; + lab4: + z->c = v_5; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[2] = z->c; + if (z->I[2] >= z->I[0]) goto lab0; + z->I[2] = z->I[0]; +lab0: + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + among_var = find_among(z, a_1, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 5: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((811040 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) goto lab0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 4, s_10))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') { z->c = z->l - v_3; goto lab2; } + z->c--; + z->bra = z->c; + if (!(eq_s_b(z, 3, s_11))) { z->c = z->l - v_3; goto lab2; } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 4: + if (in_grouping_b(z, g_s_ending, 98, 116, 0)) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1327104 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among_b(z, a_4, 5); + if (!among_var) goto lab3; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_st_ending, 98, 116, 0)) goto lab3; +z->c = z->c - 3; + if (z->c < z->lb) goto lab3; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_5 = z->l - z->c; + if (in_grouping_b(z, g_et_ending, 85, 228, 0)) goto lab3; + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((280576 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab4; + if (!find_among_b(z, a_3, 5)) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_6; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab3: + z->c = z->l - v_4; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1051024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab5; + among_var = find_among_b(z, a_6, 8); + if (!among_var) goto lab5; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_13))) { z->c = z->l - v_8; goto lab6; } + z->bra = z->c; + { + int v_9 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab7; + z->c--; + { z->c = z->l - v_8; goto lab6; } + lab7: + z->c = z->l - v_9; + } + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_8; goto lab6; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab6: + ; + } + break; + case 2: + { + int v_10 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab8; + z->c--; + goto lab5; + lab8: + z->c = z->l - v_10; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_11 = z->l - z->c; + z->ket = z->c; + { + int v_12 = z->l - z->c; + if (!(eq_s_b(z, 2, s_14))) goto lab11; + goto lab10; + lab11: + z->c = z->l - v_12; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - v_11; goto lab9; } + } + lab10: + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) { z->c = z->l - v_11; goto lab9; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab9: + ; + } + break; + case 4: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_13 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 103 && z->p[z->c - 1] != 104)) { z->c = z->l - v_13; goto lab12; } + if (!find_among_b(z, a_5, 2)) { z->c = z->l - v_13; goto lab12; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_13; goto lab12; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab12: + ; + } + break; + } + lab5: + z->c = z->l - v_7; + } + return 1; +} + +extern int german_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->lb; + { + int v_3 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_3; + } + return 1; +} + +extern struct SN_env * german_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void german_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.h new file mode 100644 index 000000000000..f566558e5851 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_german.h @@ -0,0 +1,15 @@ +/* Generated from german.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_ISO_8859_1_create_env(void); +extern void german_ISO_8859_1_close_env(struct SN_env * z); + +extern int german_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.c new file mode 100644 index 000000000000..6d5515597f4b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.c @@ -0,0 +1,426 @@ +/* Generated from indonesian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int indonesian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_VOWEL(struct SN_env * z); +static int r_SUFFIX_I_OK(struct SN_env * z); +static int r_SUFFIX_AN_OK(struct SN_env * z); +static int r_SUFFIX_KAN_OK(struct SN_env * z); +static int r_KER(struct SN_env * z); +static int r_remove_suffix(struct SN_env * z); +static int r_remove_second_order_prefix(struct SN_env * z); +static int r_remove_first_order_prefix(struct SN_env * z); +static int r_remove_possessive_pronoun(struct SN_env * z); +static int r_remove_particle(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * indonesian_ISO_8859_1_create_env(void); +extern void indonesian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'k', 'a', 'h' }; +static const symbol s_0_1[3] = { 'l', 'a', 'h' }; +static const symbol s_0_2[3] = { 'p', 'u', 'n' }; +static const struct among a_0[3] = { +{ 3, s_0_0, 0, 1, 0}, +{ 3, s_0_1, 0, 1, 0}, +{ 3, s_0_2, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'n', 'y', 'a' }; +static const symbol s_1_1[2] = { 'k', 'u' }; +static const symbol s_1_2[2] = { 'm', 'u' }; +static const struct among a_1[3] = { +{ 3, s_1_0, 0, 1, 0}, +{ 2, s_1_1, 0, 1, 0}, +{ 2, s_1_2, 0, 1, 0} +}; + +static const symbol s_2_0[1] = { 'i' }; +static const symbol s_2_1[2] = { 'a', 'n' }; +static const symbol s_2_2[3] = { 'k', 'a', 'n' }; +static const struct among a_2[3] = { +{ 1, s_2_0, 0, 1, r_SUFFIX_I_OK}, +{ 2, s_2_1, 0, 1, r_SUFFIX_AN_OK}, +{ 3, s_2_2, -1, 1, r_SUFFIX_KAN_OK} +}; + +static const symbol s_3_0[2] = { 'd', 'i' }; +static const symbol s_3_1[2] = { 'k', 'e' }; +static const symbol s_3_2[2] = { 'm', 'e' }; +static const symbol s_3_3[3] = { 'm', 'e', 'm' }; +static const symbol s_3_4[3] = { 'm', 'e', 'n' }; +static const symbol s_3_5[4] = { 'm', 'e', 'n', 'g' }; +static const symbol s_3_6[4] = { 'm', 'e', 'n', 'y' }; +static const symbol s_3_7[3] = { 'p', 'e', 'm' }; +static const symbol s_3_8[3] = { 'p', 'e', 'n' }; +static const symbol s_3_9[4] = { 'p', 'e', 'n', 'g' }; +static const symbol s_3_10[4] = { 'p', 'e', 'n', 'y' }; +static const symbol s_3_11[3] = { 't', 'e', 'r' }; +static const struct among a_3[12] = { +{ 2, s_3_0, 0, 1, 0}, +{ 2, s_3_1, 0, 2, 0}, +{ 2, s_3_2, 0, 1, 0}, +{ 3, s_3_3, -1, 5, 0}, +{ 3, s_3_4, -2, 1, 0}, +{ 4, s_3_5, -1, 1, 0}, +{ 4, s_3_6, -2, 3, r_VOWEL}, +{ 3, s_3_7, 0, 6, 0}, +{ 3, s_3_8, 0, 2, 0}, +{ 4, s_3_9, -1, 2, 0}, +{ 4, s_3_10, -2, 4, r_VOWEL}, +{ 3, s_3_11, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 'b', 'e' }; +static const symbol s_4_1[7] = { 'b', 'e', 'l', 'a', 'j', 'a', 'r' }; +static const symbol s_4_2[3] = { 'b', 'e', 'r' }; +static const symbol s_4_3[2] = { 'p', 'e' }; +static const symbol s_4_4[7] = { 'p', 'e', 'l', 'a', 'j', 'a', 'r' }; +static const symbol s_4_5[3] = { 'p', 'e', 'r' }; +static const struct among a_4[6] = { +{ 2, s_4_0, 0, 3, r_KER}, +{ 7, s_4_1, -1, 4, 0}, +{ 3, s_4_2, -2, 3, 0}, +{ 2, s_4_3, 0, 1, 0}, +{ 7, s_4_4, -1, 2, 0}, +{ 3, s_4_5, -2, 1, 0} +}; + +static const unsigned char g_vowel[] = { 17, 65, 16 }; + +static const symbol s_0[] = { 'e', 'r' }; +static const symbol s_1[] = { 's' }; +static const symbol s_2[] = { 's' }; +static const symbol s_3[] = { 'p' }; +static const symbol s_4[] = { 'p' }; +static const symbol s_5[] = { 'a', 'j', 'a', 'r' }; +static const symbol s_6[] = { 'a', 'j', 'a', 'r' }; + +static int r_remove_particle(struct SN_env * z) { + z->ket = z->c; + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 104 && z->p[z->c - 1] != 110)) return 0; + if (!find_among_b(z, a_0, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_remove_possessive_pronoun(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 117)) return 0; + if (!find_among_b(z, a_1, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_SUFFIX_KAN_OK(struct SN_env * z) { + if (z->I[0] == 3) return 0; + if (z->I[0] == 2) return 0; + return 1; +} + +static int r_SUFFIX_AN_OK(struct SN_env * z) { + return z->I[0] != 1; +} + +static int r_SUFFIX_I_OK(struct SN_env * z) { + if (z->I[0] > 2) return 0; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab0; + z->c--; + return 0; + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_remove_suffix(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 110)) return 0; + if (!find_among_b(z, a_2, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_VOWEL(struct SN_env * z) { + if (in_grouping(z, g_vowel, 97, 117, 0)) return 0; + return 1; +} + +static int r_KER(struct SN_env * z) { + if (out_grouping(z, g_vowel, 97, 117, 0)) return 0; + if (!(eq_s(z, 2, s_0))) return 0; + return 1; +} + +static int r_remove_first_order_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 105 && z->p[z->c + 1] != 101)) return 0; + among_var = find_among(z, a_3, 12); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 1; + z->I[1] -= 1; + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 3; + z->I[1] -= 1; + break; + case 3: + z->I[0] = 1; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 4: + z->I[0] = 3; + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 5: + z->I[0] = 1; + z->I[1] -= 1; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_vowel, 97, 117, 0)) goto lab1; + z->c = v_2; + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + } + goto lab0; + lab1: + z->c = v_1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + break; + case 6: + z->I[0] = 3; + z->I[1] -= 1; + { + int v_3 = z->c; + { + int v_4 = z->c; + if (in_grouping(z, g_vowel, 97, 117, 0)) goto lab3; + z->c = v_4; + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + } + goto lab2; + lab3: + z->c = v_3; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab2: + break; + } + return 1; +} + +static int r_remove_second_order_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] != 101) return 0; + among_var = find_among(z, a_4, 6); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 2; + z->I[1] -= 1; + break; + case 2: + { + int ret = slice_from_s(z, 4, s_5); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 4; + z->I[1] -= 1; + break; + case 4: + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + z->I[0] = 4; + z->I[1] -= 1; + break; + } + return 1; +} + +extern int indonesian_ISO_8859_1_stem(struct SN_env * z) { + z->I[1] = 0; + { + int v_1 = z->c; + while (1) { + { + int ret = out_grouping(z, g_vowel, 97, 117, 1); + if (ret < 0) goto lab1; + z->c += ret; + } + z->I[1] += 1; + continue; + lab1: + break; + } + z->c = v_1; + } + if (z->I[1] <= 2) return 0; + z->I[0] = 0; + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_remove_particle(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + if (z->I[1] <= 2) return 0; + { + int v_3 = z->l - z->c; + { + int ret = r_remove_possessive_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + z->c = z->lb; + if (z->I[1] <= 2) return 0; + { + int v_4 = z->c; + { + int v_5 = z->c; + { + int ret = r_remove_first_order_prefix(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int v_6 = z->c; + { + int v_7 = z->c; + if (z->I[1] <= 2) goto lab4; + z->lb = z->c; z->c = z->l; + { + int ret = r_remove_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + z->c = z->lb; + z->c = v_7; + } + if (z->I[1] <= 2) goto lab4; + { + int ret = r_remove_second_order_prefix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + lab4: + z->c = v_6; + } + z->c = v_5; + } + goto lab2; + lab3: + z->c = v_4; + { + int v_8 = z->c; + { + int ret = r_remove_second_order_prefix(z); + if (ret < 0) return ret; + } + z->c = v_8; + } + { + int v_9 = z->c; + if (z->I[1] <= 2) goto lab5; + z->lb = z->c; z->c = z->l; + { + int ret = r_remove_suffix(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + z->c = z->lb; + lab5: + z->c = v_9; + } + } +lab2: + return 1; +} + +extern struct SN_env * indonesian_ISO_8859_1_create_env(void) { return SN_create_env(0, 2); } + +extern void indonesian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.h new file mode 100644 index 000000000000..81f893cfff01 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_indonesian.h @@ -0,0 +1,15 @@ +/* Generated from indonesian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_ISO_8859_1_create_env(void); +extern void indonesian_ISO_8859_1_close_env(struct SN_env * z); + +extern int indonesian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.c new file mode 100644 index 000000000000..99af6f11aa6e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.c @@ -0,0 +1,492 @@ +/* Generated from irish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int irish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_verb_sfx(struct SN_env * z); +static int r_deriv(struct SN_env * z); +static int r_noun_sfx(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_initial_morph(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * irish_ISO_8859_1_create_env(void); +extern void irish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'b', '\'' }; +static const symbol s_0_1[2] = { 'b', 'h' }; +static const symbol s_0_2[3] = { 'b', 'h', 'f' }; +static const symbol s_0_3[2] = { 'b', 'p' }; +static const symbol s_0_4[2] = { 'c', 'h' }; +static const symbol s_0_5[2] = { 'd', '\'' }; +static const symbol s_0_6[4] = { 'd', '\'', 'f', 'h' }; +static const symbol s_0_7[2] = { 'd', 'h' }; +static const symbol s_0_8[2] = { 'd', 't' }; +static const symbol s_0_9[2] = { 'f', 'h' }; +static const symbol s_0_10[2] = { 'g', 'c' }; +static const symbol s_0_11[2] = { 'g', 'h' }; +static const symbol s_0_12[2] = { 'h', '-' }; +static const symbol s_0_13[2] = { 'm', '\'' }; +static const symbol s_0_14[2] = { 'm', 'b' }; +static const symbol s_0_15[2] = { 'm', 'h' }; +static const symbol s_0_16[2] = { 'n', '-' }; +static const symbol s_0_17[2] = { 'n', 'd' }; +static const symbol s_0_18[2] = { 'n', 'g' }; +static const symbol s_0_19[2] = { 'p', 'h' }; +static const symbol s_0_20[2] = { 's', 'h' }; +static const symbol s_0_21[2] = { 't', '-' }; +static const symbol s_0_22[2] = { 't', 'h' }; +static const symbol s_0_23[2] = { 't', 's' }; +static const struct among a_0[24] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 4, 0}, +{ 3, s_0_2, -1, 2, 0}, +{ 2, s_0_3, 0, 8, 0}, +{ 2, s_0_4, 0, 5, 0}, +{ 2, s_0_5, 0, 1, 0}, +{ 4, s_0_6, -1, 2, 0}, +{ 2, s_0_7, 0, 6, 0}, +{ 2, s_0_8, 0, 9, 0}, +{ 2, s_0_9, 0, 2, 0}, +{ 2, s_0_10, 0, 5, 0}, +{ 2, s_0_11, 0, 7, 0}, +{ 2, s_0_12, 0, 1, 0}, +{ 2, s_0_13, 0, 1, 0}, +{ 2, s_0_14, 0, 4, 0}, +{ 2, s_0_15, 0, 10, 0}, +{ 2, s_0_16, 0, 1, 0}, +{ 2, s_0_17, 0, 6, 0}, +{ 2, s_0_18, 0, 7, 0}, +{ 2, s_0_19, 0, 8, 0}, +{ 2, s_0_20, 0, 3, 0}, +{ 2, s_0_21, 0, 1, 0}, +{ 2, s_0_22, 0, 9, 0}, +{ 2, s_0_23, 0, 3, 0} +}; + +static const symbol s_1_0[6] = { 0xED, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_1_1[7] = { 'a', 0xED, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_1_2[3] = { 'i', 'r', 'e' }; +static const symbol s_1_3[4] = { 'a', 'i', 'r', 'e' }; +static const symbol s_1_4[3] = { 'a', 'b', 'h' }; +static const symbol s_1_5[4] = { 'e', 'a', 'b', 'h' }; +static const symbol s_1_6[3] = { 'i', 'b', 'h' }; +static const symbol s_1_7[4] = { 'a', 'i', 'b', 'h' }; +static const symbol s_1_8[3] = { 'a', 'm', 'h' }; +static const symbol s_1_9[4] = { 'e', 'a', 'm', 'h' }; +static const symbol s_1_10[3] = { 'i', 'm', 'h' }; +static const symbol s_1_11[4] = { 'a', 'i', 'm', 'h' }; +static const symbol s_1_12[5] = { 0xED, 'o', 'c', 'h', 't' }; +static const symbol s_1_13[6] = { 'a', 0xED, 'o', 'c', 'h', 't' }; +static const symbol s_1_14[3] = { 'i', 'r', 0xED }; +static const symbol s_1_15[4] = { 'a', 'i', 'r', 0xED }; +static const struct among a_1[16] = { +{ 6, s_1_0, 0, 1, 0}, +{ 7, s_1_1, -1, 1, 0}, +{ 3, s_1_2, 0, 2, 0}, +{ 4, s_1_3, -1, 2, 0}, +{ 3, s_1_4, 0, 1, 0}, +{ 4, s_1_5, -1, 1, 0}, +{ 3, s_1_6, 0, 1, 0}, +{ 4, s_1_7, -1, 1, 0}, +{ 3, s_1_8, 0, 1, 0}, +{ 4, s_1_9, -1, 1, 0}, +{ 3, s_1_10, 0, 1, 0}, +{ 4, s_1_11, -1, 1, 0}, +{ 5, s_1_12, 0, 1, 0}, +{ 6, s_1_13, -1, 1, 0}, +{ 3, s_1_14, 0, 2, 0}, +{ 4, s_1_15, -1, 2, 0} +}; + +static const symbol s_2_0[8] = { 0xF3, 'i', 'd', 'e', 'a', 'c', 'h', 'a' }; +static const symbol s_2_1[7] = { 'p', 'a', 't', 'a', 'c', 'h', 'a' }; +static const symbol s_2_2[5] = { 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_3[8] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_4[6] = { 'e', 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_5[11] = { 'g', 'r', 'a', 'f', 'a', 0xED, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_2_6[5] = { 'p', 'a', 'i', 't', 'e' }; +static const symbol s_2_7[3] = { 'a', 'c', 'h' }; +static const symbol s_2_8[4] = { 'e', 'a', 'c', 'h' }; +static const symbol s_2_9[7] = { 0xF3, 'i', 'd', 'e', 'a', 'c', 'h' }; +static const symbol s_2_10[7] = { 'g', 'i', 'n', 'e', 'a', 'c', 'h' }; +static const symbol s_2_11[6] = { 'p', 'a', 't', 'a', 'c', 'h' }; +static const symbol s_2_12[9] = { 'g', 'r', 'a', 'f', 'a', 0xED, 'o', 'c', 'h' }; +static const symbol s_2_13[7] = { 'p', 'a', 't', 'a', 'i', 'g', 'h' }; +static const symbol s_2_14[6] = { 0xF3, 'i', 'd', 'i', 'g', 'h' }; +static const symbol s_2_15[7] = { 'a', 'c', 'h', 't', 0xFA, 'i', 'l' }; +static const symbol s_2_16[8] = { 'e', 'a', 'c', 'h', 't', 0xFA, 'i', 'l' }; +static const symbol s_2_17[6] = { 'g', 'i', 'n', 'e', 'a', 's' }; +static const symbol s_2_18[5] = { 'g', 'i', 'n', 'i', 's' }; +static const symbol s_2_19[4] = { 'a', 'c', 'h', 't' }; +static const symbol s_2_20[7] = { 'a', 'r', 'c', 'a', 'c', 'h', 't' }; +static const symbol s_2_21[5] = { 'e', 'a', 'c', 'h', 't' }; +static const symbol s_2_22[10] = { 'g', 'r', 'a', 'f', 'a', 0xED, 'o', 'c', 'h', 't' }; +static const symbol s_2_23[9] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a', 0xED }; +static const symbol s_2_24[12] = { 'g', 'r', 'a', 'f', 'a', 0xED, 'o', 'c', 'h', 't', 'a', 0xED }; +static const struct among a_2[25] = { +{ 8, s_2_0, 0, 6, 0}, +{ 7, s_2_1, 0, 5, 0}, +{ 5, s_2_2, 0, 1, 0}, +{ 8, s_2_3, -1, 2, 0}, +{ 6, s_2_4, -2, 1, 0}, +{ 11, s_2_5, 0, 4, 0}, +{ 5, s_2_6, 0, 5, 0}, +{ 3, s_2_7, 0, 1, 0}, +{ 4, s_2_8, -1, 1, 0}, +{ 7, s_2_9, -1, 6, 0}, +{ 7, s_2_10, -2, 3, 0}, +{ 6, s_2_11, -4, 5, 0}, +{ 9, s_2_12, 0, 4, 0}, +{ 7, s_2_13, 0, 5, 0}, +{ 6, s_2_14, 0, 6, 0}, +{ 7, s_2_15, 0, 1, 0}, +{ 8, s_2_16, -1, 1, 0}, +{ 6, s_2_17, 0, 3, 0}, +{ 5, s_2_18, 0, 3, 0}, +{ 4, s_2_19, 0, 1, 0}, +{ 7, s_2_20, -1, 2, 0}, +{ 5, s_2_21, -2, 1, 0}, +{ 10, s_2_22, 0, 4, 0}, +{ 9, s_2_23, 0, 2, 0}, +{ 12, s_2_24, 0, 4, 0} +}; + +static const symbol s_3_0[4] = { 'i', 'm', 'i', 'd' }; +static const symbol s_3_1[5] = { 'a', 'i', 'm', 'i', 'd' }; +static const symbol s_3_2[4] = { 0xED, 'm', 'i', 'd' }; +static const symbol s_3_3[5] = { 'a', 0xED, 'm', 'i', 'd' }; +static const symbol s_3_4[3] = { 'a', 'd', 'h' }; +static const symbol s_3_5[4] = { 'e', 'a', 'd', 'h' }; +static const symbol s_3_6[5] = { 'f', 'a', 'i', 'd', 'h' }; +static const symbol s_3_7[4] = { 'f', 'i', 'd', 'h' }; +static const symbol s_3_8[3] = { 0xE1, 'i', 'l' }; +static const symbol s_3_9[3] = { 'a', 'i', 'n' }; +static const symbol s_3_10[4] = { 't', 'e', 'a', 'r' }; +static const symbol s_3_11[3] = { 't', 'a', 'r' }; +static const struct among a_3[12] = { +{ 4, s_3_0, 0, 1, 0}, +{ 5, s_3_1, -1, 1, 0}, +{ 4, s_3_2, 0, 1, 0}, +{ 5, s_3_3, -1, 1, 0}, +{ 3, s_3_4, 0, 2, 0}, +{ 4, s_3_5, -1, 2, 0}, +{ 5, s_3_6, 0, 1, 0}, +{ 4, s_3_7, 0, 1, 0}, +{ 3, s_3_8, 0, 2, 0}, +{ 3, s_3_9, 0, 2, 0}, +{ 4, s_3_10, 0, 2, 0}, +{ 3, s_3_11, 0, 2, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 2 }; + +static const symbol s_0[] = { 'f' }; +static const symbol s_1[] = { 's' }; +static const symbol s_2[] = { 'b' }; +static const symbol s_3[] = { 'c' }; +static const symbol s_4[] = { 'd' }; +static const symbol s_5[] = { 'g' }; +static const symbol s_6[] = { 'p' }; +static const symbol s_7[] = { 't' }; +static const symbol s_8[] = { 'm' }; +static const symbol s_9[] = { 'a', 'r', 'c' }; +static const symbol s_10[] = { 'g', 'i', 'n' }; +static const symbol s_11[] = { 'g', 'r', 'a', 'f' }; +static const symbol s_12[] = { 'p', 'a', 'i', 't', 'e' }; +static const symbol s_13[] = { 0xF3, 'i', 'd' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[2] = z->c; + { + int ret = in_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_initial_morph(struct SN_env * z) { + int among_var; + z->bra = z->c; + among_var = find_among(z, a_0, 24); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_noun_sfx(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_1, 16); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_deriv(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_2, 25); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_9); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_10); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_12); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 3, s_13); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_sfx(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((282896 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 12); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int irish_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_initial_morph(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_noun_sfx(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_deriv(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_verb_sfx(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * irish_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void irish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.h new file mode 100644 index 000000000000..768533de38b4 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_irish.h @@ -0,0 +1,15 @@ +/* Generated from irish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_ISO_8859_1_create_env(void); +extern void irish_ISO_8859_1_close_env(struct SN_env * z); + +extern int irish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.c new file mode 100644 index 000000000000..36bcc36d14df --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.c @@ -0,0 +1,1081 @@ +/* Generated from italian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int italian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_vowel_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * italian_ISO_8859_1_create_env(void); +extern void italian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 'q', 'u' }; +static const symbol s_0_2[1] = { 0xE1 }; +static const symbol s_0_3[1] = { 0xE9 }; +static const symbol s_0_4[1] = { 0xED }; +static const symbol s_0_5[1] = { 0xF3 }; +static const symbol s_0_6[1] = { 0xFA }; +static const struct among a_0[7] = { +{ 0, 0, 0, 7, 0}, +{ 2, s_0_1, -1, 6, 0}, +{ 1, s_0_2, -2, 1, 0}, +{ 1, s_0_3, -3, 2, 0}, +{ 1, s_0_4, -4, 3, 0}, +{ 1, s_0_5, -5, 4, 0}, +{ 1, s_0_6, -6, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'U' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_1_1, -1, 1, 0}, +{ 1, s_1_2, -2, 2, 0} +}; + +static const symbol s_2_0[2] = { 'l', 'a' }; +static const symbol s_2_1[4] = { 'c', 'e', 'l', 'a' }; +static const symbol s_2_2[6] = { 'g', 'l', 'i', 'e', 'l', 'a' }; +static const symbol s_2_3[4] = { 'm', 'e', 'l', 'a' }; +static const symbol s_2_4[4] = { 't', 'e', 'l', 'a' }; +static const symbol s_2_5[4] = { 'v', 'e', 'l', 'a' }; +static const symbol s_2_6[2] = { 'l', 'e' }; +static const symbol s_2_7[4] = { 'c', 'e', 'l', 'e' }; +static const symbol s_2_8[6] = { 'g', 'l', 'i', 'e', 'l', 'e' }; +static const symbol s_2_9[4] = { 'm', 'e', 'l', 'e' }; +static const symbol s_2_10[4] = { 't', 'e', 'l', 'e' }; +static const symbol s_2_11[4] = { 'v', 'e', 'l', 'e' }; +static const symbol s_2_12[2] = { 'n', 'e' }; +static const symbol s_2_13[4] = { 'c', 'e', 'n', 'e' }; +static const symbol s_2_14[6] = { 'g', 'l', 'i', 'e', 'n', 'e' }; +static const symbol s_2_15[4] = { 'm', 'e', 'n', 'e' }; +static const symbol s_2_16[4] = { 's', 'e', 'n', 'e' }; +static const symbol s_2_17[4] = { 't', 'e', 'n', 'e' }; +static const symbol s_2_18[4] = { 'v', 'e', 'n', 'e' }; +static const symbol s_2_19[2] = { 'c', 'i' }; +static const symbol s_2_20[2] = { 'l', 'i' }; +static const symbol s_2_21[4] = { 'c', 'e', 'l', 'i' }; +static const symbol s_2_22[6] = { 'g', 'l', 'i', 'e', 'l', 'i' }; +static const symbol s_2_23[4] = { 'm', 'e', 'l', 'i' }; +static const symbol s_2_24[4] = { 't', 'e', 'l', 'i' }; +static const symbol s_2_25[4] = { 'v', 'e', 'l', 'i' }; +static const symbol s_2_26[3] = { 'g', 'l', 'i' }; +static const symbol s_2_27[2] = { 'm', 'i' }; +static const symbol s_2_28[2] = { 's', 'i' }; +static const symbol s_2_29[2] = { 't', 'i' }; +static const symbol s_2_30[2] = { 'v', 'i' }; +static const symbol s_2_31[2] = { 'l', 'o' }; +static const symbol s_2_32[4] = { 'c', 'e', 'l', 'o' }; +static const symbol s_2_33[6] = { 'g', 'l', 'i', 'e', 'l', 'o' }; +static const symbol s_2_34[4] = { 'm', 'e', 'l', 'o' }; +static const symbol s_2_35[4] = { 't', 'e', 'l', 'o' }; +static const symbol s_2_36[4] = { 'v', 'e', 'l', 'o' }; +static const struct among a_2[37] = { +{ 2, s_2_0, 0, -1, 0}, +{ 4, s_2_1, -1, -1, 0}, +{ 6, s_2_2, -2, -1, 0}, +{ 4, s_2_3, -3, -1, 0}, +{ 4, s_2_4, -4, -1, 0}, +{ 4, s_2_5, -5, -1, 0}, +{ 2, s_2_6, 0, -1, 0}, +{ 4, s_2_7, -1, -1, 0}, +{ 6, s_2_8, -2, -1, 0}, +{ 4, s_2_9, -3, -1, 0}, +{ 4, s_2_10, -4, -1, 0}, +{ 4, s_2_11, -5, -1, 0}, +{ 2, s_2_12, 0, -1, 0}, +{ 4, s_2_13, -1, -1, 0}, +{ 6, s_2_14, -2, -1, 0}, +{ 4, s_2_15, -3, -1, 0}, +{ 4, s_2_16, -4, -1, 0}, +{ 4, s_2_17, -5, -1, 0}, +{ 4, s_2_18, -6, -1, 0}, +{ 2, s_2_19, 0, -1, 0}, +{ 2, s_2_20, 0, -1, 0}, +{ 4, s_2_21, -1, -1, 0}, +{ 6, s_2_22, -2, -1, 0}, +{ 4, s_2_23, -3, -1, 0}, +{ 4, s_2_24, -4, -1, 0}, +{ 4, s_2_25, -5, -1, 0}, +{ 3, s_2_26, -6, -1, 0}, +{ 2, s_2_27, 0, -1, 0}, +{ 2, s_2_28, 0, -1, 0}, +{ 2, s_2_29, 0, -1, 0}, +{ 2, s_2_30, 0, -1, 0}, +{ 2, s_2_31, 0, -1, 0}, +{ 4, s_2_32, -1, -1, 0}, +{ 6, s_2_33, -2, -1, 0}, +{ 4, s_2_34, -3, -1, 0}, +{ 4, s_2_35, -4, -1, 0}, +{ 4, s_2_36, -5, -1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_3_1[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_3_2[2] = { 'a', 'r' }; +static const symbol s_3_3[2] = { 'e', 'r' }; +static const symbol s_3_4[2] = { 'i', 'r' }; +static const struct among a_3[5] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 2, s_3_2, 0, 2, 0}, +{ 2, s_3_3, 0, 2, 0}, +{ 2, s_3_4, 0, 2, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'o', 's' }; +static const symbol s_4_3[2] = { 'i', 'v' }; +static const struct among a_4[4] = { +{ 2, s_4_0, 0, -1, 0}, +{ 4, s_4_1, 0, -1, 0}, +{ 2, s_4_2, 0, -1, 0}, +{ 2, s_4_3, 0, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_5_2[2] = { 'i', 'v' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 2, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'i', 'c', 'a' }; +static const symbol s_6_1[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_6_2[3] = { 'o', 's', 'a' }; +static const symbol s_6_3[4] = { 'i', 's', 't', 'a' }; +static const symbol s_6_4[3] = { 'i', 'v', 'a' }; +static const symbol s_6_5[4] = { 'a', 'n', 'z', 'a' }; +static const symbol s_6_6[4] = { 'e', 'n', 'z', 'a' }; +static const symbol s_6_7[3] = { 'i', 'c', 'e' }; +static const symbol s_6_8[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_6_9[4] = { 'i', 'c', 'h', 'e' }; +static const symbol s_6_10[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_6_11[5] = { 'a', 'b', 'i', 'l', 'e' }; +static const symbol s_6_12[5] = { 'i', 'b', 'i', 'l', 'e' }; +static const symbol s_6_13[6] = { 'u', 's', 'i', 'o', 'n', 'e' }; +static const symbol s_6_14[6] = { 'a', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_15[6] = { 'u', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_16[5] = { 'a', 't', 'o', 'r', 'e' }; +static const symbol s_6_17[3] = { 'o', 's', 'e' }; +static const symbol s_6_18[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_19[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_20[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_21[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_22[3] = { 'i', 'v', 'e' }; +static const symbol s_6_23[4] = { 'a', 'n', 'z', 'e' }; +static const symbol s_6_24[4] = { 'e', 'n', 'z', 'e' }; +static const symbol s_6_25[3] = { 'i', 'c', 'i' }; +static const symbol s_6_26[6] = { 'a', 't', 'r', 'i', 'c', 'i' }; +static const symbol s_6_27[4] = { 'i', 'c', 'h', 'i' }; +static const symbol s_6_28[5] = { 'a', 'b', 'i', 'l', 'i' }; +static const symbol s_6_29[5] = { 'i', 'b', 'i', 'l', 'i' }; +static const symbol s_6_30[4] = { 'i', 's', 'm', 'i' }; +static const symbol s_6_31[6] = { 'u', 's', 'i', 'o', 'n', 'i' }; +static const symbol s_6_32[6] = { 'a', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_33[6] = { 'u', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_34[5] = { 'a', 't', 'o', 'r', 'i' }; +static const symbol s_6_35[3] = { 'o', 's', 'i' }; +static const symbol s_6_36[4] = { 'a', 'n', 't', 'i' }; +static const symbol s_6_37[6] = { 'a', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_38[6] = { 'i', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_39[4] = { 'i', 's', 't', 'i' }; +static const symbol s_6_40[3] = { 'i', 'v', 'i' }; +static const symbol s_6_41[3] = { 'i', 'c', 'o' }; +static const symbol s_6_42[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_6_43[3] = { 'o', 's', 'o' }; +static const symbol s_6_44[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_45[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_46[3] = { 'i', 'v', 'o' }; +static const symbol s_6_47[3] = { 'i', 't', 0xE0 }; +static const symbol s_6_48[4] = { 'i', 's', 't', 0xE0 }; +static const symbol s_6_49[4] = { 'i', 's', 't', 0xE8 }; +static const symbol s_6_50[4] = { 'i', 's', 't', 0xEC }; +static const struct among a_6[51] = { +{ 3, s_6_0, 0, 1, 0}, +{ 5, s_6_1, 0, 3, 0}, +{ 3, s_6_2, 0, 1, 0}, +{ 4, s_6_3, 0, 1, 0}, +{ 3, s_6_4, 0, 9, 0}, +{ 4, s_6_5, 0, 1, 0}, +{ 4, s_6_6, 0, 5, 0}, +{ 3, s_6_7, 0, 1, 0}, +{ 6, s_6_8, -1, 1, 0}, +{ 4, s_6_9, 0, 1, 0}, +{ 5, s_6_10, 0, 3, 0}, +{ 5, s_6_11, 0, 1, 0}, +{ 5, s_6_12, 0, 1, 0}, +{ 6, s_6_13, 0, 4, 0}, +{ 6, s_6_14, 0, 2, 0}, +{ 6, s_6_15, 0, 4, 0}, +{ 5, s_6_16, 0, 2, 0}, +{ 3, s_6_17, 0, 1, 0}, +{ 4, s_6_18, 0, 1, 0}, +{ 5, s_6_19, 0, 1, 0}, +{ 6, s_6_20, -1, 7, 0}, +{ 4, s_6_21, 0, 1, 0}, +{ 3, s_6_22, 0, 9, 0}, +{ 4, s_6_23, 0, 1, 0}, +{ 4, s_6_24, 0, 5, 0}, +{ 3, s_6_25, 0, 1, 0}, +{ 6, s_6_26, -1, 1, 0}, +{ 4, s_6_27, 0, 1, 0}, +{ 5, s_6_28, 0, 1, 0}, +{ 5, s_6_29, 0, 1, 0}, +{ 4, s_6_30, 0, 1, 0}, +{ 6, s_6_31, 0, 4, 0}, +{ 6, s_6_32, 0, 2, 0}, +{ 6, s_6_33, 0, 4, 0}, +{ 5, s_6_34, 0, 2, 0}, +{ 3, s_6_35, 0, 1, 0}, +{ 4, s_6_36, 0, 1, 0}, +{ 6, s_6_37, 0, 6, 0}, +{ 6, s_6_38, 0, 6, 0}, +{ 4, s_6_39, 0, 1, 0}, +{ 3, s_6_40, 0, 9, 0}, +{ 3, s_6_41, 0, 1, 0}, +{ 4, s_6_42, 0, 1, 0}, +{ 3, s_6_43, 0, 1, 0}, +{ 6, s_6_44, 0, 6, 0}, +{ 6, s_6_45, 0, 6, 0}, +{ 3, s_6_46, 0, 9, 0}, +{ 3, s_6_47, 0, 8, 0}, +{ 4, s_6_48, 0, 1, 0}, +{ 4, s_6_49, 0, 1, 0}, +{ 4, s_6_50, 0, 1, 0} +}; + +static const symbol s_7_0[4] = { 'i', 's', 'c', 'a' }; +static const symbol s_7_1[4] = { 'e', 'n', 'd', 'a' }; +static const symbol s_7_2[3] = { 'a', 't', 'a' }; +static const symbol s_7_3[3] = { 'i', 't', 'a' }; +static const symbol s_7_4[3] = { 'u', 't', 'a' }; +static const symbol s_7_5[3] = { 'a', 'v', 'a' }; +static const symbol s_7_6[3] = { 'e', 'v', 'a' }; +static const symbol s_7_7[3] = { 'i', 'v', 'a' }; +static const symbol s_7_8[6] = { 'e', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_9[6] = { 'i', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_10[4] = { 'i', 's', 'c', 'e' }; +static const symbol s_7_11[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_7_12[3] = { 'a', 'r', 'e' }; +static const symbol s_7_13[3] = { 'e', 'r', 'e' }; +static const symbol s_7_14[3] = { 'i', 'r', 'e' }; +static const symbol s_7_15[4] = { 'a', 's', 's', 'e' }; +static const symbol s_7_16[3] = { 'a', 't', 'e' }; +static const symbol s_7_17[5] = { 'a', 'v', 'a', 't', 'e' }; +static const symbol s_7_18[5] = { 'e', 'v', 'a', 't', 'e' }; +static const symbol s_7_19[5] = { 'i', 'v', 'a', 't', 'e' }; +static const symbol s_7_20[3] = { 'e', 't', 'e' }; +static const symbol s_7_21[5] = { 'e', 'r', 'e', 't', 'e' }; +static const symbol s_7_22[5] = { 'i', 'r', 'e', 't', 'e' }; +static const symbol s_7_23[3] = { 'i', 't', 'e' }; +static const symbol s_7_24[6] = { 'e', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_25[6] = { 'i', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_26[3] = { 'u', 't', 'e' }; +static const symbol s_7_27[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_7_28[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_7_29[4] = { 'i', 's', 'c', 'i' }; +static const symbol s_7_30[4] = { 'e', 'n', 'd', 'i' }; +static const symbol s_7_31[4] = { 'e', 'r', 'e', 'i' }; +static const symbol s_7_32[4] = { 'i', 'r', 'e', 'i' }; +static const symbol s_7_33[4] = { 'a', 's', 's', 'i' }; +static const symbol s_7_34[3] = { 'a', 't', 'i' }; +static const symbol s_7_35[3] = { 'i', 't', 'i' }; +static const symbol s_7_36[6] = { 'e', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_37[6] = { 'i', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_38[3] = { 'u', 't', 'i' }; +static const symbol s_7_39[3] = { 'a', 'v', 'i' }; +static const symbol s_7_40[3] = { 'e', 'v', 'i' }; +static const symbol s_7_41[3] = { 'i', 'v', 'i' }; +static const symbol s_7_42[4] = { 'i', 's', 'c', 'o' }; +static const symbol s_7_43[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_7_44[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_7_45[4] = { 'Y', 'a', 'm', 'o' }; +static const symbol s_7_46[4] = { 'i', 'a', 'm', 'o' }; +static const symbol s_7_47[5] = { 'a', 'v', 'a', 'm', 'o' }; +static const symbol s_7_48[5] = { 'e', 'v', 'a', 'm', 'o' }; +static const symbol s_7_49[5] = { 'i', 'v', 'a', 'm', 'o' }; +static const symbol s_7_50[5] = { 'e', 'r', 'e', 'm', 'o' }; +static const symbol s_7_51[5] = { 'i', 'r', 'e', 'm', 'o' }; +static const symbol s_7_52[6] = { 'a', 's', 's', 'i', 'm', 'o' }; +static const symbol s_7_53[4] = { 'a', 'm', 'm', 'o' }; +static const symbol s_7_54[4] = { 'e', 'm', 'm', 'o' }; +static const symbol s_7_55[6] = { 'e', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_56[6] = { 'i', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_57[4] = { 'i', 'm', 'm', 'o' }; +static const symbol s_7_58[3] = { 'a', 'n', 'o' }; +static const symbol s_7_59[6] = { 'i', 's', 'c', 'a', 'n', 'o' }; +static const symbol s_7_60[5] = { 'a', 'v', 'a', 'n', 'o' }; +static const symbol s_7_61[5] = { 'e', 'v', 'a', 'n', 'o' }; +static const symbol s_7_62[5] = { 'i', 'v', 'a', 'n', 'o' }; +static const symbol s_7_63[6] = { 'e', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_64[6] = { 'i', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_65[3] = { 'o', 'n', 'o' }; +static const symbol s_7_66[6] = { 'i', 's', 'c', 'o', 'n', 'o' }; +static const symbol s_7_67[5] = { 'a', 'r', 'o', 'n', 'o' }; +static const symbol s_7_68[5] = { 'e', 'r', 'o', 'n', 'o' }; +static const symbol s_7_69[5] = { 'i', 'r', 'o', 'n', 'o' }; +static const symbol s_7_70[8] = { 'e', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_71[8] = { 'i', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_72[6] = { 'a', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_73[6] = { 'e', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_74[6] = { 'i', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_75[3] = { 'a', 't', 'o' }; +static const symbol s_7_76[3] = { 'i', 't', 'o' }; +static const symbol s_7_77[3] = { 'u', 't', 'o' }; +static const symbol s_7_78[3] = { 'a', 'v', 'o' }; +static const symbol s_7_79[3] = { 'e', 'v', 'o' }; +static const symbol s_7_80[3] = { 'i', 'v', 'o' }; +static const symbol s_7_81[2] = { 'a', 'r' }; +static const symbol s_7_82[2] = { 'i', 'r' }; +static const symbol s_7_83[3] = { 'e', 'r', 0xE0 }; +static const symbol s_7_84[3] = { 'i', 'r', 0xE0 }; +static const symbol s_7_85[3] = { 'e', 'r', 0xF2 }; +static const symbol s_7_86[3] = { 'i', 'r', 0xF2 }; +static const struct among a_7[87] = { +{ 4, s_7_0, 0, 1, 0}, +{ 4, s_7_1, 0, 1, 0}, +{ 3, s_7_2, 0, 1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 3, s_7_4, 0, 1, 0}, +{ 3, s_7_5, 0, 1, 0}, +{ 3, s_7_6, 0, 1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 6, s_7_8, 0, 1, 0}, +{ 6, s_7_9, 0, 1, 0}, +{ 4, s_7_10, 0, 1, 0}, +{ 4, s_7_11, 0, 1, 0}, +{ 3, s_7_12, 0, 1, 0}, +{ 3, s_7_13, 0, 1, 0}, +{ 3, s_7_14, 0, 1, 0}, +{ 4, s_7_15, 0, 1, 0}, +{ 3, s_7_16, 0, 1, 0}, +{ 5, s_7_17, -1, 1, 0}, +{ 5, s_7_18, -2, 1, 0}, +{ 5, s_7_19, -3, 1, 0}, +{ 3, s_7_20, 0, 1, 0}, +{ 5, s_7_21, -1, 1, 0}, +{ 5, s_7_22, -2, 1, 0}, +{ 3, s_7_23, 0, 1, 0}, +{ 6, s_7_24, 0, 1, 0}, +{ 6, s_7_25, 0, 1, 0}, +{ 3, s_7_26, 0, 1, 0}, +{ 4, s_7_27, 0, 1, 0}, +{ 4, s_7_28, 0, 1, 0}, +{ 4, s_7_29, 0, 1, 0}, +{ 4, s_7_30, 0, 1, 0}, +{ 4, s_7_31, 0, 1, 0}, +{ 4, s_7_32, 0, 1, 0}, +{ 4, s_7_33, 0, 1, 0}, +{ 3, s_7_34, 0, 1, 0}, +{ 3, s_7_35, 0, 1, 0}, +{ 6, s_7_36, 0, 1, 0}, +{ 6, s_7_37, 0, 1, 0}, +{ 3, s_7_38, 0, 1, 0}, +{ 3, s_7_39, 0, 1, 0}, +{ 3, s_7_40, 0, 1, 0}, +{ 3, s_7_41, 0, 1, 0}, +{ 4, s_7_42, 0, 1, 0}, +{ 4, s_7_43, 0, 1, 0}, +{ 4, s_7_44, 0, 1, 0}, +{ 4, s_7_45, 0, 1, 0}, +{ 4, s_7_46, 0, 1, 0}, +{ 5, s_7_47, 0, 1, 0}, +{ 5, s_7_48, 0, 1, 0}, +{ 5, s_7_49, 0, 1, 0}, +{ 5, s_7_50, 0, 1, 0}, +{ 5, s_7_51, 0, 1, 0}, +{ 6, s_7_52, 0, 1, 0}, +{ 4, s_7_53, 0, 1, 0}, +{ 4, s_7_54, 0, 1, 0}, +{ 6, s_7_55, -1, 1, 0}, +{ 6, s_7_56, -2, 1, 0}, +{ 4, s_7_57, 0, 1, 0}, +{ 3, s_7_58, 0, 1, 0}, +{ 6, s_7_59, -1, 1, 0}, +{ 5, s_7_60, -2, 1, 0}, +{ 5, s_7_61, -3, 1, 0}, +{ 5, s_7_62, -4, 1, 0}, +{ 6, s_7_63, 0, 1, 0}, +{ 6, s_7_64, 0, 1, 0}, +{ 3, s_7_65, 0, 1, 0}, +{ 6, s_7_66, -1, 1, 0}, +{ 5, s_7_67, -2, 1, 0}, +{ 5, s_7_68, -3, 1, 0}, +{ 5, s_7_69, -4, 1, 0}, +{ 8, s_7_70, 0, 1, 0}, +{ 8, s_7_71, 0, 1, 0}, +{ 6, s_7_72, 0, 1, 0}, +{ 6, s_7_73, 0, 1, 0}, +{ 6, s_7_74, 0, 1, 0}, +{ 3, s_7_75, 0, 1, 0}, +{ 3, s_7_76, 0, 1, 0}, +{ 3, s_7_77, 0, 1, 0}, +{ 3, s_7_78, 0, 1, 0}, +{ 3, s_7_79, 0, 1, 0}, +{ 3, s_7_80, 0, 1, 0}, +{ 2, s_7_81, 0, 1, 0}, +{ 2, s_7_82, 0, 1, 0}, +{ 3, s_7_83, 0, 1, 0}, +{ 3, s_7_84, 0, 1, 0}, +{ 3, s_7_85, 0, 1, 0}, +{ 3, s_7_86, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2, 1 }; + +static const unsigned char g_AEIO[] = { 17, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2 }; + +static const unsigned char g_CG[] = { 17 }; + +static const symbol s_0[] = { 0xE0 }; +static const symbol s_1[] = { 0xE8 }; +static const symbol s_2[] = { 0xEC }; +static const symbol s_3[] = { 0xF2 }; +static const symbol s_4[] = { 0xF9 }; +static const symbol s_5[] = { 'q', 'U' }; +static const symbol s_6[] = { 'U' }; +static const symbol s_7[] = { 'I' }; +static const symbol s_8[] = { 'd', 'i', 'v', 'a', 'n' }; +static const symbol s_9[] = { 'i' }; +static const symbol s_10[] = { 'u' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'i', 'c' }; +static const symbol s_13[] = { 'l', 'o', 'g' }; +static const symbol s_14[] = { 'u' }; +static const symbol s_15[] = { 'e', 'n', 't', 'e' }; +static const symbol s_16[] = { 'a', 't' }; +static const symbol s_17[] = { 'a', 't' }; +static const symbol s_18[] = { 'i', 'c' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 7); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 7: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + while (1) { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + z->bra = z->c; + { + int v_5 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab4; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab4; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = v_5; + if (z->c == z->l || z->p[z->c] != 'i') goto lab2; + z->c++; + z->ket = z->c; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + } + lab3: + z->c = v_4; + break; + lab2: + z->c = v_4; + if (z->c >= z->l) goto lab1; + z->c++; + } + continue; + lab1: + z->c = v_3; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping(z, g_v, 97, 249, 0)) goto lab4; + { + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (!(eq_s(z, 5, s_8))) goto lab5; + goto lab1; + lab5: + z->c = v_2; + if (out_grouping(z, g_v, 97, 249, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping(z, g_v, 97, 249, 0)) goto lab7; + { + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + goto lab6; + lab7: + z->c = v_4; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab0; + if (z->c >= z->l) goto lab0; + z->c++; + } + lab6: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + z->I[0] = z->c; + lab8: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 85)) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33314 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_2, 37)) return 0; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 111 && z->p[z->c - 1] != 114)) return 0; + among_var = find_among_b(z, a_3, 5); + if (!among_var) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_6, 51); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_12))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_13); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_14); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_15); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4722696 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_2; goto lab1; } + among_var = find_among_b(z, a_4, 4); + if (!among_var) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_16))) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab1: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_5, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 9: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_17))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_18))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_7, 87)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_vowel_suffix(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (in_grouping_b(z, g_AEIO, 97, 242, 0)) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'h') { z->c = z->l - v_2; goto lab1; } + z->c--; + z->bra = z->c; + if (in_grouping_b(z, g_CG, 99, 103, 0)) { z->c = z->l - v_2; goto lab1; } + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + ; + } + return 1; +} + +extern int italian_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_4; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = r_vowel_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + z->c = z->lb; + { + int v_6 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_6; + } + return 1; +} + +extern struct SN_env * italian_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void italian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.h new file mode 100644 index 000000000000..38cd2193fd4e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_italian.h @@ -0,0 +1,15 @@ +/* Generated from italian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_ISO_8859_1_create_env(void); +extern void italian_ISO_8859_1_close_env(struct SN_env * z); + +extern int italian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.c new file mode 100644 index 000000000000..6e2f612e3526 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.c @@ -0,0 +1,344 @@ +/* Generated from norwegian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int norwegian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void); +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[3] = { 'i', 'n', 'd' }; +static const symbol s_0_2[2] = { 'k', 'k' }; +static const symbol s_0_3[2] = { 'n', 'k' }; +static const symbol s_0_4[3] = { 'a', 'm', 'm' }; +static const symbol s_0_5[3] = { 'o', 'm', 'm' }; +static const symbol s_0_6[3] = { 'k', 'a', 'p' }; +static const symbol s_0_7[4] = { 's', 'k', 'a', 'p' }; +static const symbol s_0_8[2] = { 'p', 'p' }; +static const symbol s_0_9[2] = { 'l', 't' }; +static const symbol s_0_10[3] = { 'a', 's', 't' }; +static const symbol s_0_11[3] = { 0xF8, 's', 't' }; +static const symbol s_0_12[1] = { 'v' }; +static const symbol s_0_13[3] = { 'h', 'a', 'v' }; +static const symbol s_0_14[3] = { 'g', 'i', 'v' }; +static const struct among a_0[15] = { +{ 0, 0, 0, 1, 0}, +{ 3, s_0_1, -1, -1, 0}, +{ 2, s_0_2, -2, -1, 0}, +{ 2, s_0_3, -3, -1, 0}, +{ 3, s_0_4, -4, -1, 0}, +{ 3, s_0_5, -5, -1, 0}, +{ 3, s_0_6, -6, -1, 0}, +{ 4, s_0_7, -1, 1, 0}, +{ 2, s_0_8, -8, -1, 0}, +{ 2, s_0_9, -9, -1, 0}, +{ 3, s_0_10, -10, -1, 0}, +{ 3, s_0_11, -11, -1, 0}, +{ 1, s_0_12, -12, -1, 0}, +{ 3, s_0_13, -1, 1, 0}, +{ 3, s_0_14, -2, 1, 0} +}; + +static const symbol s_1_0[1] = { 'a' }; +static const symbol s_1_1[1] = { 'e' }; +static const symbol s_1_2[3] = { 'e', 'd', 'e' }; +static const symbol s_1_3[4] = { 'a', 'n', 'd', 'e' }; +static const symbol s_1_4[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_1_5[3] = { 'a', 'n', 'e' }; +static const symbol s_1_6[3] = { 'e', 'n', 'e' }; +static const symbol s_1_7[6] = { 'h', 'e', 't', 'e', 'n', 'e' }; +static const symbol s_1_8[4] = { 'e', 'r', 't', 'e' }; +static const symbol s_1_9[2] = { 'e', 'n' }; +static const symbol s_1_10[5] = { 'h', 'e', 't', 'e', 'n' }; +static const symbol s_1_11[2] = { 'a', 'r' }; +static const symbol s_1_12[2] = { 'e', 'r' }; +static const symbol s_1_13[5] = { 'h', 'e', 't', 'e', 'r' }; +static const symbol s_1_14[1] = { 's' }; +static const symbol s_1_15[2] = { 'a', 's' }; +static const symbol s_1_16[2] = { 'e', 's' }; +static const symbol s_1_17[4] = { 'e', 'd', 'e', 's' }; +static const symbol s_1_18[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_1_19[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_1_20[7] = { 'h', 'e', 't', 'e', 'n', 'e', 's' }; +static const symbol s_1_21[3] = { 'e', 'n', 's' }; +static const symbol s_1_22[6] = { 'h', 'e', 't', 'e', 'n', 's' }; +static const symbol s_1_23[3] = { 'e', 'r', 's' }; +static const symbol s_1_24[3] = { 'e', 't', 's' }; +static const symbol s_1_25[2] = { 'e', 't' }; +static const symbol s_1_26[3] = { 'h', 'e', 't' }; +static const symbol s_1_27[3] = { 'e', 'r', 't' }; +static const symbol s_1_28[3] = { 'a', 's', 't' }; +static const struct among a_1[29] = { +{ 1, s_1_0, 0, 1, 0}, +{ 1, s_1_1, 0, 1, 0}, +{ 3, s_1_2, -1, 1, 0}, +{ 4, s_1_3, -2, 1, 0}, +{ 4, s_1_4, -3, 1, 0}, +{ 3, s_1_5, -4, 1, 0}, +{ 3, s_1_6, -5, 1, 0}, +{ 6, s_1_7, -1, 1, 0}, +{ 4, s_1_8, -7, 4, 0}, +{ 2, s_1_9, 0, 1, 0}, +{ 5, s_1_10, -1, 1, 0}, +{ 2, s_1_11, 0, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 5, s_1_13, -1, 1, 0}, +{ 1, s_1_14, 0, 3, 0}, +{ 2, s_1_15, -1, 1, 0}, +{ 2, s_1_16, -2, 1, 0}, +{ 4, s_1_17, -1, 1, 0}, +{ 5, s_1_18, -2, 1, 0}, +{ 4, s_1_19, -3, 1, 0}, +{ 7, s_1_20, -1, 1, 0}, +{ 3, s_1_21, -7, 1, 0}, +{ 6, s_1_22, -1, 1, 0}, +{ 3, s_1_23, -9, 2, 0}, +{ 3, s_1_24, -10, 1, 0}, +{ 2, s_1_25, 0, 1, 0}, +{ 3, s_1_26, -1, 1, 0}, +{ 3, s_1_27, 0, 4, 0}, +{ 3, s_1_28, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 't' }; +static const symbol s_2_1[2] = { 'v', 't' }; +static const struct among a_2[2] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0} +}; + +static const symbol s_3_0[3] = { 'l', 'e', 'g' }; +static const symbol s_3_1[4] = { 'e', 'l', 'e', 'g' }; +static const symbol s_3_2[2] = { 'i', 'g' }; +static const symbol s_3_3[3] = { 'e', 'i', 'g' }; +static const symbol s_3_4[3] = { 'l', 'i', 'g' }; +static const symbol s_3_5[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_3_6[3] = { 'e', 'l', 's' }; +static const symbol s_3_7[3] = { 'l', 'o', 'v' }; +static const symbol s_3_8[4] = { 'e', 'l', 'o', 'v' }; +static const symbol s_3_9[4] = { 's', 'l', 'o', 'v' }; +static const symbol s_3_10[7] = { 'h', 'e', 't', 's', 'l', 'o', 'v' }; +static const struct among a_3[11] = { +{ 3, s_3_0, 0, 1, 0}, +{ 4, s_3_1, -1, 1, 0}, +{ 2, s_3_2, 0, 1, 0}, +{ 3, s_3_3, -1, 1, 0}, +{ 3, s_3_4, -2, 1, 0}, +{ 4, s_3_5, -1, 1, 0}, +{ 3, s_3_6, 0, 1, 0}, +{ 3, s_3_7, 0, 1, 0}, +{ 4, s_3_8, -1, 1, 0}, +{ 4, s_3_9, -2, 1, 0}, +{ 7, s_3_10, -1, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 2, 142 }; + +static const unsigned char g_s_ending[] = { 119, 125, 148, 1 }; + +static const symbol s_0[] = { 'e', 'r' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851426 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_1, 29); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((5318672 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 1; else + among_var = find_among_b(z, a_0, 15); + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + break; + case 3: + { + int v_2 = z->l - z->c; + if (in_grouping_b(z, g_s_ending, 98, 122, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'r') goto lab2; + z->c--; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab3; + z->c--; + goto lab2; + lab3: + z->c = z->l - v_3; + } + goto lab0; + lab2: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'k') return 0; + z->c--; + if (out_grouping_b(z, g_v, 97, 248, 0)) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { + int v_1 = z->l - z->c; + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) { z->lb = v_2; return 0; } + if (!find_among_b(z, a_2, 2)) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + z->c = z->l - v_1; + } + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718720 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_3, 11)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int norwegian_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void) { return SN_create_env(0, 2); } + +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.h new file mode 100644 index 000000000000..6a11427aec3f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_norwegian.h @@ -0,0 +1,15 @@ +/* Generated from norwegian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void); +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); + +extern int norwegian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.c new file mode 100644 index 000000000000..73cb3d47e9d2 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.c @@ -0,0 +1,761 @@ +/* Generated from porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int porter_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_Step_5b(struct SN_env * z); +static int r_Step_5a(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * porter_ISO_8859_1_create_env(void); +extern void porter_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 's' }; +static const symbol s_0_1[3] = { 'i', 'e', 's' }; +static const symbol s_0_2[4] = { 's', 's', 'e', 's' }; +static const symbol s_0_3[2] = { 's', 's' }; +static const struct among a_0[4] = { +{ 1, s_0_0, 0, 3, 0}, +{ 3, s_0_1, -1, 2, 0}, +{ 4, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, -1, 0} +}; + +static const symbol s_1_1[2] = { 'b', 'b' }; +static const symbol s_1_2[2] = { 'd', 'd' }; +static const symbol s_1_3[2] = { 'f', 'f' }; +static const symbol s_1_4[2] = { 'g', 'g' }; +static const symbol s_1_5[2] = { 'b', 'l' }; +static const symbol s_1_6[2] = { 'm', 'm' }; +static const symbol s_1_7[2] = { 'n', 'n' }; +static const symbol s_1_8[2] = { 'p', 'p' }; +static const symbol s_1_9[2] = { 'r', 'r' }; +static const symbol s_1_10[2] = { 'a', 't' }; +static const symbol s_1_11[2] = { 't', 't' }; +static const symbol s_1_12[2] = { 'i', 'z' }; +static const struct among a_1[13] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_1_1, -1, 2, 0}, +{ 2, s_1_2, -2, 2, 0}, +{ 2, s_1_3, -3, 2, 0}, +{ 2, s_1_4, -4, 2, 0}, +{ 2, s_1_5, -5, 1, 0}, +{ 2, s_1_6, -6, 2, 0}, +{ 2, s_1_7, -7, 2, 0}, +{ 2, s_1_8, -8, 2, 0}, +{ 2, s_1_9, -9, 2, 0}, +{ 2, s_1_10, -10, 1, 0}, +{ 2, s_1_11, -11, 2, 0}, +{ 2, s_1_12, -12, 1, 0} +}; + +static const symbol s_2_0[2] = { 'e', 'd' }; +static const symbol s_2_1[3] = { 'e', 'e', 'd' }; +static const symbol s_2_2[3] = { 'i', 'n', 'g' }; +static const struct among a_2[3] = { +{ 2, s_2_0, 0, 2, 0}, +{ 3, s_2_1, -1, 1, 0}, +{ 3, s_2_2, 0, 2, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_3_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_3_2[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_3_3[3] = { 'e', 'l', 'i' }; +static const symbol s_3_4[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_3_5[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_3_6[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_3_7[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_3_8[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_3_9[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_3_10[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_11[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_12[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_3_13[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_14[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_15[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_3_16[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_3_17[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_3_18[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_3_19[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; +static const struct among a_3[20] = { +{ 4, s_3_0, 0, 3, 0}, +{ 4, s_3_1, 0, 2, 0}, +{ 4, s_3_2, 0, 4, 0}, +{ 3, s_3_3, 0, 6, 0}, +{ 4, s_3_4, 0, 9, 0}, +{ 5, s_3_5, 0, 11, 0}, +{ 5, s_3_6, 0, 5, 0}, +{ 5, s_3_7, 0, 9, 0}, +{ 6, s_3_8, 0, 13, 0}, +{ 5, s_3_9, 0, 12, 0}, +{ 6, s_3_10, 0, 1, 0}, +{ 7, s_3_11, -1, 8, 0}, +{ 5, s_3_12, 0, 9, 0}, +{ 5, s_3_13, 0, 8, 0}, +{ 7, s_3_14, -1, 7, 0}, +{ 4, s_3_15, 0, 7, 0}, +{ 4, s_3_16, 0, 8, 0}, +{ 7, s_3_17, 0, 12, 0}, +{ 7, s_3_18, 0, 10, 0}, +{ 7, s_3_19, 0, 11, 0} +}; + +static const symbol s_4_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_4_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_4_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_4_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_4_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_4_5[3] = { 'f', 'u', 'l' }; +static const symbol s_4_6[4] = { 'n', 'e', 's', 's' }; +static const struct among a_4[7] = { +{ 5, s_4_0, 0, 2, 0}, +{ 5, s_4_1, 0, 3, 0}, +{ 5, s_4_2, 0, 1, 0}, +{ 5, s_4_3, 0, 2, 0}, +{ 4, s_4_4, 0, 2, 0}, +{ 3, s_4_5, 0, 3, 0}, +{ 4, s_4_6, 0, 3, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_5_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_5_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_5_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_5_5[3] = { 'a', 't', 'e' }; +static const symbol s_5_6[3] = { 'i', 'v', 'e' }; +static const symbol s_5_7[3] = { 'i', 'z', 'e' }; +static const symbol s_5_8[3] = { 'i', 't', 'i' }; +static const symbol s_5_9[2] = { 'a', 'l' }; +static const symbol s_5_10[3] = { 'i', 's', 'm' }; +static const symbol s_5_11[3] = { 'i', 'o', 'n' }; +static const symbol s_5_12[2] = { 'e', 'r' }; +static const symbol s_5_13[3] = { 'o', 'u', 's' }; +static const symbol s_5_14[3] = { 'a', 'n', 't' }; +static const symbol s_5_15[3] = { 'e', 'n', 't' }; +static const symbol s_5_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_5_17[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_5_18[2] = { 'o', 'u' }; +static const struct among a_5[19] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0}, +{ 4, s_5_3, 0, 1, 0}, +{ 4, s_5_4, 0, 1, 0}, +{ 3, s_5_5, 0, 1, 0}, +{ 3, s_5_6, 0, 1, 0}, +{ 3, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 1, 0}, +{ 2, s_5_9, 0, 1, 0}, +{ 3, s_5_10, 0, 1, 0}, +{ 3, s_5_11, 0, 2, 0}, +{ 2, s_5_12, 0, 1, 0}, +{ 3, s_5_13, 0, 1, 0}, +{ 3, s_5_14, 0, 1, 0}, +{ 3, s_5_15, 0, 1, 0}, +{ 4, s_5_16, -1, 1, 0}, +{ 5, s_5_17, -1, 1, 0}, +{ 2, s_5_18, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const symbol s_0[] = { 's', 's' }; +static const symbol s_1[] = { 'i' }; +static const symbol s_2[] = { 'e', 'e' }; +static const symbol s_3[] = { 'e' }; +static const symbol s_4[] = { 'e' }; +static const symbol s_5[] = { 'i' }; +static const symbol s_6[] = { 't', 'i', 'o', 'n' }; +static const symbol s_7[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_8[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_9[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_10[] = { 'e', 'n', 't' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'i', 'z', 'e' }; +static const symbol s_13[] = { 'a', 't', 'e' }; +static const symbol s_14[] = { 'a', 'l' }; +static const symbol s_15[] = { 'f', 'u', 'l' }; +static const symbol s_16[] = { 'o', 'u', 's' }; +static const symbol s_17[] = { 'i', 'v', 'e' }; +static const symbol s_18[] = { 'b', 'l', 'e' }; +static const symbol s_19[] = { 'a', 'l' }; +static const symbol s_20[] = { 'i', 'c' }; +static const symbol s_21[] = { 'Y' }; +static const symbol s_22[] = { 'Y' }; +static const symbol s_23[] = { 'y' }; + +static int r_shortv(struct SN_env * z) { + if (out_grouping_b(z, g_v_WXY, 89, 121, 0)) return 0; + if (in_grouping_b(z, g_v, 97, 121, 0)) return 0; + if (out_grouping_b(z, g_v, 97, 121, 0)) return 0; + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 115) return 0; + among_var = find_among_b(z, a_0, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 103)) return 0; + among_var = find_among_b(z, a_2, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + { + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_1, 13); + z->c = z->l - v_2; + } + switch (among_var) { + case 1: + { + int saved_c = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_3); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 2: + z->ket = z->c; + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c != z->I[1]) return 0; + { + int v_3 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_3; + } + { + int saved_c = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_4); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') return 0; + z->c--; + } +lab0: + z->bra = z->c; + { + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((815616 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 20); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_8); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_9); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_10); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_12); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 3, s_13); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 3, s_15); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 3, s_18); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_4, 7); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_19); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_20); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((3961384 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 19); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5a(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; +lab1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - v_1; + } +lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_5b(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int porter_ISO_8859_1_stem(struct SN_env * z) { + z->I[2] = 0; + { + int v_1 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab0; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_21); + if (ret < 0) return ret; + } + z->I[2] = 1; + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + if (in_grouping(z, g_v, 97, 121, 0)) goto lab3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab3; + z->c++; + z->ket = z->c; + z->c = v_4; + break; + lab3: + z->c = v_4; + if (z->c >= z->l) goto lab2; + z->c++; + } + { + int ret = slice_from_s(z, 1, s_22); + if (ret < 0) return ret; + } + z->I[2] = 1; + continue; + lab2: + z->c = v_3; + break; + } + z->c = v_2; + } + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_5 = z->c; + { + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[0] = z->c; + lab4: + z->c = v_5; + } + z->lb = z->c; z->c = z->l; + { + int v_6 = z->l - z->c; + { + int ret = r_Step_1a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_Step_1b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_Step_1c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + { + int v_11 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + } + { + int v_12 = z->l - z->c; + { + int ret = r_Step_5a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_12; + } + { + int v_13 = z->l - z->c; + { + int ret = r_Step_5b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_13; + } + z->c = z->lb; + { + int v_14 = z->c; + if (!(z->I[2])) goto lab5; + while (1) { + int v_15 = z->c; + while (1) { + int v_16 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'Y') goto lab7; + z->c++; + z->ket = z->c; + z->c = v_16; + break; + lab7: + z->c = v_16; + if (z->c >= z->l) goto lab6; + z->c++; + } + { + int ret = slice_from_s(z, 1, s_23); + if (ret < 0) return ret; + } + continue; + lab6: + z->c = v_15; + break; + } + lab5: + z->c = v_14; + } + return 1; +} + +extern struct SN_env * porter_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void porter_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.h new file mode 100644 index 000000000000..250a2c2377de --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_porter.h @@ -0,0 +1,15 @@ +/* Generated from porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_ISO_8859_1_create_env(void); +extern void porter_ISO_8859_1_close_env(struct SN_env * z); + +extern int porter_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.c new file mode 100644 index 000000000000..6a5f6767a493 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.c @@ -0,0 +1,1007 @@ +/* Generated from portuguese.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int portuguese_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_form(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void); +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xE3 }; +static const symbol s_0_2[1] = { 0xF5 }; +static const struct among a_0[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_0_1, -1, 1, 0}, +{ 1, s_0_2, -2, 2, 0} +}; + +static const symbol s_1_1[2] = { 'a', '~' }; +static const symbol s_1_2[2] = { 'o', '~' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_1_1, -1, 1, 0}, +{ 2, s_1_2, -2, 2, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'c' }; +static const symbol s_2_1[2] = { 'a', 'd' }; +static const symbol s_2_2[2] = { 'o', 's' }; +static const symbol s_2_3[2] = { 'i', 'v' }; +static const struct among a_2[4] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, 1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_3_1[4] = { 'a', 'v', 'e', 'l' }; +static const symbol s_3_2[4] = { 0xED, 'v', 'e', 'l' }; +static const struct among a_3[3] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 4, s_3_2, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'i', 'v' }; +static const struct among a_4[3] = { +{ 2, s_4_0, 0, 1, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 2, s_4_2, 0, 1, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'c', 'a' }; +static const symbol s_5_1[5] = { 0xE2, 'n', 'c', 'i', 'a' }; +static const symbol s_5_2[5] = { 0xEA, 'n', 'c', 'i', 'a' }; +static const symbol s_5_3[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_5_4[3] = { 'i', 'r', 'a' }; +static const symbol s_5_5[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_5_6[3] = { 'o', 's', 'a' }; +static const symbol s_5_7[4] = { 'i', 's', 't', 'a' }; +static const symbol s_5_8[3] = { 'i', 'v', 'a' }; +static const symbol s_5_9[3] = { 'e', 'z', 'a' }; +static const symbol s_5_10[5] = { 'i', 'd', 'a', 'd', 'e' }; +static const symbol s_5_11[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_5_12[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_13[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_14[4] = { 0xE1, 'v', 'e', 'l' }; +static const symbol s_5_15[4] = { 0xED, 'v', 'e', 'l' }; +static const symbol s_5_16[3] = { 'i', 'c', 'o' }; +static const symbol s_5_17[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_5_18[3] = { 'o', 's', 'o' }; +static const symbol s_5_19[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_20[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_21[3] = { 'i', 'v', 'o' }; +static const symbol s_5_22[5] = { 'a', 0xE7, 'a', '~', 'o' }; +static const symbol s_5_23[5] = { 'u', 0xE7, 'a', '~', 'o' }; +static const symbol s_5_24[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_5_25[4] = { 'i', 'c', 'a', 's' }; +static const symbol s_5_26[6] = { 0xEA, 'n', 'c', 'i', 'a', 's' }; +static const symbol s_5_27[6] = { 'l', 'o', 'g', 'i', 'a', 's' }; +static const symbol s_5_28[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_29[6] = { 'a', 'd', 'o', 'r', 'a', 's' }; +static const symbol s_5_30[4] = { 'o', 's', 'a', 's' }; +static const symbol s_5_31[5] = { 'i', 's', 't', 'a', 's' }; +static const symbol s_5_32[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_5_33[4] = { 'e', 'z', 'a', 's' }; +static const symbol s_5_34[6] = { 'i', 'd', 'a', 'd', 'e', 's' }; +static const symbol s_5_35[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_5_36[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_37[6] = { 'a', 0xE7, 'o', '~', 'e', 's' }; +static const symbol s_5_38[6] = { 'u', 0xE7, 'o', '~', 'e', 's' }; +static const symbol s_5_39[4] = { 'i', 'c', 'o', 's' }; +static const symbol s_5_40[5] = { 'i', 's', 'm', 'o', 's' }; +static const symbol s_5_41[4] = { 'o', 's', 'o', 's' }; +static const symbol s_5_42[7] = { 'a', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_43[7] = { 'i', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_44[4] = { 'i', 'v', 'o', 's' }; +static const struct among a_5[45] = { +{ 3, s_5_0, 0, 1, 0}, +{ 5, s_5_1, 0, 1, 0}, +{ 5, s_5_2, 0, 4, 0}, +{ 5, s_5_3, 0, 2, 0}, +{ 3, s_5_4, 0, 9, 0}, +{ 5, s_5_5, 0, 1, 0}, +{ 3, s_5_6, 0, 1, 0}, +{ 4, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 8, 0}, +{ 3, s_5_9, 0, 1, 0}, +{ 5, s_5_10, 0, 7, 0}, +{ 4, s_5_11, 0, 1, 0}, +{ 5, s_5_12, 0, 6, 0}, +{ 6, s_5_13, -1, 5, 0}, +{ 4, s_5_14, 0, 1, 0}, +{ 4, s_5_15, 0, 1, 0}, +{ 3, s_5_16, 0, 1, 0}, +{ 4, s_5_17, 0, 1, 0}, +{ 3, s_5_18, 0, 1, 0}, +{ 6, s_5_19, 0, 1, 0}, +{ 6, s_5_20, 0, 1, 0}, +{ 3, s_5_21, 0, 8, 0}, +{ 5, s_5_22, 0, 1, 0}, +{ 5, s_5_23, 0, 3, 0}, +{ 4, s_5_24, 0, 1, 0}, +{ 4, s_5_25, 0, 1, 0}, +{ 6, s_5_26, 0, 4, 0}, +{ 6, s_5_27, 0, 2, 0}, +{ 4, s_5_28, 0, 9, 0}, +{ 6, s_5_29, 0, 1, 0}, +{ 4, s_5_30, 0, 1, 0}, +{ 5, s_5_31, 0, 1, 0}, +{ 4, s_5_32, 0, 8, 0}, +{ 4, s_5_33, 0, 1, 0}, +{ 6, s_5_34, 0, 7, 0}, +{ 6, s_5_35, 0, 1, 0}, +{ 5, s_5_36, 0, 1, 0}, +{ 6, s_5_37, 0, 1, 0}, +{ 6, s_5_38, 0, 3, 0}, +{ 4, s_5_39, 0, 1, 0}, +{ 5, s_5_40, 0, 1, 0}, +{ 4, s_5_41, 0, 1, 0}, +{ 7, s_5_42, 0, 1, 0}, +{ 7, s_5_43, 0, 1, 0}, +{ 4, s_5_44, 0, 8, 0} +}; + +static const symbol s_6_0[3] = { 'a', 'd', 'a' }; +static const symbol s_6_1[3] = { 'i', 'd', 'a' }; +static const symbol s_6_2[2] = { 'i', 'a' }; +static const symbol s_6_3[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_6_4[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_6_5[4] = { 'i', 'r', 'i', 'a' }; +static const symbol s_6_6[3] = { 'a', 'r', 'a' }; +static const symbol s_6_7[3] = { 'e', 'r', 'a' }; +static const symbol s_6_8[3] = { 'i', 'r', 'a' }; +static const symbol s_6_9[3] = { 'a', 'v', 'a' }; +static const symbol s_6_10[4] = { 'a', 's', 's', 'e' }; +static const symbol s_6_11[4] = { 'e', 's', 's', 'e' }; +static const symbol s_6_12[4] = { 'i', 's', 's', 'e' }; +static const symbol s_6_13[4] = { 'a', 's', 't', 'e' }; +static const symbol s_6_14[4] = { 'e', 's', 't', 'e' }; +static const symbol s_6_15[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_16[2] = { 'e', 'i' }; +static const symbol s_6_17[4] = { 'a', 'r', 'e', 'i' }; +static const symbol s_6_18[4] = { 'e', 'r', 'e', 'i' }; +static const symbol s_6_19[4] = { 'i', 'r', 'e', 'i' }; +static const symbol s_6_20[2] = { 'a', 'm' }; +static const symbol s_6_21[3] = { 'i', 'a', 'm' }; +static const symbol s_6_22[5] = { 'a', 'r', 'i', 'a', 'm' }; +static const symbol s_6_23[5] = { 'e', 'r', 'i', 'a', 'm' }; +static const symbol s_6_24[5] = { 'i', 'r', 'i', 'a', 'm' }; +static const symbol s_6_25[4] = { 'a', 'r', 'a', 'm' }; +static const symbol s_6_26[4] = { 'e', 'r', 'a', 'm' }; +static const symbol s_6_27[4] = { 'i', 'r', 'a', 'm' }; +static const symbol s_6_28[4] = { 'a', 'v', 'a', 'm' }; +static const symbol s_6_29[2] = { 'e', 'm' }; +static const symbol s_6_30[4] = { 'a', 'r', 'e', 'm' }; +static const symbol s_6_31[4] = { 'e', 'r', 'e', 'm' }; +static const symbol s_6_32[4] = { 'i', 'r', 'e', 'm' }; +static const symbol s_6_33[5] = { 'a', 's', 's', 'e', 'm' }; +static const symbol s_6_34[5] = { 'e', 's', 's', 'e', 'm' }; +static const symbol s_6_35[5] = { 'i', 's', 's', 'e', 'm' }; +static const symbol s_6_36[3] = { 'a', 'd', 'o' }; +static const symbol s_6_37[3] = { 'i', 'd', 'o' }; +static const symbol s_6_38[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_6_39[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_6_40[4] = { 'i', 'n', 'd', 'o' }; +static const symbol s_6_41[5] = { 'a', 'r', 'a', '~', 'o' }; +static const symbol s_6_42[5] = { 'e', 'r', 'a', '~', 'o' }; +static const symbol s_6_43[5] = { 'i', 'r', 'a', '~', 'o' }; +static const symbol s_6_44[2] = { 'a', 'r' }; +static const symbol s_6_45[2] = { 'e', 'r' }; +static const symbol s_6_46[2] = { 'i', 'r' }; +static const symbol s_6_47[2] = { 'a', 's' }; +static const symbol s_6_48[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_6_49[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_6_50[3] = { 'i', 'a', 's' }; +static const symbol s_6_51[5] = { 'a', 'r', 'i', 'a', 's' }; +static const symbol s_6_52[5] = { 'e', 'r', 'i', 'a', 's' }; +static const symbol s_6_53[5] = { 'i', 'r', 'i', 'a', 's' }; +static const symbol s_6_54[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_6_55[4] = { 'e', 'r', 'a', 's' }; +static const symbol s_6_56[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_6_57[4] = { 'a', 'v', 'a', 's' }; +static const symbol s_6_58[2] = { 'e', 's' }; +static const symbol s_6_59[5] = { 'a', 'r', 'd', 'e', 's' }; +static const symbol s_6_60[5] = { 'e', 'r', 'd', 'e', 's' }; +static const symbol s_6_61[5] = { 'i', 'r', 'd', 'e', 's' }; +static const symbol s_6_62[4] = { 'a', 'r', 'e', 's' }; +static const symbol s_6_63[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_6_64[4] = { 'i', 'r', 'e', 's' }; +static const symbol s_6_65[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_6_66[5] = { 'e', 's', 's', 'e', 's' }; +static const symbol s_6_67[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_6_68[5] = { 'a', 's', 't', 'e', 's' }; +static const symbol s_6_69[5] = { 'e', 's', 't', 'e', 's' }; +static const symbol s_6_70[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_6_71[2] = { 'i', 's' }; +static const symbol s_6_72[3] = { 'a', 'i', 's' }; +static const symbol s_6_73[3] = { 'e', 'i', 's' }; +static const symbol s_6_74[5] = { 'a', 'r', 'e', 'i', 's' }; +static const symbol s_6_75[5] = { 'e', 'r', 'e', 'i', 's' }; +static const symbol s_6_76[5] = { 'i', 'r', 'e', 'i', 's' }; +static const symbol s_6_77[5] = { 0xE1, 'r', 'e', 'i', 's' }; +static const symbol s_6_78[5] = { 0xE9, 'r', 'e', 'i', 's' }; +static const symbol s_6_79[5] = { 0xED, 'r', 'e', 'i', 's' }; +static const symbol s_6_80[6] = { 0xE1, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_81[6] = { 0xE9, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_82[6] = { 0xED, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_83[5] = { 0xE1, 'v', 'e', 'i', 's' }; +static const symbol s_6_84[4] = { 0xED, 'e', 'i', 's' }; +static const symbol s_6_85[6] = { 'a', 'r', 0xED, 'e', 'i', 's' }; +static const symbol s_6_86[6] = { 'e', 'r', 0xED, 'e', 'i', 's' }; +static const symbol s_6_87[6] = { 'i', 'r', 0xED, 'e', 'i', 's' }; +static const symbol s_6_88[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_6_89[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_6_90[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_6_91[6] = { 0xE1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_92[6] = { 0xE9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_93[6] = { 0xED, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_94[6] = { 0xE1, 'v', 'a', 'm', 'o', 's' }; +static const symbol s_6_95[5] = { 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_6_96[7] = { 'a', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_6_97[7] = { 'e', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_6_98[7] = { 'i', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_6_99[4] = { 'e', 'm', 'o', 's' }; +static const symbol s_6_100[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_101[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_102[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_103[7] = { 0xE1, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_104[7] = { 0xEA, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_105[7] = { 0xED, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_106[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_6_107[5] = { 'a', 'r', 'm', 'o', 's' }; +static const symbol s_6_108[5] = { 'e', 'r', 'm', 'o', 's' }; +static const symbol s_6_109[5] = { 'i', 'r', 'm', 'o', 's' }; +static const symbol s_6_110[4] = { 0xE1, 'm', 'o', 's' }; +static const symbol s_6_111[4] = { 'a', 'r', 0xE1, 's' }; +static const symbol s_6_112[4] = { 'e', 'r', 0xE1, 's' }; +static const symbol s_6_113[4] = { 'i', 'r', 0xE1, 's' }; +static const symbol s_6_114[2] = { 'e', 'u' }; +static const symbol s_6_115[2] = { 'i', 'u' }; +static const symbol s_6_116[2] = { 'o', 'u' }; +static const symbol s_6_117[3] = { 'a', 'r', 0xE1 }; +static const symbol s_6_118[3] = { 'e', 'r', 0xE1 }; +static const symbol s_6_119[3] = { 'i', 'r', 0xE1 }; +static const struct among a_6[120] = { +{ 3, s_6_0, 0, 1, 0}, +{ 3, s_6_1, 0, 1, 0}, +{ 2, s_6_2, 0, 1, 0}, +{ 4, s_6_3, -1, 1, 0}, +{ 4, s_6_4, -2, 1, 0}, +{ 4, s_6_5, -3, 1, 0}, +{ 3, s_6_6, 0, 1, 0}, +{ 3, s_6_7, 0, 1, 0}, +{ 3, s_6_8, 0, 1, 0}, +{ 3, s_6_9, 0, 1, 0}, +{ 4, s_6_10, 0, 1, 0}, +{ 4, s_6_11, 0, 1, 0}, +{ 4, s_6_12, 0, 1, 0}, +{ 4, s_6_13, 0, 1, 0}, +{ 4, s_6_14, 0, 1, 0}, +{ 4, s_6_15, 0, 1, 0}, +{ 2, s_6_16, 0, 1, 0}, +{ 4, s_6_17, -1, 1, 0}, +{ 4, s_6_18, -2, 1, 0}, +{ 4, s_6_19, -3, 1, 0}, +{ 2, s_6_20, 0, 1, 0}, +{ 3, s_6_21, -1, 1, 0}, +{ 5, s_6_22, -1, 1, 0}, +{ 5, s_6_23, -2, 1, 0}, +{ 5, s_6_24, -3, 1, 0}, +{ 4, s_6_25, -5, 1, 0}, +{ 4, s_6_26, -6, 1, 0}, +{ 4, s_6_27, -7, 1, 0}, +{ 4, s_6_28, -8, 1, 0}, +{ 2, s_6_29, 0, 1, 0}, +{ 4, s_6_30, -1, 1, 0}, +{ 4, s_6_31, -2, 1, 0}, +{ 4, s_6_32, -3, 1, 0}, +{ 5, s_6_33, -4, 1, 0}, +{ 5, s_6_34, -5, 1, 0}, +{ 5, s_6_35, -6, 1, 0}, +{ 3, s_6_36, 0, 1, 0}, +{ 3, s_6_37, 0, 1, 0}, +{ 4, s_6_38, 0, 1, 0}, +{ 4, s_6_39, 0, 1, 0}, +{ 4, s_6_40, 0, 1, 0}, +{ 5, s_6_41, 0, 1, 0}, +{ 5, s_6_42, 0, 1, 0}, +{ 5, s_6_43, 0, 1, 0}, +{ 2, s_6_44, 0, 1, 0}, +{ 2, s_6_45, 0, 1, 0}, +{ 2, s_6_46, 0, 1, 0}, +{ 2, s_6_47, 0, 1, 0}, +{ 4, s_6_48, -1, 1, 0}, +{ 4, s_6_49, -2, 1, 0}, +{ 3, s_6_50, -3, 1, 0}, +{ 5, s_6_51, -1, 1, 0}, +{ 5, s_6_52, -2, 1, 0}, +{ 5, s_6_53, -3, 1, 0}, +{ 4, s_6_54, -7, 1, 0}, +{ 4, s_6_55, -8, 1, 0}, +{ 4, s_6_56, -9, 1, 0}, +{ 4, s_6_57, -10, 1, 0}, +{ 2, s_6_58, 0, 1, 0}, +{ 5, s_6_59, -1, 1, 0}, +{ 5, s_6_60, -2, 1, 0}, +{ 5, s_6_61, -3, 1, 0}, +{ 4, s_6_62, -4, 1, 0}, +{ 4, s_6_63, -5, 1, 0}, +{ 4, s_6_64, -6, 1, 0}, +{ 5, s_6_65, -7, 1, 0}, +{ 5, s_6_66, -8, 1, 0}, +{ 5, s_6_67, -9, 1, 0}, +{ 5, s_6_68, -10, 1, 0}, +{ 5, s_6_69, -11, 1, 0}, +{ 5, s_6_70, -12, 1, 0}, +{ 2, s_6_71, 0, 1, 0}, +{ 3, s_6_72, -1, 1, 0}, +{ 3, s_6_73, -2, 1, 0}, +{ 5, s_6_74, -1, 1, 0}, +{ 5, s_6_75, -2, 1, 0}, +{ 5, s_6_76, -3, 1, 0}, +{ 5, s_6_77, -4, 1, 0}, +{ 5, s_6_78, -5, 1, 0}, +{ 5, s_6_79, -6, 1, 0}, +{ 6, s_6_80, -7, 1, 0}, +{ 6, s_6_81, -8, 1, 0}, +{ 6, s_6_82, -9, 1, 0}, +{ 5, s_6_83, -10, 1, 0}, +{ 4, s_6_84, -11, 1, 0}, +{ 6, s_6_85, -1, 1, 0}, +{ 6, s_6_86, -2, 1, 0}, +{ 6, s_6_87, -3, 1, 0}, +{ 4, s_6_88, 0, 1, 0}, +{ 4, s_6_89, 0, 1, 0}, +{ 4, s_6_90, 0, 1, 0}, +{ 6, s_6_91, -1, 1, 0}, +{ 6, s_6_92, -2, 1, 0}, +{ 6, s_6_93, -3, 1, 0}, +{ 6, s_6_94, -4, 1, 0}, +{ 5, s_6_95, -5, 1, 0}, +{ 7, s_6_96, -1, 1, 0}, +{ 7, s_6_97, -2, 1, 0}, +{ 7, s_6_98, -3, 1, 0}, +{ 4, s_6_99, 0, 1, 0}, +{ 6, s_6_100, -1, 1, 0}, +{ 6, s_6_101, -2, 1, 0}, +{ 6, s_6_102, -3, 1, 0}, +{ 7, s_6_103, -4, 1, 0}, +{ 7, s_6_104, -5, 1, 0}, +{ 7, s_6_105, -6, 1, 0}, +{ 4, s_6_106, 0, 1, 0}, +{ 5, s_6_107, 0, 1, 0}, +{ 5, s_6_108, 0, 1, 0}, +{ 5, s_6_109, 0, 1, 0}, +{ 4, s_6_110, 0, 1, 0}, +{ 4, s_6_111, 0, 1, 0}, +{ 4, s_6_112, 0, 1, 0}, +{ 4, s_6_113, 0, 1, 0}, +{ 2, s_6_114, 0, 1, 0}, +{ 2, s_6_115, 0, 1, 0}, +{ 2, s_6_116, 0, 1, 0}, +{ 3, s_6_117, 0, 1, 0}, +{ 3, s_6_118, 0, 1, 0}, +{ 3, s_6_119, 0, 1, 0} +}; + +static const symbol s_7_0[1] = { 'a' }; +static const symbol s_7_1[1] = { 'i' }; +static const symbol s_7_2[1] = { 'o' }; +static const symbol s_7_3[2] = { 'o', 's' }; +static const symbol s_7_4[1] = { 0xE1 }; +static const symbol s_7_5[1] = { 0xED }; +static const symbol s_7_6[1] = { 0xF3 }; +static const struct among a_7[7] = { +{ 1, s_7_0, 0, 1, 0}, +{ 1, s_7_1, 0, 1, 0}, +{ 1, s_7_2, 0, 1, 0}, +{ 2, s_7_3, 0, 1, 0}, +{ 1, s_7_4, 0, 1, 0}, +{ 1, s_7_5, 0, 1, 0}, +{ 1, s_7_6, 0, 1, 0} +}; + +static const symbol s_8_0[1] = { 'e' }; +static const symbol s_8_1[1] = { 0xE7 }; +static const symbol s_8_2[1] = { 0xE9 }; +static const symbol s_8_3[1] = { 0xEA }; +static const struct among a_8[4] = { +{ 1, s_8_0, 0, 1, 0}, +{ 1, s_8_1, 0, 2, 0}, +{ 1, s_8_2, 0, 1, 0}, +{ 1, s_8_3, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2 }; + +static const symbol s_0[] = { 'a', '~' }; +static const symbol s_1[] = { 'o', '~' }; +static const symbol s_2[] = { 0xE3 }; +static const symbol s_3[] = { 0xF5 }; +static const symbol s_4[] = { 'l', 'o', 'g' }; +static const symbol s_5[] = { 'u' }; +static const symbol s_6[] = { 'e', 'n', 't', 'e' }; +static const symbol s_7[] = { 'a', 't' }; +static const symbol s_8[] = { 'a', 't' }; +static const symbol s_9[] = { 'i', 'r' }; +static const symbol s_10[] = { 'c' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 227 && z->p[z->c + 0] != 245)) among_var = 3; else + among_var = find_among(z, a_0, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_v, 97, 250, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping(z, g_v, 97, 250, 0)) goto lab4; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping(z, g_v, 97, 250, 0)) goto lab2; + { + int ret = in_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping(z, g_v, 97, 250, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping(z, g_v, 97, 250, 0)) goto lab6; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping(z, g_v, 97, 250, 0)) goto lab0; + if (z->c >= z->l) goto lab0; + z->c++; + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] != 126) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((823330 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 45); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_4); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718616 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_1; goto lab0; } + among_var = find_among_b(z, a_2, 4); + if (!among_var) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_7))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + ; + } + break; + case 6: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 101 && z->p[z->c - 1] != 108)) { z->c = z->l - v_2; goto lab1; } + if (!find_among_b(z, a_3, 3)) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_4, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_8))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + case 9: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_6, 120)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_7, 7)) return 0; + z->bra = z->c; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_residual_form(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_8, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab1; + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') goto lab1; + z->c--; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + z->bra = z->c; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') return 0; + z->c--; + z->c = z->l - v_3; + } + } + lab0: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int portuguese_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = z->l - v_5; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + } + lab3: + z->c = z->l - v_4; + { + int v_6 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab5; + z->c--; + z->bra = z->c; + { + int v_7 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') goto lab5; + z->c--; + z->c = z->l - v_7; + } + { + int ret = r_RV(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_6; + } + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_residual_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_8 = z->l - z->c; + { + int ret = r_residual_form(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + z->c = z->lb; + { + int v_9 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_9; + } + return 1; +} + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.h new file mode 100644 index 000000000000..ab03ab960a2f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_portuguese.h @@ -0,0 +1,15 @@ +/* Generated from portuguese.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void); +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); + +extern int portuguese_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.c new file mode 100644 index 000000000000..8d26338de297 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.c @@ -0,0 +1,1099 @@ +/* Generated from spanish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int spanish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_y_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * spanish_ISO_8859_1_create_env(void); +extern void spanish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xE1 }; +static const symbol s_0_2[1] = { 0xE9 }; +static const symbol s_0_3[1] = { 0xED }; +static const symbol s_0_4[1] = { 0xF3 }; +static const symbol s_0_5[1] = { 0xFA }; +static const struct among a_0[6] = { +{ 0, 0, 0, 6, 0}, +{ 1, s_0_1, -1, 1, 0}, +{ 1, s_0_2, -2, 2, 0}, +{ 1, s_0_3, -3, 3, 0}, +{ 1, s_0_4, -4, 4, 0}, +{ 1, s_0_5, -5, 5, 0} +}; + +static const symbol s_1_0[2] = { 'l', 'a' }; +static const symbol s_1_1[4] = { 's', 'e', 'l', 'a' }; +static const symbol s_1_2[2] = { 'l', 'e' }; +static const symbol s_1_3[2] = { 'm', 'e' }; +static const symbol s_1_4[2] = { 's', 'e' }; +static const symbol s_1_5[2] = { 'l', 'o' }; +static const symbol s_1_6[4] = { 's', 'e', 'l', 'o' }; +static const symbol s_1_7[3] = { 'l', 'a', 's' }; +static const symbol s_1_8[5] = { 's', 'e', 'l', 'a', 's' }; +static const symbol s_1_9[3] = { 'l', 'e', 's' }; +static const symbol s_1_10[3] = { 'l', 'o', 's' }; +static const symbol s_1_11[5] = { 's', 'e', 'l', 'o', 's' }; +static const symbol s_1_12[3] = { 'n', 'o', 's' }; +static const struct among a_1[13] = { +{ 2, s_1_0, 0, -1, 0}, +{ 4, s_1_1, -1, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 2, s_1_4, 0, -1, 0}, +{ 2, s_1_5, 0, -1, 0}, +{ 4, s_1_6, -1, -1, 0}, +{ 3, s_1_7, 0, -1, 0}, +{ 5, s_1_8, -1, -1, 0}, +{ 3, s_1_9, 0, -1, 0}, +{ 3, s_1_10, 0, -1, 0}, +{ 5, s_1_11, -1, -1, 0}, +{ 3, s_1_12, 0, -1, 0} +}; + +static const symbol s_2_0[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_2_1[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_2_2[5] = { 'y', 'e', 'n', 'd', 'o' }; +static const symbol s_2_3[4] = { 0xE1, 'n', 'd', 'o' }; +static const symbol s_2_4[5] = { 'i', 0xE9, 'n', 'd', 'o' }; +static const symbol s_2_5[2] = { 'a', 'r' }; +static const symbol s_2_6[2] = { 'e', 'r' }; +static const symbol s_2_7[2] = { 'i', 'r' }; +static const symbol s_2_8[2] = { 0xE1, 'r' }; +static const symbol s_2_9[2] = { 0xE9, 'r' }; +static const symbol s_2_10[2] = { 0xED, 'r' }; +static const struct among a_2[11] = { +{ 4, s_2_0, 0, 6, 0}, +{ 5, s_2_1, 0, 6, 0}, +{ 5, s_2_2, 0, 7, 0}, +{ 4, s_2_3, 0, 2, 0}, +{ 5, s_2_4, 0, 1, 0}, +{ 2, s_2_5, 0, 6, 0}, +{ 2, s_2_6, 0, 6, 0}, +{ 2, s_2_7, 0, 6, 0}, +{ 2, s_2_8, 0, 3, 0}, +{ 2, s_2_9, 0, 4, 0}, +{ 2, s_2_10, 0, 5, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'c' }; +static const symbol s_3_1[2] = { 'a', 'd' }; +static const symbol s_3_2[2] = { 'o', 's' }; +static const symbol s_3_3[2] = { 'i', 'v' }; +static const struct among a_3[4] = { +{ 2, s_3_0, 0, -1, 0}, +{ 2, s_3_1, 0, -1, 0}, +{ 2, s_3_2, 0, -1, 0}, +{ 2, s_3_3, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_4_1[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_4_2[4] = { 'a', 'n', 't', 'e' }; +static const struct among a_4[3] = { +{ 4, s_4_0, 0, 1, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 4, s_4_2, 0, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_5_2[2] = { 'i', 'v' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 2, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'i', 'c', 'a' }; +static const symbol s_6_1[5] = { 'a', 'n', 'c', 'i', 'a' }; +static const symbol s_6_2[5] = { 'e', 'n', 'c', 'i', 'a' }; +static const symbol s_6_3[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_6_4[3] = { 'o', 's', 'a' }; +static const symbol s_6_5[4] = { 'i', 's', 't', 'a' }; +static const symbol s_6_6[3] = { 'i', 'v', 'a' }; +static const symbol s_6_7[4] = { 'a', 'n', 'z', 'a' }; +static const symbol s_6_8[5] = { 'l', 'o', 'g', 0xED, 'a' }; +static const symbol s_6_9[4] = { 'i', 'd', 'a', 'd' }; +static const symbol s_6_10[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_6_11[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_6_12[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_13[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_14[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_15[5] = { 'a', 'c', 'i', 'o', 'n' }; +static const symbol s_6_16[5] = { 'u', 'c', 'i', 'o', 'n' }; +static const symbol s_6_17[5] = { 'a', 'c', 'i', 0xF3, 'n' }; +static const symbol s_6_18[5] = { 'u', 'c', 'i', 0xF3, 'n' }; +static const symbol s_6_19[3] = { 'i', 'c', 'o' }; +static const symbol s_6_20[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_6_21[3] = { 'o', 's', 'o' }; +static const symbol s_6_22[7] = { 'a', 'm', 'i', 'e', 'n', 't', 'o' }; +static const symbol s_6_23[7] = { 'i', 'm', 'i', 'e', 'n', 't', 'o' }; +static const symbol s_6_24[3] = { 'i', 'v', 'o' }; +static const symbol s_6_25[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_6_26[4] = { 'i', 'c', 'a', 's' }; +static const symbol s_6_27[6] = { 'a', 'n', 'c', 'i', 'a', 's' }; +static const symbol s_6_28[6] = { 'e', 'n', 'c', 'i', 'a', 's' }; +static const symbol s_6_29[6] = { 'a', 'd', 'o', 'r', 'a', 's' }; +static const symbol s_6_30[4] = { 'o', 's', 'a', 's' }; +static const symbol s_6_31[5] = { 'i', 's', 't', 'a', 's' }; +static const symbol s_6_32[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_6_33[5] = { 'a', 'n', 'z', 'a', 's' }; +static const symbol s_6_34[6] = { 'l', 'o', 'g', 0xED, 'a', 's' }; +static const symbol s_6_35[6] = { 'i', 'd', 'a', 'd', 'e', 's' }; +static const symbol s_6_36[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_6_37[5] = { 'i', 'b', 'l', 'e', 's' }; +static const symbol s_6_38[7] = { 'a', 'c', 'i', 'o', 'n', 'e', 's' }; +static const symbol s_6_39[7] = { 'u', 'c', 'i', 'o', 'n', 'e', 's' }; +static const symbol s_6_40[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_6_41[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_6_42[4] = { 'i', 'c', 'o', 's' }; +static const symbol s_6_43[5] = { 'i', 's', 'm', 'o', 's' }; +static const symbol s_6_44[4] = { 'o', 's', 'o', 's' }; +static const symbol s_6_45[8] = { 'a', 'm', 'i', 'e', 'n', 't', 'o', 's' }; +static const symbol s_6_46[8] = { 'i', 'm', 'i', 'e', 'n', 't', 'o', 's' }; +static const symbol s_6_47[4] = { 'i', 'v', 'o', 's' }; +static const struct among a_6[48] = { +{ 3, s_6_0, 0, 1, 0}, +{ 5, s_6_1, 0, 2, 0}, +{ 5, s_6_2, 0, 5, 0}, +{ 5, s_6_3, 0, 2, 0}, +{ 3, s_6_4, 0, 1, 0}, +{ 4, s_6_5, 0, 1, 0}, +{ 3, s_6_6, 0, 9, 0}, +{ 4, s_6_7, 0, 1, 0}, +{ 5, s_6_8, 0, 3, 0}, +{ 4, s_6_9, 0, 8, 0}, +{ 4, s_6_10, 0, 1, 0}, +{ 4, s_6_11, 0, 1, 0}, +{ 4, s_6_12, 0, 2, 0}, +{ 5, s_6_13, 0, 7, 0}, +{ 6, s_6_14, -1, 6, 0}, +{ 5, s_6_15, 0, 2, 0}, +{ 5, s_6_16, 0, 4, 0}, +{ 5, s_6_17, 0, 2, 0}, +{ 5, s_6_18, 0, 4, 0}, +{ 3, s_6_19, 0, 1, 0}, +{ 4, s_6_20, 0, 1, 0}, +{ 3, s_6_21, 0, 1, 0}, +{ 7, s_6_22, 0, 1, 0}, +{ 7, s_6_23, 0, 1, 0}, +{ 3, s_6_24, 0, 9, 0}, +{ 4, s_6_25, 0, 2, 0}, +{ 4, s_6_26, 0, 1, 0}, +{ 6, s_6_27, 0, 2, 0}, +{ 6, s_6_28, 0, 5, 0}, +{ 6, s_6_29, 0, 2, 0}, +{ 4, s_6_30, 0, 1, 0}, +{ 5, s_6_31, 0, 1, 0}, +{ 4, s_6_32, 0, 9, 0}, +{ 5, s_6_33, 0, 1, 0}, +{ 6, s_6_34, 0, 3, 0}, +{ 6, s_6_35, 0, 8, 0}, +{ 5, s_6_36, 0, 1, 0}, +{ 5, s_6_37, 0, 1, 0}, +{ 7, s_6_38, 0, 2, 0}, +{ 7, s_6_39, 0, 4, 0}, +{ 6, s_6_40, 0, 2, 0}, +{ 5, s_6_41, 0, 2, 0}, +{ 4, s_6_42, 0, 1, 0}, +{ 5, s_6_43, 0, 1, 0}, +{ 4, s_6_44, 0, 1, 0}, +{ 8, s_6_45, 0, 1, 0}, +{ 8, s_6_46, 0, 1, 0}, +{ 4, s_6_47, 0, 9, 0} +}; + +static const symbol s_7_0[2] = { 'y', 'a' }; +static const symbol s_7_1[2] = { 'y', 'e' }; +static const symbol s_7_2[3] = { 'y', 'a', 'n' }; +static const symbol s_7_3[3] = { 'y', 'e', 'n' }; +static const symbol s_7_4[5] = { 'y', 'e', 'r', 'o', 'n' }; +static const symbol s_7_5[5] = { 'y', 'e', 'n', 'd', 'o' }; +static const symbol s_7_6[2] = { 'y', 'o' }; +static const symbol s_7_7[3] = { 'y', 'a', 's' }; +static const symbol s_7_8[3] = { 'y', 'e', 's' }; +static const symbol s_7_9[4] = { 'y', 'a', 'i', 's' }; +static const symbol s_7_10[5] = { 'y', 'a', 'm', 'o', 's' }; +static const symbol s_7_11[2] = { 'y', 0xF3 }; +static const struct among a_7[12] = { +{ 2, s_7_0, 0, 1, 0}, +{ 2, s_7_1, 0, 1, 0}, +{ 3, s_7_2, 0, 1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 5, s_7_4, 0, 1, 0}, +{ 5, s_7_5, 0, 1, 0}, +{ 2, s_7_6, 0, 1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 3, s_7_8, 0, 1, 0}, +{ 4, s_7_9, 0, 1, 0}, +{ 5, s_7_10, 0, 1, 0}, +{ 2, s_7_11, 0, 1, 0} +}; + +static const symbol s_8_0[3] = { 'a', 'b', 'a' }; +static const symbol s_8_1[3] = { 'a', 'd', 'a' }; +static const symbol s_8_2[3] = { 'i', 'd', 'a' }; +static const symbol s_8_3[3] = { 'a', 'r', 'a' }; +static const symbol s_8_4[4] = { 'i', 'e', 'r', 'a' }; +static const symbol s_8_5[2] = { 0xED, 'a' }; +static const symbol s_8_6[4] = { 'a', 'r', 0xED, 'a' }; +static const symbol s_8_7[4] = { 'e', 'r', 0xED, 'a' }; +static const symbol s_8_8[4] = { 'i', 'r', 0xED, 'a' }; +static const symbol s_8_9[2] = { 'a', 'd' }; +static const symbol s_8_10[2] = { 'e', 'd' }; +static const symbol s_8_11[2] = { 'i', 'd' }; +static const symbol s_8_12[3] = { 'a', 's', 'e' }; +static const symbol s_8_13[4] = { 'i', 'e', 's', 'e' }; +static const symbol s_8_14[4] = { 'a', 's', 't', 'e' }; +static const symbol s_8_15[4] = { 'i', 's', 't', 'e' }; +static const symbol s_8_16[2] = { 'a', 'n' }; +static const symbol s_8_17[4] = { 'a', 'b', 'a', 'n' }; +static const symbol s_8_18[4] = { 'a', 'r', 'a', 'n' }; +static const symbol s_8_19[5] = { 'i', 'e', 'r', 'a', 'n' }; +static const symbol s_8_20[3] = { 0xED, 'a', 'n' }; +static const symbol s_8_21[5] = { 'a', 'r', 0xED, 'a', 'n' }; +static const symbol s_8_22[5] = { 'e', 'r', 0xED, 'a', 'n' }; +static const symbol s_8_23[5] = { 'i', 'r', 0xED, 'a', 'n' }; +static const symbol s_8_24[2] = { 'e', 'n' }; +static const symbol s_8_25[4] = { 'a', 's', 'e', 'n' }; +static const symbol s_8_26[5] = { 'i', 'e', 's', 'e', 'n' }; +static const symbol s_8_27[4] = { 'a', 'r', 'o', 'n' }; +static const symbol s_8_28[5] = { 'i', 'e', 'r', 'o', 'n' }; +static const symbol s_8_29[4] = { 'a', 'r', 0xE1, 'n' }; +static const symbol s_8_30[4] = { 'e', 'r', 0xE1, 'n' }; +static const symbol s_8_31[4] = { 'i', 'r', 0xE1, 'n' }; +static const symbol s_8_32[3] = { 'a', 'd', 'o' }; +static const symbol s_8_33[3] = { 'i', 'd', 'o' }; +static const symbol s_8_34[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_8_35[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_8_36[2] = { 'a', 'r' }; +static const symbol s_8_37[2] = { 'e', 'r' }; +static const symbol s_8_38[2] = { 'i', 'r' }; +static const symbol s_8_39[2] = { 'a', 's' }; +static const symbol s_8_40[4] = { 'a', 'b', 'a', 's' }; +static const symbol s_8_41[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_8_42[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_8_43[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_8_44[5] = { 'i', 'e', 'r', 'a', 's' }; +static const symbol s_8_45[3] = { 0xED, 'a', 's' }; +static const symbol s_8_46[5] = { 'a', 'r', 0xED, 'a', 's' }; +static const symbol s_8_47[5] = { 'e', 'r', 0xED, 'a', 's' }; +static const symbol s_8_48[5] = { 'i', 'r', 0xED, 'a', 's' }; +static const symbol s_8_49[2] = { 'e', 's' }; +static const symbol s_8_50[4] = { 'a', 's', 'e', 's' }; +static const symbol s_8_51[5] = { 'i', 'e', 's', 'e', 's' }; +static const symbol s_8_52[5] = { 'a', 'b', 'a', 'i', 's' }; +static const symbol s_8_53[5] = { 'a', 'r', 'a', 'i', 's' }; +static const symbol s_8_54[6] = { 'i', 'e', 'r', 'a', 'i', 's' }; +static const symbol s_8_55[4] = { 0xED, 'a', 'i', 's' }; +static const symbol s_8_56[6] = { 'a', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_8_57[6] = { 'e', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_8_58[6] = { 'i', 'r', 0xED, 'a', 'i', 's' }; +static const symbol s_8_59[5] = { 'a', 's', 'e', 'i', 's' }; +static const symbol s_8_60[6] = { 'i', 'e', 's', 'e', 'i', 's' }; +static const symbol s_8_61[6] = { 'a', 's', 't', 'e', 'i', 's' }; +static const symbol s_8_62[6] = { 'i', 's', 't', 'e', 'i', 's' }; +static const symbol s_8_63[3] = { 0xE1, 'i', 's' }; +static const symbol s_8_64[3] = { 0xE9, 'i', 's' }; +static const symbol s_8_65[5] = { 'a', 'r', 0xE9, 'i', 's' }; +static const symbol s_8_66[5] = { 'e', 'r', 0xE9, 'i', 's' }; +static const symbol s_8_67[5] = { 'i', 'r', 0xE9, 'i', 's' }; +static const symbol s_8_68[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_8_69[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_8_70[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_8_71[6] = { 0xE1, 'b', 'a', 'm', 'o', 's' }; +static const symbol s_8_72[6] = { 0xE1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_8_73[7] = { 'i', 0xE9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_8_74[5] = { 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_8_75[7] = { 'a', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_8_76[7] = { 'e', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_8_77[7] = { 'i', 'r', 0xED, 'a', 'm', 'o', 's' }; +static const symbol s_8_78[4] = { 'e', 'm', 'o', 's' }; +static const symbol s_8_79[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_80[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_81[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_82[6] = { 0xE1, 's', 'e', 'm', 'o', 's' }; +static const symbol s_8_83[7] = { 'i', 0xE9, 's', 'e', 'm', 'o', 's' }; +static const symbol s_8_84[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_8_85[4] = { 'a', 'r', 0xE1, 's' }; +static const symbol s_8_86[4] = { 'e', 'r', 0xE1, 's' }; +static const symbol s_8_87[4] = { 'i', 'r', 0xE1, 's' }; +static const symbol s_8_88[2] = { 0xED, 's' }; +static const symbol s_8_89[3] = { 'a', 'r', 0xE1 }; +static const symbol s_8_90[3] = { 'e', 'r', 0xE1 }; +static const symbol s_8_91[3] = { 'i', 'r', 0xE1 }; +static const symbol s_8_92[3] = { 'a', 'r', 0xE9 }; +static const symbol s_8_93[3] = { 'e', 'r', 0xE9 }; +static const symbol s_8_94[3] = { 'i', 'r', 0xE9 }; +static const symbol s_8_95[2] = { 'i', 0xF3 }; +static const struct among a_8[96] = { +{ 3, s_8_0, 0, 2, 0}, +{ 3, s_8_1, 0, 2, 0}, +{ 3, s_8_2, 0, 2, 0}, +{ 3, s_8_3, 0, 2, 0}, +{ 4, s_8_4, 0, 2, 0}, +{ 2, s_8_5, 0, 2, 0}, +{ 4, s_8_6, -1, 2, 0}, +{ 4, s_8_7, -2, 2, 0}, +{ 4, s_8_8, -3, 2, 0}, +{ 2, s_8_9, 0, 2, 0}, +{ 2, s_8_10, 0, 2, 0}, +{ 2, s_8_11, 0, 2, 0}, +{ 3, s_8_12, 0, 2, 0}, +{ 4, s_8_13, 0, 2, 0}, +{ 4, s_8_14, 0, 2, 0}, +{ 4, s_8_15, 0, 2, 0}, +{ 2, s_8_16, 0, 2, 0}, +{ 4, s_8_17, -1, 2, 0}, +{ 4, s_8_18, -2, 2, 0}, +{ 5, s_8_19, -3, 2, 0}, +{ 3, s_8_20, -4, 2, 0}, +{ 5, s_8_21, -1, 2, 0}, +{ 5, s_8_22, -2, 2, 0}, +{ 5, s_8_23, -3, 2, 0}, +{ 2, s_8_24, 0, 1, 0}, +{ 4, s_8_25, -1, 2, 0}, +{ 5, s_8_26, -2, 2, 0}, +{ 4, s_8_27, 0, 2, 0}, +{ 5, s_8_28, 0, 2, 0}, +{ 4, s_8_29, 0, 2, 0}, +{ 4, s_8_30, 0, 2, 0}, +{ 4, s_8_31, 0, 2, 0}, +{ 3, s_8_32, 0, 2, 0}, +{ 3, s_8_33, 0, 2, 0}, +{ 4, s_8_34, 0, 2, 0}, +{ 5, s_8_35, 0, 2, 0}, +{ 2, s_8_36, 0, 2, 0}, +{ 2, s_8_37, 0, 2, 0}, +{ 2, s_8_38, 0, 2, 0}, +{ 2, s_8_39, 0, 2, 0}, +{ 4, s_8_40, -1, 2, 0}, +{ 4, s_8_41, -2, 2, 0}, +{ 4, s_8_42, -3, 2, 0}, +{ 4, s_8_43, -4, 2, 0}, +{ 5, s_8_44, -5, 2, 0}, +{ 3, s_8_45, -6, 2, 0}, +{ 5, s_8_46, -1, 2, 0}, +{ 5, s_8_47, -2, 2, 0}, +{ 5, s_8_48, -3, 2, 0}, +{ 2, s_8_49, 0, 1, 0}, +{ 4, s_8_50, -1, 2, 0}, +{ 5, s_8_51, -2, 2, 0}, +{ 5, s_8_52, 0, 2, 0}, +{ 5, s_8_53, 0, 2, 0}, +{ 6, s_8_54, 0, 2, 0}, +{ 4, s_8_55, 0, 2, 0}, +{ 6, s_8_56, -1, 2, 0}, +{ 6, s_8_57, -2, 2, 0}, +{ 6, s_8_58, -3, 2, 0}, +{ 5, s_8_59, 0, 2, 0}, +{ 6, s_8_60, 0, 2, 0}, +{ 6, s_8_61, 0, 2, 0}, +{ 6, s_8_62, 0, 2, 0}, +{ 3, s_8_63, 0, 2, 0}, +{ 3, s_8_64, 0, 1, 0}, +{ 5, s_8_65, -1, 2, 0}, +{ 5, s_8_66, -2, 2, 0}, +{ 5, s_8_67, -3, 2, 0}, +{ 4, s_8_68, 0, 2, 0}, +{ 4, s_8_69, 0, 2, 0}, +{ 4, s_8_70, 0, 2, 0}, +{ 6, s_8_71, -1, 2, 0}, +{ 6, s_8_72, -2, 2, 0}, +{ 7, s_8_73, -3, 2, 0}, +{ 5, s_8_74, -4, 2, 0}, +{ 7, s_8_75, -1, 2, 0}, +{ 7, s_8_76, -2, 2, 0}, +{ 7, s_8_77, -3, 2, 0}, +{ 4, s_8_78, 0, 1, 0}, +{ 6, s_8_79, -1, 2, 0}, +{ 6, s_8_80, -2, 2, 0}, +{ 6, s_8_81, -3, 2, 0}, +{ 6, s_8_82, -4, 2, 0}, +{ 7, s_8_83, -5, 2, 0}, +{ 4, s_8_84, 0, 2, 0}, +{ 4, s_8_85, 0, 2, 0}, +{ 4, s_8_86, 0, 2, 0}, +{ 4, s_8_87, 0, 2, 0}, +{ 2, s_8_88, 0, 2, 0}, +{ 3, s_8_89, 0, 2, 0}, +{ 3, s_8_90, 0, 2, 0}, +{ 3, s_8_91, 0, 2, 0}, +{ 3, s_8_92, 0, 2, 0}, +{ 3, s_8_93, 0, 2, 0}, +{ 3, s_8_94, 0, 2, 0}, +{ 2, s_8_95, 0, 2, 0} +}; + +static const symbol s_9_0[1] = { 'a' }; +static const symbol s_9_1[1] = { 'e' }; +static const symbol s_9_2[1] = { 'o' }; +static const symbol s_9_3[2] = { 'o', 's' }; +static const symbol s_9_4[1] = { 0xE1 }; +static const symbol s_9_5[1] = { 0xE9 }; +static const symbol s_9_6[1] = { 0xED }; +static const symbol s_9_7[1] = { 0xF3 }; +static const struct among a_9[8] = { +{ 1, s_9_0, 0, 1, 0}, +{ 1, s_9_1, 0, 2, 0}, +{ 1, s_9_2, 0, 1, 0}, +{ 2, s_9_3, 0, 1, 0}, +{ 1, s_9_4, 0, 1, 0}, +{ 1, s_9_5, 0, 2, 0}, +{ 1, s_9_6, 0, 1, 0}, +{ 1, s_9_7, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 10 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_6[] = { 'a', 'n', 'd', 'o' }; +static const symbol s_7[] = { 'a', 'r' }; +static const symbol s_8[] = { 'e', 'r' }; +static const symbol s_9[] = { 'i', 'r' }; +static const symbol s_10[] = { 'i', 'c' }; +static const symbol s_11[] = { 'l', 'o', 'g' }; +static const symbol s_12[] = { 'u' }; +static const symbol s_13[] = { 'e', 'n', 't', 'e' }; +static const symbol s_14[] = { 'a', 't' }; +static const symbol s_15[] = { 'a', 't' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping(z, g_v, 97, 252, 0)) goto lab4; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab2; + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping(z, g_v, 97, 252, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping(z, g_v, 97, 252, 0)) goto lab6; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab0; + if (z->c >= z->l) goto lab0; + z->c++; + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 7 || !((67641858 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 6; else + among_var = find_among(z, a_0, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + if (z->c >= z->l) goto lab0; + z->c++; + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((557090 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 13)) return 0; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 111 && z->p[z->c - 1] != 114)) return 0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + z->bra = z->c; + { + int ret = slice_from_s(z, 5, s_5); + if (ret < 0) return ret; + } + break; + case 2: + z->bra = z->c; + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 3: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 4: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_8); + if (ret < 0) return ret; + } + break; + case 5: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + if (z->c <= z->lb || z->p[z->c - 1] != 'u') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((835634 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_6, 48); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_10))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_11); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718616 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_2; goto lab1; } + among_var = find_among_b(z, a_3, 4); + if (!among_var) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_14))) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab1: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 101) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_4, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_4; goto lab3; } + if (!find_among_b(z, a_5, 3)) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + case 9: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - v_5; goto lab4; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_5; goto lab4; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab4: + ; + } + break; + } + return 1; +} + +static int r_y_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_7, 12)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'u') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + among_var = find_among_b(z, a_8, 96); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') { z->c = z->l - v_2; goto lab0; } + z->c--; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') { z->c = z->l - v_2; goto lab0; } + z->c--; + z->c = z->l - v_3; + } + lab0: + ; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_9, 8); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->c = z->l - v_2; + } + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + } + return 1; +} + +extern int spanish_ISO_8859_1_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_y_verb_suffix(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + goto lab1; + lab3: + z->c = z->l - v_3; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + { + int ret = r_residual_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + { + int v_5 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_5; + } + return 1; +} + +extern struct SN_env * spanish_ISO_8859_1_create_env(void) { return SN_create_env(0, 3); } + +extern void spanish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.h new file mode 100644 index 000000000000..72f71287e78a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_spanish.h @@ -0,0 +1,15 @@ +/* Generated from spanish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_ISO_8859_1_create_env(void); +extern void spanish_ISO_8859_1_close_env(struct SN_env * z); + +extern int spanish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.c b/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.c new file mode 100644 index 000000000000..e756ba1fa9d4 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.c @@ -0,0 +1,400 @@ +/* Generated from swedish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int swedish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_et_condition(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * swedish_ISO_8859_1_create_env(void); +extern void swedish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'f', 'a', 'b' }; +static const symbol s_0_1[1] = { 'h' }; +static const symbol s_0_2[3] = { 'p', 'a', 'k' }; +static const symbol s_0_3[3] = { 'r', 'a', 'k' }; +static const symbol s_0_4[4] = { 's', 't', 'a', 'k' }; +static const symbol s_0_5[3] = { 'k', 'o', 'm' }; +static const symbol s_0_6[3] = { 'i', 'e', 't' }; +static const symbol s_0_7[3] = { 'c', 'i', 't' }; +static const symbol s_0_8[3] = { 'd', 'i', 't' }; +static const symbol s_0_9[4] = { 'a', 'l', 'i', 't' }; +static const symbol s_0_10[4] = { 'i', 'l', 'i', 't' }; +static const symbol s_0_11[3] = { 'm', 'i', 't' }; +static const symbol s_0_12[3] = { 'n', 'i', 't' }; +static const symbol s_0_13[3] = { 'p', 'i', 't' }; +static const symbol s_0_14[3] = { 'r', 'i', 't' }; +static const symbol s_0_15[3] = { 's', 'i', 't' }; +static const symbol s_0_16[3] = { 't', 'i', 't' }; +static const symbol s_0_17[3] = { 'u', 'i', 't' }; +static const symbol s_0_18[4] = { 'i', 'v', 'i', 't' }; +static const symbol s_0_19[4] = { 'k', 'v', 'i', 't' }; +static const symbol s_0_20[3] = { 'x', 'i', 't' }; +static const struct among a_0[21] = { +{ 3, s_0_0, 0, -1, 0}, +{ 1, s_0_1, 0, -1, 0}, +{ 3, s_0_2, 0, -1, 0}, +{ 3, s_0_3, 0, -1, 0}, +{ 4, s_0_4, 0, -1, 0}, +{ 3, s_0_5, 0, -1, 0}, +{ 3, s_0_6, 0, -1, 0}, +{ 3, s_0_7, 0, -1, 0}, +{ 3, s_0_8, 0, -1, 0}, +{ 4, s_0_9, 0, -1, 0}, +{ 4, s_0_10, 0, -1, 0}, +{ 3, s_0_11, 0, -1, 0}, +{ 3, s_0_12, 0, -1, 0}, +{ 3, s_0_13, 0, -1, 0}, +{ 3, s_0_14, 0, -1, 0}, +{ 3, s_0_15, 0, -1, 0}, +{ 3, s_0_16, 0, -1, 0}, +{ 3, s_0_17, 0, -1, 0}, +{ 4, s_0_18, 0, -1, 0}, +{ 4, s_0_19, 0, -1, 0}, +{ 3, s_0_20, 0, -1, 0} +}; + +static const symbol s_1_0[1] = { 'a' }; +static const symbol s_1_1[4] = { 'a', 'r', 'n', 'a' }; +static const symbol s_1_2[4] = { 'e', 'r', 'n', 'a' }; +static const symbol s_1_3[7] = { 'h', 'e', 't', 'e', 'r', 'n', 'a' }; +static const symbol s_1_4[4] = { 'o', 'r', 'n', 'a' }; +static const symbol s_1_5[2] = { 'a', 'd' }; +static const symbol s_1_6[1] = { 'e' }; +static const symbol s_1_7[3] = { 'a', 'd', 'e' }; +static const symbol s_1_8[4] = { 'a', 'n', 'd', 'e' }; +static const symbol s_1_9[4] = { 'a', 'r', 'n', 'e' }; +static const symbol s_1_10[3] = { 'a', 'r', 'e' }; +static const symbol s_1_11[4] = { 'a', 's', 't', 'e' }; +static const symbol s_1_12[2] = { 'e', 'n' }; +static const symbol s_1_13[5] = { 'a', 'n', 'd', 'e', 'n' }; +static const symbol s_1_14[4] = { 'a', 'r', 'e', 'n' }; +static const symbol s_1_15[5] = { 'h', 'e', 't', 'e', 'n' }; +static const symbol s_1_16[3] = { 'e', 'r', 'n' }; +static const symbol s_1_17[2] = { 'a', 'r' }; +static const symbol s_1_18[2] = { 'e', 'r' }; +static const symbol s_1_19[5] = { 'h', 'e', 't', 'e', 'r' }; +static const symbol s_1_20[2] = { 'o', 'r' }; +static const symbol s_1_21[1] = { 's' }; +static const symbol s_1_22[2] = { 'a', 's' }; +static const symbol s_1_23[5] = { 'a', 'r', 'n', 'a', 's' }; +static const symbol s_1_24[5] = { 'e', 'r', 'n', 'a', 's' }; +static const symbol s_1_25[5] = { 'o', 'r', 'n', 'a', 's' }; +static const symbol s_1_26[2] = { 'e', 's' }; +static const symbol s_1_27[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_1_28[5] = { 'a', 'n', 'd', 'e', 's' }; +static const symbol s_1_29[3] = { 'e', 'n', 's' }; +static const symbol s_1_30[5] = { 'a', 'r', 'e', 'n', 's' }; +static const symbol s_1_31[6] = { 'h', 'e', 't', 'e', 'n', 's' }; +static const symbol s_1_32[4] = { 'e', 'r', 'n', 's' }; +static const symbol s_1_33[2] = { 'a', 't' }; +static const symbol s_1_34[2] = { 'e', 't' }; +static const symbol s_1_35[5] = { 'a', 'n', 'd', 'e', 't' }; +static const symbol s_1_36[3] = { 'h', 'e', 't' }; +static const symbol s_1_37[3] = { 'a', 's', 't' }; +static const struct among a_1[38] = { +{ 1, s_1_0, 0, 1, 0}, +{ 4, s_1_1, -1, 1, 0}, +{ 4, s_1_2, -2, 1, 0}, +{ 7, s_1_3, -1, 1, 0}, +{ 4, s_1_4, -4, 1, 0}, +{ 2, s_1_5, 0, 1, 0}, +{ 1, s_1_6, 0, 1, 0}, +{ 3, s_1_7, -1, 1, 0}, +{ 4, s_1_8, -2, 1, 0}, +{ 4, s_1_9, -3, 1, 0}, +{ 3, s_1_10, -4, 1, 0}, +{ 4, s_1_11, -5, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 5, s_1_13, -1, 1, 0}, +{ 4, s_1_14, -2, 1, 0}, +{ 5, s_1_15, -3, 1, 0}, +{ 3, s_1_16, 0, 1, 0}, +{ 2, s_1_17, 0, 1, 0}, +{ 2, s_1_18, 0, 1, 0}, +{ 5, s_1_19, -1, 1, 0}, +{ 2, s_1_20, 0, 1, 0}, +{ 1, s_1_21, 0, 2, 0}, +{ 2, s_1_22, -1, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 5, s_1_24, -2, 1, 0}, +{ 5, s_1_25, -3, 1, 0}, +{ 2, s_1_26, -5, 1, 0}, +{ 4, s_1_27, -1, 1, 0}, +{ 5, s_1_28, -2, 1, 0}, +{ 3, s_1_29, -8, 1, 0}, +{ 5, s_1_30, -1, 1, 0}, +{ 6, s_1_31, -2, 1, 0}, +{ 4, s_1_32, -11, 1, 0}, +{ 2, s_1_33, 0, 1, 0}, +{ 2, s_1_34, 0, 3, 0}, +{ 5, s_1_35, -1, 1, 0}, +{ 3, s_1_36, -2, 1, 0}, +{ 3, s_1_37, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'd' }; +static const symbol s_2_1[2] = { 'g', 'd' }; +static const symbol s_2_2[2] = { 'n', 'n' }; +static const symbol s_2_3[2] = { 'd', 't' }; +static const symbol s_2_4[2] = { 'g', 't' }; +static const symbol s_2_5[2] = { 'k', 't' }; +static const symbol s_2_6[2] = { 't', 't' }; +static const struct among a_2[7] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, -1, 0}, +{ 2, s_2_4, 0, -1, 0}, +{ 2, s_2_5, 0, -1, 0}, +{ 2, s_2_6, 0, -1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'g' }; +static const symbol s_3_1[3] = { 'l', 'i', 'g' }; +static const symbol s_3_2[3] = { 'e', 'l', 's' }; +static const symbol s_3_3[5] = { 'f', 'u', 'l', 'l', 't' }; +static const symbol s_3_4[3] = { 0xF6, 's', 't' }; +static const struct among a_3[5] = { +{ 2, s_3_0, 0, 1, 0}, +{ 3, s_3_1, -1, 1, 0}, +{ 3, s_3_2, 0, 1, 0}, +{ 5, s_3_3, 0, 3, 0}, +{ 3, s_3_4, 0, 2, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 }; + +static const unsigned char g_s_ending[] = { 119, 127, 149 }; + +static const unsigned char g_ost_ending[] = { 173, 58 }; + +static const symbol s_0[] = { 'e', 't' }; +static const symbol s_1[] = { 0xF6, 's' }; +static const symbol s_2[] = { 'f', 'u', 'l', 'l' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; +z->c = z->c + 3; + if (z->c > z->l) return 0; + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping(z, g_v, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_et_condition(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (out_grouping_b(z, g_v, 97, 246, 0)) return 0; + if (in_grouping_b(z, g_v, 97, 246, 0)) return 0; + if (z->c > z->lb) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1059076 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + if (!find_among_b(z, a_0, 21)) goto lab1; + return 0; + lab1: + z->c = z->l - v_2; + } + } + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851442 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_1, 38); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_0))) goto lab1; + { + int ret = r_et_condition(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->bra = z->c; + goto lab0; + lab1: + z->c = z->l - v_2; + if (in_grouping_b(z, g_s_ending, 98, 121, 0)) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_et_condition(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + { + int v_2 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1064976 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_2, 7)) { z->lb = v_1; return 0; } + z->c = z->l - v_2; + z->ket = z->c; + if (z->c <= z->lb) { z->lb = v_1; return 0; } + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + z->lb = v_1; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_3, 5); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_ost_ending, 105, 118, 0)) return 0; + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int swedish_ISO_8859_1_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * swedish_ISO_8859_1_create_env(void) { return SN_create_env(0, 2); } + +extern void swedish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.h b/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.h new file mode 100644 index 000000000000..23508a3051ef --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_1_swedish.h @@ -0,0 +1,15 @@ +/* Generated from swedish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_ISO_8859_1_create_env(void); +extern void swedish_ISO_8859_1_close_env(struct SN_env * z); + +extern int swedish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.c b/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.c new file mode 100644 index 000000000000..e2e5d7d903a4 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.c @@ -0,0 +1,875 @@ +/* Generated from hungarian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int hungarian_ISO_8859_2_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_double(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_factive(struct SN_env * z); +static int r_instrum(struct SN_env * z); +static int r_plur_owner(struct SN_env * z); +static int r_sing_owner(struct SN_env * z); +static int r_owned(struct SN_env * z); +static int r_plural(struct SN_env * z); +static int r_case_other(struct SN_env * z); +static int r_case_special(struct SN_env * z); +static int r_case(struct SN_env * z); +static int r_v_ending(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * hungarian_ISO_8859_2_create_env(void); +extern void hungarian_ISO_8859_2_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 0xE1 }; +static const symbol s_0_1[1] = { 0xE9 }; +static const struct among a_0[2] = { +{ 1, s_0_0, 0, 1, 0}, +{ 1, s_0_1, 0, 2, 0} +}; + +static const symbol s_1_0[2] = { 'b', 'b' }; +static const symbol s_1_1[2] = { 'c', 'c' }; +static const symbol s_1_2[2] = { 'd', 'd' }; +static const symbol s_1_3[2] = { 'f', 'f' }; +static const symbol s_1_4[2] = { 'g', 'g' }; +static const symbol s_1_5[2] = { 'j', 'j' }; +static const symbol s_1_6[2] = { 'k', 'k' }; +static const symbol s_1_7[2] = { 'l', 'l' }; +static const symbol s_1_8[2] = { 'm', 'm' }; +static const symbol s_1_9[2] = { 'n', 'n' }; +static const symbol s_1_10[2] = { 'p', 'p' }; +static const symbol s_1_11[2] = { 'r', 'r' }; +static const symbol s_1_12[3] = { 'c', 'c', 's' }; +static const symbol s_1_13[2] = { 's', 's' }; +static const symbol s_1_14[3] = { 'z', 'z', 's' }; +static const symbol s_1_15[2] = { 't', 't' }; +static const symbol s_1_16[2] = { 'v', 'v' }; +static const symbol s_1_17[3] = { 'g', 'g', 'y' }; +static const symbol s_1_18[3] = { 'l', 'l', 'y' }; +static const symbol s_1_19[3] = { 'n', 'n', 'y' }; +static const symbol s_1_20[3] = { 't', 't', 'y' }; +static const symbol s_1_21[3] = { 's', 's', 'z' }; +static const symbol s_1_22[2] = { 'z', 'z' }; +static const struct among a_1[23] = { +{ 2, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 2, s_1_4, 0, -1, 0}, +{ 2, s_1_5, 0, -1, 0}, +{ 2, s_1_6, 0, -1, 0}, +{ 2, s_1_7, 0, -1, 0}, +{ 2, s_1_8, 0, -1, 0}, +{ 2, s_1_9, 0, -1, 0}, +{ 2, s_1_10, 0, -1, 0}, +{ 2, s_1_11, 0, -1, 0}, +{ 3, s_1_12, 0, -1, 0}, +{ 2, s_1_13, 0, -1, 0}, +{ 3, s_1_14, 0, -1, 0}, +{ 2, s_1_15, 0, -1, 0}, +{ 2, s_1_16, 0, -1, 0}, +{ 3, s_1_17, 0, -1, 0}, +{ 3, s_1_18, 0, -1, 0}, +{ 3, s_1_19, 0, -1, 0}, +{ 3, s_1_20, 0, -1, 0}, +{ 3, s_1_21, 0, -1, 0}, +{ 2, s_1_22, 0, -1, 0} +}; + +static const symbol s_2_0[2] = { 'a', 'l' }; +static const symbol s_2_1[2] = { 'e', 'l' }; +static const struct among a_2[2] = { +{ 2, s_2_0, 0, 1, 0}, +{ 2, s_2_1, 0, 1, 0} +}; + +static const symbol s_3_0[2] = { 'b', 'a' }; +static const symbol s_3_1[2] = { 'r', 'a' }; +static const symbol s_3_2[2] = { 'b', 'e' }; +static const symbol s_3_3[2] = { 'r', 'e' }; +static const symbol s_3_4[2] = { 'i', 'g' }; +static const symbol s_3_5[3] = { 'n', 'a', 'k' }; +static const symbol s_3_6[3] = { 'n', 'e', 'k' }; +static const symbol s_3_7[3] = { 'v', 'a', 'l' }; +static const symbol s_3_8[3] = { 'v', 'e', 'l' }; +static const symbol s_3_9[2] = { 'u', 'l' }; +static const symbol s_3_10[3] = { 'n', 0xE1, 'l' }; +static const symbol s_3_11[3] = { 'n', 0xE9, 'l' }; +static const symbol s_3_12[3] = { 'b', 0xF3, 'l' }; +static const symbol s_3_13[3] = { 'r', 0xF3, 'l' }; +static const symbol s_3_14[3] = { 't', 0xF3, 'l' }; +static const symbol s_3_15[3] = { 'b', 0xF5, 'l' }; +static const symbol s_3_16[3] = { 'r', 0xF5, 'l' }; +static const symbol s_3_17[3] = { 't', 0xF5, 'l' }; +static const symbol s_3_18[2] = { 0xFC, 'l' }; +static const symbol s_3_19[1] = { 'n' }; +static const symbol s_3_20[2] = { 'a', 'n' }; +static const symbol s_3_21[3] = { 'b', 'a', 'n' }; +static const symbol s_3_22[2] = { 'e', 'n' }; +static const symbol s_3_23[3] = { 'b', 'e', 'n' }; +static const symbol s_3_24[6] = { 'k', 0xE9, 'p', 'p', 'e', 'n' }; +static const symbol s_3_25[2] = { 'o', 'n' }; +static const symbol s_3_26[2] = { 0xF6, 'n' }; +static const symbol s_3_27[4] = { 'k', 0xE9, 'p', 'p' }; +static const symbol s_3_28[3] = { 'k', 'o', 'r' }; +static const symbol s_3_29[1] = { 't' }; +static const symbol s_3_30[2] = { 'a', 't' }; +static const symbol s_3_31[2] = { 'e', 't' }; +static const symbol s_3_32[4] = { 'k', 0xE9, 'n', 't' }; +static const symbol s_3_33[6] = { 'a', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_3_34[6] = { 'e', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_3_35[6] = { 'o', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_3_36[2] = { 'o', 't' }; +static const symbol s_3_37[3] = { 0xE9, 'r', 't' }; +static const symbol s_3_38[2] = { 0xF6, 't' }; +static const symbol s_3_39[3] = { 'h', 'e', 'z' }; +static const symbol s_3_40[3] = { 'h', 'o', 'z' }; +static const symbol s_3_41[3] = { 'h', 0xF6, 'z' }; +static const symbol s_3_42[2] = { 'v', 0xE1 }; +static const symbol s_3_43[2] = { 'v', 0xE9 }; +static const struct among a_3[44] = { +{ 2, s_3_0, 0, -1, 0}, +{ 2, s_3_1, 0, -1, 0}, +{ 2, s_3_2, 0, -1, 0}, +{ 2, s_3_3, 0, -1, 0}, +{ 2, s_3_4, 0, -1, 0}, +{ 3, s_3_5, 0, -1, 0}, +{ 3, s_3_6, 0, -1, 0}, +{ 3, s_3_7, 0, -1, 0}, +{ 3, s_3_8, 0, -1, 0}, +{ 2, s_3_9, 0, -1, 0}, +{ 3, s_3_10, 0, -1, 0}, +{ 3, s_3_11, 0, -1, 0}, +{ 3, s_3_12, 0, -1, 0}, +{ 3, s_3_13, 0, -1, 0}, +{ 3, s_3_14, 0, -1, 0}, +{ 3, s_3_15, 0, -1, 0}, +{ 3, s_3_16, 0, -1, 0}, +{ 3, s_3_17, 0, -1, 0}, +{ 2, s_3_18, 0, -1, 0}, +{ 1, s_3_19, 0, -1, 0}, +{ 2, s_3_20, -1, -1, 0}, +{ 3, s_3_21, -1, -1, 0}, +{ 2, s_3_22, -3, -1, 0}, +{ 3, s_3_23, -1, -1, 0}, +{ 6, s_3_24, -2, -1, 0}, +{ 2, s_3_25, -6, -1, 0}, +{ 2, s_3_26, -7, -1, 0}, +{ 4, s_3_27, 0, -1, 0}, +{ 3, s_3_28, 0, -1, 0}, +{ 1, s_3_29, 0, -1, 0}, +{ 2, s_3_30, -1, -1, 0}, +{ 2, s_3_31, -2, -1, 0}, +{ 4, s_3_32, -3, -1, 0}, +{ 6, s_3_33, -1, -1, 0}, +{ 6, s_3_34, -2, -1, 0}, +{ 6, s_3_35, -3, -1, 0}, +{ 2, s_3_36, -7, -1, 0}, +{ 3, s_3_37, -8, -1, 0}, +{ 2, s_3_38, -9, -1, 0}, +{ 3, s_3_39, 0, -1, 0}, +{ 3, s_3_40, 0, -1, 0}, +{ 3, s_3_41, 0, -1, 0}, +{ 2, s_3_42, 0, -1, 0}, +{ 2, s_3_43, 0, -1, 0} +}; + +static const symbol s_4_0[2] = { 0xE1, 'n' }; +static const symbol s_4_1[2] = { 0xE9, 'n' }; +static const symbol s_4_2[6] = { 0xE1, 'n', 'k', 0xE9, 'n', 't' }; +static const struct among a_4[3] = { +{ 2, s_4_0, 0, 2, 0}, +{ 2, s_4_1, 0, 1, 0}, +{ 6, s_4_2, 0, 2, 0} +}; + +static const symbol s_5_0[4] = { 's', 't', 'u', 'l' }; +static const symbol s_5_1[5] = { 'a', 's', 't', 'u', 'l' }; +static const symbol s_5_2[5] = { 0xE1, 's', 't', 'u', 'l' }; +static const symbol s_5_3[4] = { 's', 't', 0xFC, 'l' }; +static const symbol s_5_4[5] = { 'e', 's', 't', 0xFC, 'l' }; +static const symbol s_5_5[5] = { 0xE9, 's', 't', 0xFC, 'l' }; +static const struct among a_5[6] = { +{ 4, s_5_0, 0, 1, 0}, +{ 5, s_5_1, -1, 1, 0}, +{ 5, s_5_2, -2, 2, 0}, +{ 4, s_5_3, 0, 1, 0}, +{ 5, s_5_4, -1, 1, 0}, +{ 5, s_5_5, -2, 3, 0} +}; + +static const symbol s_6_0[1] = { 0xE1 }; +static const symbol s_6_1[1] = { 0xE9 }; +static const struct among a_6[2] = { +{ 1, s_6_0, 0, 1, 0}, +{ 1, s_6_1, 0, 1, 0} +}; + +static const symbol s_7_0[1] = { 'k' }; +static const symbol s_7_1[2] = { 'a', 'k' }; +static const symbol s_7_2[2] = { 'e', 'k' }; +static const symbol s_7_3[2] = { 'o', 'k' }; +static const symbol s_7_4[2] = { 0xE1, 'k' }; +static const symbol s_7_5[2] = { 0xE9, 'k' }; +static const symbol s_7_6[2] = { 0xF6, 'k' }; +static const struct among a_7[7] = { +{ 1, s_7_0, 0, 3, 0}, +{ 2, s_7_1, -1, 3, 0}, +{ 2, s_7_2, -2, 3, 0}, +{ 2, s_7_3, -3, 3, 0}, +{ 2, s_7_4, -4, 1, 0}, +{ 2, s_7_5, -5, 2, 0}, +{ 2, s_7_6, -6, 3, 0} +}; + +static const symbol s_8_0[2] = { 0xE9, 'i' }; +static const symbol s_8_1[3] = { 0xE1, 0xE9, 'i' }; +static const symbol s_8_2[3] = { 0xE9, 0xE9, 'i' }; +static const symbol s_8_3[1] = { 0xE9 }; +static const symbol s_8_4[2] = { 'k', 0xE9 }; +static const symbol s_8_5[3] = { 'a', 'k', 0xE9 }; +static const symbol s_8_6[3] = { 'e', 'k', 0xE9 }; +static const symbol s_8_7[3] = { 'o', 'k', 0xE9 }; +static const symbol s_8_8[3] = { 0xE1, 'k', 0xE9 }; +static const symbol s_8_9[3] = { 0xE9, 'k', 0xE9 }; +static const symbol s_8_10[3] = { 0xF6, 'k', 0xE9 }; +static const symbol s_8_11[2] = { 0xE9, 0xE9 }; +static const struct among a_8[12] = { +{ 2, s_8_0, 0, 1, 0}, +{ 3, s_8_1, -1, 3, 0}, +{ 3, s_8_2, -2, 2, 0}, +{ 1, s_8_3, 0, 1, 0}, +{ 2, s_8_4, -1, 1, 0}, +{ 3, s_8_5, -1, 1, 0}, +{ 3, s_8_6, -2, 1, 0}, +{ 3, s_8_7, -3, 1, 0}, +{ 3, s_8_8, -4, 3, 0}, +{ 3, s_8_9, -5, 2, 0}, +{ 3, s_8_10, -6, 1, 0}, +{ 2, s_8_11, -8, 2, 0} +}; + +static const symbol s_9_0[1] = { 'a' }; +static const symbol s_9_1[2] = { 'j', 'a' }; +static const symbol s_9_2[1] = { 'd' }; +static const symbol s_9_3[2] = { 'a', 'd' }; +static const symbol s_9_4[2] = { 'e', 'd' }; +static const symbol s_9_5[2] = { 'o', 'd' }; +static const symbol s_9_6[2] = { 0xE1, 'd' }; +static const symbol s_9_7[2] = { 0xE9, 'd' }; +static const symbol s_9_8[2] = { 0xF6, 'd' }; +static const symbol s_9_9[1] = { 'e' }; +static const symbol s_9_10[2] = { 'j', 'e' }; +static const symbol s_9_11[2] = { 'n', 'k' }; +static const symbol s_9_12[3] = { 'u', 'n', 'k' }; +static const symbol s_9_13[3] = { 0xE1, 'n', 'k' }; +static const symbol s_9_14[3] = { 0xE9, 'n', 'k' }; +static const symbol s_9_15[3] = { 0xFC, 'n', 'k' }; +static const symbol s_9_16[2] = { 'u', 'k' }; +static const symbol s_9_17[3] = { 'j', 'u', 'k' }; +static const symbol s_9_18[4] = { 0xE1, 'j', 'u', 'k' }; +static const symbol s_9_19[2] = { 0xFC, 'k' }; +static const symbol s_9_20[3] = { 'j', 0xFC, 'k' }; +static const symbol s_9_21[4] = { 0xE9, 'j', 0xFC, 'k' }; +static const symbol s_9_22[1] = { 'm' }; +static const symbol s_9_23[2] = { 'a', 'm' }; +static const symbol s_9_24[2] = { 'e', 'm' }; +static const symbol s_9_25[2] = { 'o', 'm' }; +static const symbol s_9_26[2] = { 0xE1, 'm' }; +static const symbol s_9_27[2] = { 0xE9, 'm' }; +static const symbol s_9_28[1] = { 'o' }; +static const symbol s_9_29[1] = { 0xE1 }; +static const symbol s_9_30[1] = { 0xE9 }; +static const struct among a_9[31] = { +{ 1, s_9_0, 0, 1, 0}, +{ 2, s_9_1, -1, 1, 0}, +{ 1, s_9_2, 0, 1, 0}, +{ 2, s_9_3, -1, 1, 0}, +{ 2, s_9_4, -2, 1, 0}, +{ 2, s_9_5, -3, 1, 0}, +{ 2, s_9_6, -4, 2, 0}, +{ 2, s_9_7, -5, 3, 0}, +{ 2, s_9_8, -6, 1, 0}, +{ 1, s_9_9, 0, 1, 0}, +{ 2, s_9_10, -1, 1, 0}, +{ 2, s_9_11, 0, 1, 0}, +{ 3, s_9_12, -1, 1, 0}, +{ 3, s_9_13, -2, 2, 0}, +{ 3, s_9_14, -3, 3, 0}, +{ 3, s_9_15, -4, 1, 0}, +{ 2, s_9_16, 0, 1, 0}, +{ 3, s_9_17, -1, 1, 0}, +{ 4, s_9_18, -1, 2, 0}, +{ 2, s_9_19, 0, 1, 0}, +{ 3, s_9_20, -1, 1, 0}, +{ 4, s_9_21, -1, 3, 0}, +{ 1, s_9_22, 0, 1, 0}, +{ 2, s_9_23, -1, 1, 0}, +{ 2, s_9_24, -2, 1, 0}, +{ 2, s_9_25, -3, 1, 0}, +{ 2, s_9_26, -4, 2, 0}, +{ 2, s_9_27, -5, 3, 0}, +{ 1, s_9_28, 0, 1, 0}, +{ 1, s_9_29, 0, 2, 0}, +{ 1, s_9_30, 0, 3, 0} +}; + +static const symbol s_10_0[2] = { 'i', 'd' }; +static const symbol s_10_1[3] = { 'a', 'i', 'd' }; +static const symbol s_10_2[4] = { 'j', 'a', 'i', 'd' }; +static const symbol s_10_3[3] = { 'e', 'i', 'd' }; +static const symbol s_10_4[4] = { 'j', 'e', 'i', 'd' }; +static const symbol s_10_5[3] = { 0xE1, 'i', 'd' }; +static const symbol s_10_6[3] = { 0xE9, 'i', 'd' }; +static const symbol s_10_7[1] = { 'i' }; +static const symbol s_10_8[2] = { 'a', 'i' }; +static const symbol s_10_9[3] = { 'j', 'a', 'i' }; +static const symbol s_10_10[2] = { 'e', 'i' }; +static const symbol s_10_11[3] = { 'j', 'e', 'i' }; +static const symbol s_10_12[2] = { 0xE1, 'i' }; +static const symbol s_10_13[2] = { 0xE9, 'i' }; +static const symbol s_10_14[4] = { 'i', 't', 'e', 'k' }; +static const symbol s_10_15[5] = { 'e', 'i', 't', 'e', 'k' }; +static const symbol s_10_16[6] = { 'j', 'e', 'i', 't', 'e', 'k' }; +static const symbol s_10_17[5] = { 0xE9, 'i', 't', 'e', 'k' }; +static const symbol s_10_18[2] = { 'i', 'k' }; +static const symbol s_10_19[3] = { 'a', 'i', 'k' }; +static const symbol s_10_20[4] = { 'j', 'a', 'i', 'k' }; +static const symbol s_10_21[3] = { 'e', 'i', 'k' }; +static const symbol s_10_22[4] = { 'j', 'e', 'i', 'k' }; +static const symbol s_10_23[3] = { 0xE1, 'i', 'k' }; +static const symbol s_10_24[3] = { 0xE9, 'i', 'k' }; +static const symbol s_10_25[3] = { 'i', 'n', 'k' }; +static const symbol s_10_26[4] = { 'a', 'i', 'n', 'k' }; +static const symbol s_10_27[5] = { 'j', 'a', 'i', 'n', 'k' }; +static const symbol s_10_28[4] = { 'e', 'i', 'n', 'k' }; +static const symbol s_10_29[5] = { 'j', 'e', 'i', 'n', 'k' }; +static const symbol s_10_30[4] = { 0xE1, 'i', 'n', 'k' }; +static const symbol s_10_31[4] = { 0xE9, 'i', 'n', 'k' }; +static const symbol s_10_32[5] = { 'a', 'i', 't', 'o', 'k' }; +static const symbol s_10_33[6] = { 'j', 'a', 'i', 't', 'o', 'k' }; +static const symbol s_10_34[5] = { 0xE1, 'i', 't', 'o', 'k' }; +static const symbol s_10_35[2] = { 'i', 'm' }; +static const symbol s_10_36[3] = { 'a', 'i', 'm' }; +static const symbol s_10_37[4] = { 'j', 'a', 'i', 'm' }; +static const symbol s_10_38[3] = { 'e', 'i', 'm' }; +static const symbol s_10_39[4] = { 'j', 'e', 'i', 'm' }; +static const symbol s_10_40[3] = { 0xE1, 'i', 'm' }; +static const symbol s_10_41[3] = { 0xE9, 'i', 'm' }; +static const struct among a_10[42] = { +{ 2, s_10_0, 0, 1, 0}, +{ 3, s_10_1, -1, 1, 0}, +{ 4, s_10_2, -1, 1, 0}, +{ 3, s_10_3, -3, 1, 0}, +{ 4, s_10_4, -1, 1, 0}, +{ 3, s_10_5, -5, 2, 0}, +{ 3, s_10_6, -6, 3, 0}, +{ 1, s_10_7, 0, 1, 0}, +{ 2, s_10_8, -1, 1, 0}, +{ 3, s_10_9, -1, 1, 0}, +{ 2, s_10_10, -3, 1, 0}, +{ 3, s_10_11, -1, 1, 0}, +{ 2, s_10_12, -5, 2, 0}, +{ 2, s_10_13, -6, 3, 0}, +{ 4, s_10_14, 0, 1, 0}, +{ 5, s_10_15, -1, 1, 0}, +{ 6, s_10_16, -1, 1, 0}, +{ 5, s_10_17, -3, 3, 0}, +{ 2, s_10_18, 0, 1, 0}, +{ 3, s_10_19, -1, 1, 0}, +{ 4, s_10_20, -1, 1, 0}, +{ 3, s_10_21, -3, 1, 0}, +{ 4, s_10_22, -1, 1, 0}, +{ 3, s_10_23, -5, 2, 0}, +{ 3, s_10_24, -6, 3, 0}, +{ 3, s_10_25, 0, 1, 0}, +{ 4, s_10_26, -1, 1, 0}, +{ 5, s_10_27, -1, 1, 0}, +{ 4, s_10_28, -3, 1, 0}, +{ 5, s_10_29, -1, 1, 0}, +{ 4, s_10_30, -5, 2, 0}, +{ 4, s_10_31, -6, 3, 0}, +{ 5, s_10_32, 0, 1, 0}, +{ 6, s_10_33, -1, 1, 0}, +{ 5, s_10_34, 0, 2, 0}, +{ 2, s_10_35, 0, 1, 0}, +{ 3, s_10_36, -1, 1, 0}, +{ 4, s_10_37, -1, 1, 0}, +{ 3, s_10_38, -3, 1, 0}, +{ 4, s_10_39, -1, 1, 0}, +{ 3, s_10_40, -5, 2, 0}, +{ 3, s_10_41, -6, 3, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 52, 14 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'e' }; +static const symbol s_3[] = { 'a' }; +static const symbol s_4[] = { 'a' }; +static const symbol s_5[] = { 'e' }; +static const symbol s_6[] = { 'a' }; +static const symbol s_7[] = { 'e' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 'a' }; +static const symbol s_10[] = { 'a' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'a' }; +static const symbol s_13[] = { 'e' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { + int v_1 = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab1; + { + int v_2 = z->c; + { + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + z->I[0] = z->c; + lab2: + z->c = v_2; + } + goto lab0; + lab1: + z->c = v_1; + { + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_v_ending(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 225 && z->p[z->c - 1] != 233)) return 0; + among_var = find_among_b(z, a_0, 2); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_double(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((106790108 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 23)) return 0; + z->c = z->l - v_1; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + if (z->c <= z->lb) return 0; + z->c--; + z->ket = z->c; + if (z->c <= z->lb) return 0; + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_instrum(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 108) return 0; + if (!find_among_b(z, a_2, 2)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_double(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_case(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_3, 44)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_v_ending(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_case_special(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 110 && z->p[z->c - 1] != 116)) return 0; + among_var = find_among_b(z, a_4, 3); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_case_other(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 108) return 0; + among_var = find_among_b(z, a_5, 6); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_factive(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 225 && z->p[z->c - 1] != 233)) return 0; + if (!find_among_b(z, a_6, 2)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_double(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_plural(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 107) return 0; + among_var = find_among_b(z, a_7, 7); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_owned(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 233)) return 0; + among_var = find_among_b(z, a_8, 12); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_sing_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_9, 31); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_plur_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((10768 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_10, 42); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_13); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int hungarian_ISO_8859_2_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_instrum(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_case(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_case_special(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_case_other(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_factive(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_owned(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_sing_owner(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_plur_owner(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * hungarian_ISO_8859_2_create_env(void) { return SN_create_env(0, 1); } + +extern void hungarian_ISO_8859_2_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.h b/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.h new file mode 100644 index 000000000000..24f53426283e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_ISO_8859_2_hungarian.h @@ -0,0 +1,15 @@ +/* Generated from hungarian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_ISO_8859_2_create_env(void); +extern void hungarian_ISO_8859_2_close_env(struct SN_env * z); + +extern int hungarian_ISO_8859_2_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_KOI8_R_russian.c b/contrib/libs/snowball/src_c/stem_KOI8_R_russian.c new file mode 100644 index 000000000000..0c612ce27fc6 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_KOI8_R_russian.c @@ -0,0 +1,703 @@ +/* Generated from russian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int russian_KOI8_R_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_tidy_up(struct SN_env * z); +static int r_derivational(struct SN_env * z); +static int r_noun(struct SN_env * z); +static int r_verb(struct SN_env * z); +static int r_reflexive(struct SN_env * z); +static int r_adjectival(struct SN_env * z); +static int r_adjective(struct SN_env * z); +static int r_perfective_gerund(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * russian_KOI8_R_create_env(void); +extern void russian_KOI8_R_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 0xD7, 0xDB, 0xC9 }; +static const symbol s_0_1[4] = { 0xC9, 0xD7, 0xDB, 0xC9 }; +static const symbol s_0_2[4] = { 0xD9, 0xD7, 0xDB, 0xC9 }; +static const symbol s_0_3[1] = { 0xD7 }; +static const symbol s_0_4[2] = { 0xC9, 0xD7 }; +static const symbol s_0_5[2] = { 0xD9, 0xD7 }; +static const symbol s_0_6[5] = { 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 }; +static const symbol s_0_7[6] = { 0xC9, 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 }; +static const symbol s_0_8[6] = { 0xD9, 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 }; +static const struct among a_0[9] = { +{ 3, s_0_0, 0, 1, 0}, +{ 4, s_0_1, -1, 2, 0}, +{ 4, s_0_2, -2, 2, 0}, +{ 1, s_0_3, 0, 1, 0}, +{ 2, s_0_4, -1, 2, 0}, +{ 2, s_0_5, -2, 2, 0}, +{ 5, s_0_6, 0, 1, 0}, +{ 6, s_0_7, -1, 2, 0}, +{ 6, s_0_8, -2, 2, 0} +}; + +static const symbol s_1_0[2] = { 0xC0, 0xC0 }; +static const symbol s_1_1[2] = { 0xC5, 0xC0 }; +static const symbol s_1_2[2] = { 0xCF, 0xC0 }; +static const symbol s_1_3[2] = { 0xD5, 0xC0 }; +static const symbol s_1_4[2] = { 0xC5, 0xC5 }; +static const symbol s_1_5[2] = { 0xC9, 0xC5 }; +static const symbol s_1_6[2] = { 0xCF, 0xC5 }; +static const symbol s_1_7[2] = { 0xD9, 0xC5 }; +static const symbol s_1_8[2] = { 0xC9, 0xC8 }; +static const symbol s_1_9[2] = { 0xD9, 0xC8 }; +static const symbol s_1_10[3] = { 0xC9, 0xCD, 0xC9 }; +static const symbol s_1_11[3] = { 0xD9, 0xCD, 0xC9 }; +static const symbol s_1_12[2] = { 0xC5, 0xCA }; +static const symbol s_1_13[2] = { 0xC9, 0xCA }; +static const symbol s_1_14[2] = { 0xCF, 0xCA }; +static const symbol s_1_15[2] = { 0xD9, 0xCA }; +static const symbol s_1_16[2] = { 0xC5, 0xCD }; +static const symbol s_1_17[2] = { 0xC9, 0xCD }; +static const symbol s_1_18[2] = { 0xCF, 0xCD }; +static const symbol s_1_19[2] = { 0xD9, 0xCD }; +static const symbol s_1_20[3] = { 0xC5, 0xC7, 0xCF }; +static const symbol s_1_21[3] = { 0xCF, 0xC7, 0xCF }; +static const symbol s_1_22[2] = { 0xC1, 0xD1 }; +static const symbol s_1_23[2] = { 0xD1, 0xD1 }; +static const symbol s_1_24[3] = { 0xC5, 0xCD, 0xD5 }; +static const symbol s_1_25[3] = { 0xCF, 0xCD, 0xD5 }; +static const struct among a_1[26] = { +{ 2, s_1_0, 0, 1, 0}, +{ 2, s_1_1, 0, 1, 0}, +{ 2, s_1_2, 0, 1, 0}, +{ 2, s_1_3, 0, 1, 0}, +{ 2, s_1_4, 0, 1, 0}, +{ 2, s_1_5, 0, 1, 0}, +{ 2, s_1_6, 0, 1, 0}, +{ 2, s_1_7, 0, 1, 0}, +{ 2, s_1_8, 0, 1, 0}, +{ 2, s_1_9, 0, 1, 0}, +{ 3, s_1_10, 0, 1, 0}, +{ 3, s_1_11, 0, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 2, s_1_13, 0, 1, 0}, +{ 2, s_1_14, 0, 1, 0}, +{ 2, s_1_15, 0, 1, 0}, +{ 2, s_1_16, 0, 1, 0}, +{ 2, s_1_17, 0, 1, 0}, +{ 2, s_1_18, 0, 1, 0}, +{ 2, s_1_19, 0, 1, 0}, +{ 3, s_1_20, 0, 1, 0}, +{ 3, s_1_21, 0, 1, 0}, +{ 2, s_1_22, 0, 1, 0}, +{ 2, s_1_23, 0, 1, 0}, +{ 3, s_1_24, 0, 1, 0}, +{ 3, s_1_25, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 0xC5, 0xCD }; +static const symbol s_2_1[2] = { 0xCE, 0xCE }; +static const symbol s_2_2[2] = { 0xD7, 0xDB }; +static const symbol s_2_3[3] = { 0xC9, 0xD7, 0xDB }; +static const symbol s_2_4[3] = { 0xD9, 0xD7, 0xDB }; +static const symbol s_2_5[1] = { 0xDD }; +static const symbol s_2_6[2] = { 0xC0, 0xDD }; +static const symbol s_2_7[3] = { 0xD5, 0xC0, 0xDD }; +static const struct among a_2[8] = { +{ 2, s_2_0, 0, 1, 0}, +{ 2, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 1, 0}, +{ 3, s_2_3, -1, 2, 0}, +{ 3, s_2_4, -2, 2, 0}, +{ 1, s_2_5, 0, 1, 0}, +{ 2, s_2_6, -1, 1, 0}, +{ 3, s_2_7, -1, 2, 0} +}; + +static const symbol s_3_0[2] = { 0xD3, 0xD1 }; +static const symbol s_3_1[2] = { 0xD3, 0xD8 }; +static const struct among a_3[2] = { +{ 2, s_3_0, 0, 1, 0}, +{ 2, s_3_1, 0, 1, 0} +}; + +static const symbol s_4_0[1] = { 0xC0 }; +static const symbol s_4_1[2] = { 0xD5, 0xC0 }; +static const symbol s_4_2[2] = { 0xCC, 0xC1 }; +static const symbol s_4_3[3] = { 0xC9, 0xCC, 0xC1 }; +static const symbol s_4_4[3] = { 0xD9, 0xCC, 0xC1 }; +static const symbol s_4_5[2] = { 0xCE, 0xC1 }; +static const symbol s_4_6[3] = { 0xC5, 0xCE, 0xC1 }; +static const symbol s_4_7[3] = { 0xC5, 0xD4, 0xC5 }; +static const symbol s_4_8[3] = { 0xC9, 0xD4, 0xC5 }; +static const symbol s_4_9[3] = { 0xCA, 0xD4, 0xC5 }; +static const symbol s_4_10[4] = { 0xC5, 0xCA, 0xD4, 0xC5 }; +static const symbol s_4_11[4] = { 0xD5, 0xCA, 0xD4, 0xC5 }; +static const symbol s_4_12[2] = { 0xCC, 0xC9 }; +static const symbol s_4_13[3] = { 0xC9, 0xCC, 0xC9 }; +static const symbol s_4_14[3] = { 0xD9, 0xCC, 0xC9 }; +static const symbol s_4_15[1] = { 0xCA }; +static const symbol s_4_16[2] = { 0xC5, 0xCA }; +static const symbol s_4_17[2] = { 0xD5, 0xCA }; +static const symbol s_4_18[1] = { 0xCC }; +static const symbol s_4_19[2] = { 0xC9, 0xCC }; +static const symbol s_4_20[2] = { 0xD9, 0xCC }; +static const symbol s_4_21[2] = { 0xC5, 0xCD }; +static const symbol s_4_22[2] = { 0xC9, 0xCD }; +static const symbol s_4_23[2] = { 0xD9, 0xCD }; +static const symbol s_4_24[1] = { 0xCE }; +static const symbol s_4_25[2] = { 0xC5, 0xCE }; +static const symbol s_4_26[2] = { 0xCC, 0xCF }; +static const symbol s_4_27[3] = { 0xC9, 0xCC, 0xCF }; +static const symbol s_4_28[3] = { 0xD9, 0xCC, 0xCF }; +static const symbol s_4_29[2] = { 0xCE, 0xCF }; +static const symbol s_4_30[3] = { 0xC5, 0xCE, 0xCF }; +static const symbol s_4_31[3] = { 0xCE, 0xCE, 0xCF }; +static const symbol s_4_32[2] = { 0xC0, 0xD4 }; +static const symbol s_4_33[3] = { 0xD5, 0xC0, 0xD4 }; +static const symbol s_4_34[2] = { 0xC5, 0xD4 }; +static const symbol s_4_35[3] = { 0xD5, 0xC5, 0xD4 }; +static const symbol s_4_36[2] = { 0xC9, 0xD4 }; +static const symbol s_4_37[2] = { 0xD1, 0xD4 }; +static const symbol s_4_38[2] = { 0xD9, 0xD4 }; +static const symbol s_4_39[2] = { 0xD4, 0xD8 }; +static const symbol s_4_40[3] = { 0xC9, 0xD4, 0xD8 }; +static const symbol s_4_41[3] = { 0xD9, 0xD4, 0xD8 }; +static const symbol s_4_42[3] = { 0xC5, 0xDB, 0xD8 }; +static const symbol s_4_43[3] = { 0xC9, 0xDB, 0xD8 }; +static const symbol s_4_44[2] = { 0xCE, 0xD9 }; +static const symbol s_4_45[3] = { 0xC5, 0xCE, 0xD9 }; +static const struct among a_4[46] = { +{ 1, s_4_0, 0, 2, 0}, +{ 2, s_4_1, -1, 2, 0}, +{ 2, s_4_2, 0, 1, 0}, +{ 3, s_4_3, -1, 2, 0}, +{ 3, s_4_4, -2, 2, 0}, +{ 2, s_4_5, 0, 1, 0}, +{ 3, s_4_6, -1, 2, 0}, +{ 3, s_4_7, 0, 1, 0}, +{ 3, s_4_8, 0, 2, 0}, +{ 3, s_4_9, 0, 1, 0}, +{ 4, s_4_10, -1, 2, 0}, +{ 4, s_4_11, -2, 2, 0}, +{ 2, s_4_12, 0, 1, 0}, +{ 3, s_4_13, -1, 2, 0}, +{ 3, s_4_14, -2, 2, 0}, +{ 1, s_4_15, 0, 1, 0}, +{ 2, s_4_16, -1, 2, 0}, +{ 2, s_4_17, -2, 2, 0}, +{ 1, s_4_18, 0, 1, 0}, +{ 2, s_4_19, -1, 2, 0}, +{ 2, s_4_20, -2, 2, 0}, +{ 2, s_4_21, 0, 1, 0}, +{ 2, s_4_22, 0, 2, 0}, +{ 2, s_4_23, 0, 2, 0}, +{ 1, s_4_24, 0, 1, 0}, +{ 2, s_4_25, -1, 2, 0}, +{ 2, s_4_26, 0, 1, 0}, +{ 3, s_4_27, -1, 2, 0}, +{ 3, s_4_28, -2, 2, 0}, +{ 2, s_4_29, 0, 1, 0}, +{ 3, s_4_30, -1, 2, 0}, +{ 3, s_4_31, -2, 1, 0}, +{ 2, s_4_32, 0, 1, 0}, +{ 3, s_4_33, -1, 2, 0}, +{ 2, s_4_34, 0, 1, 0}, +{ 3, s_4_35, -1, 2, 0}, +{ 2, s_4_36, 0, 2, 0}, +{ 2, s_4_37, 0, 2, 0}, +{ 2, s_4_38, 0, 2, 0}, +{ 2, s_4_39, 0, 1, 0}, +{ 3, s_4_40, -1, 2, 0}, +{ 3, s_4_41, -2, 2, 0}, +{ 3, s_4_42, 0, 1, 0}, +{ 3, s_4_43, 0, 2, 0}, +{ 2, s_4_44, 0, 1, 0}, +{ 3, s_4_45, -1, 2, 0} +}; + +static const symbol s_5_0[1] = { 0xC0 }; +static const symbol s_5_1[2] = { 0xC9, 0xC0 }; +static const symbol s_5_2[2] = { 0xD8, 0xC0 }; +static const symbol s_5_3[1] = { 0xC1 }; +static const symbol s_5_4[1] = { 0xC5 }; +static const symbol s_5_5[2] = { 0xC9, 0xC5 }; +static const symbol s_5_6[2] = { 0xD8, 0xC5 }; +static const symbol s_5_7[2] = { 0xC1, 0xC8 }; +static const symbol s_5_8[2] = { 0xD1, 0xC8 }; +static const symbol s_5_9[3] = { 0xC9, 0xD1, 0xC8 }; +static const symbol s_5_10[1] = { 0xC9 }; +static const symbol s_5_11[2] = { 0xC5, 0xC9 }; +static const symbol s_5_12[2] = { 0xC9, 0xC9 }; +static const symbol s_5_13[3] = { 0xC1, 0xCD, 0xC9 }; +static const symbol s_5_14[3] = { 0xD1, 0xCD, 0xC9 }; +static const symbol s_5_15[4] = { 0xC9, 0xD1, 0xCD, 0xC9 }; +static const symbol s_5_16[1] = { 0xCA }; +static const symbol s_5_17[2] = { 0xC5, 0xCA }; +static const symbol s_5_18[3] = { 0xC9, 0xC5, 0xCA }; +static const symbol s_5_19[2] = { 0xC9, 0xCA }; +static const symbol s_5_20[2] = { 0xCF, 0xCA }; +static const symbol s_5_21[2] = { 0xC1, 0xCD }; +static const symbol s_5_22[2] = { 0xC5, 0xCD }; +static const symbol s_5_23[3] = { 0xC9, 0xC5, 0xCD }; +static const symbol s_5_24[2] = { 0xCF, 0xCD }; +static const symbol s_5_25[2] = { 0xD1, 0xCD }; +static const symbol s_5_26[3] = { 0xC9, 0xD1, 0xCD }; +static const symbol s_5_27[1] = { 0xCF }; +static const symbol s_5_28[1] = { 0xD1 }; +static const symbol s_5_29[2] = { 0xC9, 0xD1 }; +static const symbol s_5_30[2] = { 0xD8, 0xD1 }; +static const symbol s_5_31[1] = { 0xD5 }; +static const symbol s_5_32[2] = { 0xC5, 0xD7 }; +static const symbol s_5_33[2] = { 0xCF, 0xD7 }; +static const symbol s_5_34[1] = { 0xD8 }; +static const symbol s_5_35[1] = { 0xD9 }; +static const struct among a_5[36] = { +{ 1, s_5_0, 0, 1, 0}, +{ 2, s_5_1, -1, 1, 0}, +{ 2, s_5_2, -2, 1, 0}, +{ 1, s_5_3, 0, 1, 0}, +{ 1, s_5_4, 0, 1, 0}, +{ 2, s_5_5, -1, 1, 0}, +{ 2, s_5_6, -2, 1, 0}, +{ 2, s_5_7, 0, 1, 0}, +{ 2, s_5_8, 0, 1, 0}, +{ 3, s_5_9, -1, 1, 0}, +{ 1, s_5_10, 0, 1, 0}, +{ 2, s_5_11, -1, 1, 0}, +{ 2, s_5_12, -2, 1, 0}, +{ 3, s_5_13, -3, 1, 0}, +{ 3, s_5_14, -4, 1, 0}, +{ 4, s_5_15, -1, 1, 0}, +{ 1, s_5_16, 0, 1, 0}, +{ 2, s_5_17, -1, 1, 0}, +{ 3, s_5_18, -1, 1, 0}, +{ 2, s_5_19, -3, 1, 0}, +{ 2, s_5_20, -4, 1, 0}, +{ 2, s_5_21, 0, 1, 0}, +{ 2, s_5_22, 0, 1, 0}, +{ 3, s_5_23, -1, 1, 0}, +{ 2, s_5_24, 0, 1, 0}, +{ 2, s_5_25, 0, 1, 0}, +{ 3, s_5_26, -1, 1, 0}, +{ 1, s_5_27, 0, 1, 0}, +{ 1, s_5_28, 0, 1, 0}, +{ 2, s_5_29, -1, 1, 0}, +{ 2, s_5_30, -2, 1, 0}, +{ 1, s_5_31, 0, 1, 0}, +{ 2, s_5_32, 0, 1, 0}, +{ 2, s_5_33, 0, 1, 0}, +{ 1, s_5_34, 0, 1, 0}, +{ 1, s_5_35, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 0xCF, 0xD3, 0xD4 }; +static const symbol s_6_1[4] = { 0xCF, 0xD3, 0xD4, 0xD8 }; +static const struct among a_6[2] = { +{ 3, s_6_0, 0, 1, 0}, +{ 4, s_6_1, 0, 1, 0} +}; + +static const symbol s_7_0[4] = { 0xC5, 0xCA, 0xDB, 0xC5 }; +static const symbol s_7_1[1] = { 0xCE }; +static const symbol s_7_2[1] = { 0xD8 }; +static const symbol s_7_3[3] = { 0xC5, 0xCA, 0xDB }; +static const struct among a_7[4] = { +{ 4, s_7_0, 0, 1, 0}, +{ 1, s_7_1, 0, 2, 0}, +{ 1, s_7_2, 0, 3, 0}, +{ 3, s_7_3, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 35, 130, 34, 18 }; + +static const symbol s_0[] = { 0xC5 }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping(z, g_v, 192, 220, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = in_grouping(z, g_v, 192, 220, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = out_grouping(z, g_v, 192, 220, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping(z, g_v, 192, 220, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_perfective_gerund(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((25166336 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_0, 9); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_adjective(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((2271009 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 26)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_adjectival(struct SN_env * z) { + int among_var; + { + int ret = r_adjective(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((671113216 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_1; goto lab0; } + among_var = find_among_b(z, a_2, 8); + if (!among_var) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab2; + z->c--; + goto lab1; + lab2: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) { z->c = z->l - v_1; goto lab0; } + z->c--; + } + lab1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + ; + } + return 1; +} + +static int r_reflexive(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 209 && z->p[z->c - 1] != 216)) return 0; + if (!find_among_b(z, a_3, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_verb(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((51443235 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_4, 46); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_noun(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((60991267 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_5, 36)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_derivational(struct SN_env * z) { + z->ket = z->c; + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 212 && z->p[z->c - 1] != 216)) return 0; + if (!find_among_b(z, a_6, 2)) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_tidy_up(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((151011360 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0; + z->c--; + z->bra = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int russian_KOI8_R_stem(struct SN_env * z) { + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 0xA3) goto lab2; + z->c++; + z->ket = z->c; + z->c = v_3; + break; + lab2: + z->c = v_3; + if (z->c >= z->l) goto lab1; + z->c++; + } + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + + { + int v_4; + if (z->c < z->I[1]) return 0; + v_4 = z->lb; z->lb = z->I[1]; + { + int v_5 = z->l - z->c; + { + int v_6 = z->l - z->c; + { + int ret = r_perfective_gerund(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_6; + { + int v_7 = z->l - z->c; + { + int ret = r_reflexive(z); + if (ret == 0) { z->c = z->l - v_7; goto lab6; } + if (ret < 0) return ret; + } + lab6: + ; + } + { + int v_8 = z->l - z->c; + { + int ret = r_adjectival(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_8; + { + int ret = r_verb(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + goto lab7; + lab9: + z->c = z->l - v_8; + { + int ret = r_noun(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + } + lab7: + ; + } + lab4: + lab3: + z->c = z->l - v_5; + } + { + int v_9 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 0xC9) { z->c = z->l - v_9; goto lab10; } + z->c--; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab10: + ; + } + { + int v_10 = z->l - z->c; + { + int ret = r_derivational(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + { + int v_11 = z->l - z->c; + { + int ret = r_tidy_up(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + } + z->lb = v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * russian_KOI8_R_create_env(void) { return SN_create_env(0, 2); } + +extern void russian_KOI8_R_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_KOI8_R_russian.h b/contrib/libs/snowball/src_c/stem_KOI8_R_russian.h new file mode 100644 index 000000000000..84ef4aaeda8e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_KOI8_R_russian.h @@ -0,0 +1,15 @@ +/* Generated from russian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_KOI8_R_create_env(void); +extern void russian_KOI8_R_close_env(struct SN_env * z); + +extern int russian_KOI8_R_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_arabic.c b/contrib/libs/snowball/src_c/stem_UTF_8_arabic.c new file mode 100644 index 000000000000..7a5794c19a0b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_arabic.c @@ -0,0 +1,1756 @@ +/* Generated from arabic.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int arabic_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_Checks1(struct SN_env * z); +static int r_Normalize_pre(struct SN_env * z); +static int r_Normalize_post(struct SN_env * z); +static int r_Suffix_Verb_Step2c(struct SN_env * z); +static int r_Suffix_Verb_Step2b(struct SN_env * z); +static int r_Suffix_Verb_Step2a(struct SN_env * z); +static int r_Suffix_Verb_Step1(struct SN_env * z); +static int r_Suffix_Noun_Step3(struct SN_env * z); +static int r_Suffix_Noun_Step2c2(struct SN_env * z); +static int r_Suffix_Noun_Step2c1(struct SN_env * z); +static int r_Suffix_Noun_Step2b(struct SN_env * z); +static int r_Suffix_Noun_Step2a(struct SN_env * z); +static int r_Suffix_Noun_Step1b(struct SN_env * z); +static int r_Suffix_Noun_Step1a(struct SN_env * z); +static int r_Suffix_All_alef_maqsura(struct SN_env * z); +static int r_Prefix_Step4_Verb(struct SN_env * z); +static int r_Prefix_Step3_Verb(struct SN_env * z); +static int r_Prefix_Step3b_Noun(struct SN_env * z); +static int r_Prefix_Step3a_Noun(struct SN_env * z); +static int r_Prefix_Step2(struct SN_env * z); +static int r_Prefix_Step1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * arabic_UTF_8_create_env(void); +extern void arabic_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 0xD9, 0x80 }; +static const symbol s_0_1[2] = { 0xD9, 0x8B }; +static const symbol s_0_2[2] = { 0xD9, 0x8C }; +static const symbol s_0_3[2] = { 0xD9, 0x8D }; +static const symbol s_0_4[2] = { 0xD9, 0x8E }; +static const symbol s_0_5[2] = { 0xD9, 0x8F }; +static const symbol s_0_6[2] = { 0xD9, 0x90 }; +static const symbol s_0_7[2] = { 0xD9, 0x91 }; +static const symbol s_0_8[2] = { 0xD9, 0x92 }; +static const symbol s_0_9[2] = { 0xD9, 0xA0 }; +static const symbol s_0_10[2] = { 0xD9, 0xA1 }; +static const symbol s_0_11[2] = { 0xD9, 0xA2 }; +static const symbol s_0_12[2] = { 0xD9, 0xA3 }; +static const symbol s_0_13[2] = { 0xD9, 0xA4 }; +static const symbol s_0_14[2] = { 0xD9, 0xA5 }; +static const symbol s_0_15[2] = { 0xD9, 0xA6 }; +static const symbol s_0_16[2] = { 0xD9, 0xA7 }; +static const symbol s_0_17[2] = { 0xD9, 0xA8 }; +static const symbol s_0_18[2] = { 0xD9, 0xA9 }; +static const symbol s_0_19[3] = { 0xEF, 0xBA, 0x80 }; +static const symbol s_0_20[3] = { 0xEF, 0xBA, 0x81 }; +static const symbol s_0_21[3] = { 0xEF, 0xBA, 0x82 }; +static const symbol s_0_22[3] = { 0xEF, 0xBA, 0x83 }; +static const symbol s_0_23[3] = { 0xEF, 0xBA, 0x84 }; +static const symbol s_0_24[3] = { 0xEF, 0xBA, 0x85 }; +static const symbol s_0_25[3] = { 0xEF, 0xBA, 0x86 }; +static const symbol s_0_26[3] = { 0xEF, 0xBA, 0x87 }; +static const symbol s_0_27[3] = { 0xEF, 0xBA, 0x88 }; +static const symbol s_0_28[3] = { 0xEF, 0xBA, 0x89 }; +static const symbol s_0_29[3] = { 0xEF, 0xBA, 0x8A }; +static const symbol s_0_30[3] = { 0xEF, 0xBA, 0x8B }; +static const symbol s_0_31[3] = { 0xEF, 0xBA, 0x8C }; +static const symbol s_0_32[3] = { 0xEF, 0xBA, 0x8D }; +static const symbol s_0_33[3] = { 0xEF, 0xBA, 0x8E }; +static const symbol s_0_34[3] = { 0xEF, 0xBA, 0x8F }; +static const symbol s_0_35[3] = { 0xEF, 0xBA, 0x90 }; +static const symbol s_0_36[3] = { 0xEF, 0xBA, 0x91 }; +static const symbol s_0_37[3] = { 0xEF, 0xBA, 0x92 }; +static const symbol s_0_38[3] = { 0xEF, 0xBA, 0x93 }; +static const symbol s_0_39[3] = { 0xEF, 0xBA, 0x94 }; +static const symbol s_0_40[3] = { 0xEF, 0xBA, 0x95 }; +static const symbol s_0_41[3] = { 0xEF, 0xBA, 0x96 }; +static const symbol s_0_42[3] = { 0xEF, 0xBA, 0x97 }; +static const symbol s_0_43[3] = { 0xEF, 0xBA, 0x98 }; +static const symbol s_0_44[3] = { 0xEF, 0xBA, 0x99 }; +static const symbol s_0_45[3] = { 0xEF, 0xBA, 0x9A }; +static const symbol s_0_46[3] = { 0xEF, 0xBA, 0x9B }; +static const symbol s_0_47[3] = { 0xEF, 0xBA, 0x9C }; +static const symbol s_0_48[3] = { 0xEF, 0xBA, 0x9D }; +static const symbol s_0_49[3] = { 0xEF, 0xBA, 0x9E }; +static const symbol s_0_50[3] = { 0xEF, 0xBA, 0x9F }; +static const symbol s_0_51[3] = { 0xEF, 0xBA, 0xA0 }; +static const symbol s_0_52[3] = { 0xEF, 0xBA, 0xA1 }; +static const symbol s_0_53[3] = { 0xEF, 0xBA, 0xA2 }; +static const symbol s_0_54[3] = { 0xEF, 0xBA, 0xA3 }; +static const symbol s_0_55[3] = { 0xEF, 0xBA, 0xA4 }; +static const symbol s_0_56[3] = { 0xEF, 0xBA, 0xA5 }; +static const symbol s_0_57[3] = { 0xEF, 0xBA, 0xA6 }; +static const symbol s_0_58[3] = { 0xEF, 0xBA, 0xA7 }; +static const symbol s_0_59[3] = { 0xEF, 0xBA, 0xA8 }; +static const symbol s_0_60[3] = { 0xEF, 0xBA, 0xA9 }; +static const symbol s_0_61[3] = { 0xEF, 0xBA, 0xAA }; +static const symbol s_0_62[3] = { 0xEF, 0xBA, 0xAB }; +static const symbol s_0_63[3] = { 0xEF, 0xBA, 0xAC }; +static const symbol s_0_64[3] = { 0xEF, 0xBA, 0xAD }; +static const symbol s_0_65[3] = { 0xEF, 0xBA, 0xAE }; +static const symbol s_0_66[3] = { 0xEF, 0xBA, 0xAF }; +static const symbol s_0_67[3] = { 0xEF, 0xBA, 0xB0 }; +static const symbol s_0_68[3] = { 0xEF, 0xBA, 0xB1 }; +static const symbol s_0_69[3] = { 0xEF, 0xBA, 0xB2 }; +static const symbol s_0_70[3] = { 0xEF, 0xBA, 0xB3 }; +static const symbol s_0_71[3] = { 0xEF, 0xBA, 0xB4 }; +static const symbol s_0_72[3] = { 0xEF, 0xBA, 0xB5 }; +static const symbol s_0_73[3] = { 0xEF, 0xBA, 0xB6 }; +static const symbol s_0_74[3] = { 0xEF, 0xBA, 0xB7 }; +static const symbol s_0_75[3] = { 0xEF, 0xBA, 0xB8 }; +static const symbol s_0_76[3] = { 0xEF, 0xBA, 0xB9 }; +static const symbol s_0_77[3] = { 0xEF, 0xBA, 0xBA }; +static const symbol s_0_78[3] = { 0xEF, 0xBA, 0xBB }; +static const symbol s_0_79[3] = { 0xEF, 0xBA, 0xBC }; +static const symbol s_0_80[3] = { 0xEF, 0xBA, 0xBD }; +static const symbol s_0_81[3] = { 0xEF, 0xBA, 0xBE }; +static const symbol s_0_82[3] = { 0xEF, 0xBA, 0xBF }; +static const symbol s_0_83[3] = { 0xEF, 0xBB, 0x80 }; +static const symbol s_0_84[3] = { 0xEF, 0xBB, 0x81 }; +static const symbol s_0_85[3] = { 0xEF, 0xBB, 0x82 }; +static const symbol s_0_86[3] = { 0xEF, 0xBB, 0x83 }; +static const symbol s_0_87[3] = { 0xEF, 0xBB, 0x84 }; +static const symbol s_0_88[3] = { 0xEF, 0xBB, 0x85 }; +static const symbol s_0_89[3] = { 0xEF, 0xBB, 0x86 }; +static const symbol s_0_90[3] = { 0xEF, 0xBB, 0x87 }; +static const symbol s_0_91[3] = { 0xEF, 0xBB, 0x88 }; +static const symbol s_0_92[3] = { 0xEF, 0xBB, 0x89 }; +static const symbol s_0_93[3] = { 0xEF, 0xBB, 0x8A }; +static const symbol s_0_94[3] = { 0xEF, 0xBB, 0x8B }; +static const symbol s_0_95[3] = { 0xEF, 0xBB, 0x8C }; +static const symbol s_0_96[3] = { 0xEF, 0xBB, 0x8D }; +static const symbol s_0_97[3] = { 0xEF, 0xBB, 0x8E }; +static const symbol s_0_98[3] = { 0xEF, 0xBB, 0x8F }; +static const symbol s_0_99[3] = { 0xEF, 0xBB, 0x90 }; +static const symbol s_0_100[3] = { 0xEF, 0xBB, 0x91 }; +static const symbol s_0_101[3] = { 0xEF, 0xBB, 0x92 }; +static const symbol s_0_102[3] = { 0xEF, 0xBB, 0x93 }; +static const symbol s_0_103[3] = { 0xEF, 0xBB, 0x94 }; +static const symbol s_0_104[3] = { 0xEF, 0xBB, 0x95 }; +static const symbol s_0_105[3] = { 0xEF, 0xBB, 0x96 }; +static const symbol s_0_106[3] = { 0xEF, 0xBB, 0x97 }; +static const symbol s_0_107[3] = { 0xEF, 0xBB, 0x98 }; +static const symbol s_0_108[3] = { 0xEF, 0xBB, 0x99 }; +static const symbol s_0_109[3] = { 0xEF, 0xBB, 0x9A }; +static const symbol s_0_110[3] = { 0xEF, 0xBB, 0x9B }; +static const symbol s_0_111[3] = { 0xEF, 0xBB, 0x9C }; +static const symbol s_0_112[3] = { 0xEF, 0xBB, 0x9D }; +static const symbol s_0_113[3] = { 0xEF, 0xBB, 0x9E }; +static const symbol s_0_114[3] = { 0xEF, 0xBB, 0x9F }; +static const symbol s_0_115[3] = { 0xEF, 0xBB, 0xA0 }; +static const symbol s_0_116[3] = { 0xEF, 0xBB, 0xA1 }; +static const symbol s_0_117[3] = { 0xEF, 0xBB, 0xA2 }; +static const symbol s_0_118[3] = { 0xEF, 0xBB, 0xA3 }; +static const symbol s_0_119[3] = { 0xEF, 0xBB, 0xA4 }; +static const symbol s_0_120[3] = { 0xEF, 0xBB, 0xA5 }; +static const symbol s_0_121[3] = { 0xEF, 0xBB, 0xA6 }; +static const symbol s_0_122[3] = { 0xEF, 0xBB, 0xA7 }; +static const symbol s_0_123[3] = { 0xEF, 0xBB, 0xA8 }; +static const symbol s_0_124[3] = { 0xEF, 0xBB, 0xA9 }; +static const symbol s_0_125[3] = { 0xEF, 0xBB, 0xAA }; +static const symbol s_0_126[3] = { 0xEF, 0xBB, 0xAB }; +static const symbol s_0_127[3] = { 0xEF, 0xBB, 0xAC }; +static const symbol s_0_128[3] = { 0xEF, 0xBB, 0xAD }; +static const symbol s_0_129[3] = { 0xEF, 0xBB, 0xAE }; +static const symbol s_0_130[3] = { 0xEF, 0xBB, 0xAF }; +static const symbol s_0_131[3] = { 0xEF, 0xBB, 0xB0 }; +static const symbol s_0_132[3] = { 0xEF, 0xBB, 0xB1 }; +static const symbol s_0_133[3] = { 0xEF, 0xBB, 0xB2 }; +static const symbol s_0_134[3] = { 0xEF, 0xBB, 0xB3 }; +static const symbol s_0_135[3] = { 0xEF, 0xBB, 0xB4 }; +static const symbol s_0_136[3] = { 0xEF, 0xBB, 0xB5 }; +static const symbol s_0_137[3] = { 0xEF, 0xBB, 0xB6 }; +static const symbol s_0_138[3] = { 0xEF, 0xBB, 0xB7 }; +static const symbol s_0_139[3] = { 0xEF, 0xBB, 0xB8 }; +static const symbol s_0_140[3] = { 0xEF, 0xBB, 0xB9 }; +static const symbol s_0_141[3] = { 0xEF, 0xBB, 0xBA }; +static const symbol s_0_142[3] = { 0xEF, 0xBB, 0xBB }; +static const symbol s_0_143[3] = { 0xEF, 0xBB, 0xBC }; +static const struct among a_0[144] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 1, 0}, +{ 2, s_0_2, 0, 1, 0}, +{ 2, s_0_3, 0, 1, 0}, +{ 2, s_0_4, 0, 1, 0}, +{ 2, s_0_5, 0, 1, 0}, +{ 2, s_0_6, 0, 1, 0}, +{ 2, s_0_7, 0, 1, 0}, +{ 2, s_0_8, 0, 1, 0}, +{ 2, s_0_9, 0, 2, 0}, +{ 2, s_0_10, 0, 3, 0}, +{ 2, s_0_11, 0, 4, 0}, +{ 2, s_0_12, 0, 5, 0}, +{ 2, s_0_13, 0, 6, 0}, +{ 2, s_0_14, 0, 7, 0}, +{ 2, s_0_15, 0, 8, 0}, +{ 2, s_0_16, 0, 9, 0}, +{ 2, s_0_17, 0, 10, 0}, +{ 2, s_0_18, 0, 11, 0}, +{ 3, s_0_19, 0, 12, 0}, +{ 3, s_0_20, 0, 16, 0}, +{ 3, s_0_21, 0, 16, 0}, +{ 3, s_0_22, 0, 13, 0}, +{ 3, s_0_23, 0, 13, 0}, +{ 3, s_0_24, 0, 17, 0}, +{ 3, s_0_25, 0, 17, 0}, +{ 3, s_0_26, 0, 14, 0}, +{ 3, s_0_27, 0, 14, 0}, +{ 3, s_0_28, 0, 15, 0}, +{ 3, s_0_29, 0, 15, 0}, +{ 3, s_0_30, 0, 15, 0}, +{ 3, s_0_31, 0, 15, 0}, +{ 3, s_0_32, 0, 18, 0}, +{ 3, s_0_33, 0, 18, 0}, +{ 3, s_0_34, 0, 19, 0}, +{ 3, s_0_35, 0, 19, 0}, +{ 3, s_0_36, 0, 19, 0}, +{ 3, s_0_37, 0, 19, 0}, +{ 3, s_0_38, 0, 20, 0}, +{ 3, s_0_39, 0, 20, 0}, +{ 3, s_0_40, 0, 21, 0}, +{ 3, s_0_41, 0, 21, 0}, +{ 3, s_0_42, 0, 21, 0}, +{ 3, s_0_43, 0, 21, 0}, +{ 3, s_0_44, 0, 22, 0}, +{ 3, s_0_45, 0, 22, 0}, +{ 3, s_0_46, 0, 22, 0}, +{ 3, s_0_47, 0, 22, 0}, +{ 3, s_0_48, 0, 23, 0}, +{ 3, s_0_49, 0, 23, 0}, +{ 3, s_0_50, 0, 23, 0}, +{ 3, s_0_51, 0, 23, 0}, +{ 3, s_0_52, 0, 24, 0}, +{ 3, s_0_53, 0, 24, 0}, +{ 3, s_0_54, 0, 24, 0}, +{ 3, s_0_55, 0, 24, 0}, +{ 3, s_0_56, 0, 25, 0}, +{ 3, s_0_57, 0, 25, 0}, +{ 3, s_0_58, 0, 25, 0}, +{ 3, s_0_59, 0, 25, 0}, +{ 3, s_0_60, 0, 26, 0}, +{ 3, s_0_61, 0, 26, 0}, +{ 3, s_0_62, 0, 27, 0}, +{ 3, s_0_63, 0, 27, 0}, +{ 3, s_0_64, 0, 28, 0}, +{ 3, s_0_65, 0, 28, 0}, +{ 3, s_0_66, 0, 29, 0}, +{ 3, s_0_67, 0, 29, 0}, +{ 3, s_0_68, 0, 30, 0}, +{ 3, s_0_69, 0, 30, 0}, +{ 3, s_0_70, 0, 30, 0}, +{ 3, s_0_71, 0, 30, 0}, +{ 3, s_0_72, 0, 31, 0}, +{ 3, s_0_73, 0, 31, 0}, +{ 3, s_0_74, 0, 31, 0}, +{ 3, s_0_75, 0, 31, 0}, +{ 3, s_0_76, 0, 32, 0}, +{ 3, s_0_77, 0, 32, 0}, +{ 3, s_0_78, 0, 32, 0}, +{ 3, s_0_79, 0, 32, 0}, +{ 3, s_0_80, 0, 33, 0}, +{ 3, s_0_81, 0, 33, 0}, +{ 3, s_0_82, 0, 33, 0}, +{ 3, s_0_83, 0, 33, 0}, +{ 3, s_0_84, 0, 34, 0}, +{ 3, s_0_85, 0, 34, 0}, +{ 3, s_0_86, 0, 34, 0}, +{ 3, s_0_87, 0, 34, 0}, +{ 3, s_0_88, 0, 35, 0}, +{ 3, s_0_89, 0, 35, 0}, +{ 3, s_0_90, 0, 35, 0}, +{ 3, s_0_91, 0, 35, 0}, +{ 3, s_0_92, 0, 36, 0}, +{ 3, s_0_93, 0, 36, 0}, +{ 3, s_0_94, 0, 36, 0}, +{ 3, s_0_95, 0, 36, 0}, +{ 3, s_0_96, 0, 37, 0}, +{ 3, s_0_97, 0, 37, 0}, +{ 3, s_0_98, 0, 37, 0}, +{ 3, s_0_99, 0, 37, 0}, +{ 3, s_0_100, 0, 38, 0}, +{ 3, s_0_101, 0, 38, 0}, +{ 3, s_0_102, 0, 38, 0}, +{ 3, s_0_103, 0, 38, 0}, +{ 3, s_0_104, 0, 39, 0}, +{ 3, s_0_105, 0, 39, 0}, +{ 3, s_0_106, 0, 39, 0}, +{ 3, s_0_107, 0, 39, 0}, +{ 3, s_0_108, 0, 40, 0}, +{ 3, s_0_109, 0, 40, 0}, +{ 3, s_0_110, 0, 40, 0}, +{ 3, s_0_111, 0, 40, 0}, +{ 3, s_0_112, 0, 41, 0}, +{ 3, s_0_113, 0, 41, 0}, +{ 3, s_0_114, 0, 41, 0}, +{ 3, s_0_115, 0, 41, 0}, +{ 3, s_0_116, 0, 42, 0}, +{ 3, s_0_117, 0, 42, 0}, +{ 3, s_0_118, 0, 42, 0}, +{ 3, s_0_119, 0, 42, 0}, +{ 3, s_0_120, 0, 43, 0}, +{ 3, s_0_121, 0, 43, 0}, +{ 3, s_0_122, 0, 43, 0}, +{ 3, s_0_123, 0, 43, 0}, +{ 3, s_0_124, 0, 44, 0}, +{ 3, s_0_125, 0, 44, 0}, +{ 3, s_0_126, 0, 44, 0}, +{ 3, s_0_127, 0, 44, 0}, +{ 3, s_0_128, 0, 45, 0}, +{ 3, s_0_129, 0, 45, 0}, +{ 3, s_0_130, 0, 46, 0}, +{ 3, s_0_131, 0, 46, 0}, +{ 3, s_0_132, 0, 47, 0}, +{ 3, s_0_133, 0, 47, 0}, +{ 3, s_0_134, 0, 47, 0}, +{ 3, s_0_135, 0, 47, 0}, +{ 3, s_0_136, 0, 51, 0}, +{ 3, s_0_137, 0, 51, 0}, +{ 3, s_0_138, 0, 49, 0}, +{ 3, s_0_139, 0, 49, 0}, +{ 3, s_0_140, 0, 50, 0}, +{ 3, s_0_141, 0, 50, 0}, +{ 3, s_0_142, 0, 48, 0}, +{ 3, s_0_143, 0, 48, 0} +}; + +static const symbol s_1_0[2] = { 0xD8, 0xA2 }; +static const symbol s_1_1[2] = { 0xD8, 0xA3 }; +static const symbol s_1_2[2] = { 0xD8, 0xA4 }; +static const symbol s_1_3[2] = { 0xD8, 0xA5 }; +static const symbol s_1_4[2] = { 0xD8, 0xA6 }; +static const struct among a_1[5] = { +{ 2, s_1_0, 0, 1, 0}, +{ 2, s_1_1, 0, 1, 0}, +{ 2, s_1_2, 0, 1, 0}, +{ 2, s_1_3, 0, 1, 0}, +{ 2, s_1_4, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 0xD8, 0xA2 }; +static const symbol s_2_1[2] = { 0xD8, 0xA3 }; +static const symbol s_2_2[2] = { 0xD8, 0xA4 }; +static const symbol s_2_3[2] = { 0xD8, 0xA5 }; +static const symbol s_2_4[2] = { 0xD8, 0xA6 }; +static const struct among a_2[5] = { +{ 2, s_2_0, 0, 1, 0}, +{ 2, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 2, 0}, +{ 2, s_2_3, 0, 1, 0}, +{ 2, s_2_4, 0, 3, 0} +}; + +static const symbol s_3_0[4] = { 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_3_1[6] = { 0xD8, 0xA8, 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_3_2[6] = { 0xD9, 0x83, 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_3_3[4] = { 0xD9, 0x84, 0xD9, 0x84 }; +static const struct among a_3[4] = { +{ 4, s_3_0, 0, 2, 0}, +{ 6, s_3_1, 0, 1, 0}, +{ 6, s_3_2, 0, 1, 0}, +{ 4, s_3_3, 0, 2, 0} +}; + +static const symbol s_4_0[4] = { 0xD8, 0xA3, 0xD8, 0xA2 }; +static const symbol s_4_1[4] = { 0xD8, 0xA3, 0xD8, 0xA3 }; +static const symbol s_4_2[4] = { 0xD8, 0xA3, 0xD8, 0xA4 }; +static const symbol s_4_3[4] = { 0xD8, 0xA3, 0xD8, 0xA5 }; +static const symbol s_4_4[4] = { 0xD8, 0xA3, 0xD8, 0xA7 }; +static const struct among a_4[5] = { +{ 4, s_4_0, 0, 2, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 4, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 4, 0}, +{ 4, s_4_4, 0, 3, 0} +}; + +static const symbol s_5_0[2] = { 0xD9, 0x81 }; +static const symbol s_5_1[2] = { 0xD9, 0x88 }; +static const struct among a_5[2] = { +{ 2, s_5_0, 0, 1, 0}, +{ 2, s_5_1, 0, 1, 0} +}; + +static const symbol s_6_0[4] = { 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_6_1[6] = { 0xD8, 0xA8, 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_6_2[6] = { 0xD9, 0x83, 0xD8, 0xA7, 0xD9, 0x84 }; +static const symbol s_6_3[4] = { 0xD9, 0x84, 0xD9, 0x84 }; +static const struct among a_6[4] = { +{ 4, s_6_0, 0, 2, 0}, +{ 6, s_6_1, 0, 1, 0}, +{ 6, s_6_2, 0, 1, 0}, +{ 4, s_6_3, 0, 2, 0} +}; + +static const symbol s_7_0[2] = { 0xD8, 0xA8 }; +static const symbol s_7_1[4] = { 0xD8, 0xA8, 0xD8, 0xA7 }; +static const symbol s_7_2[4] = { 0xD8, 0xA8, 0xD8, 0xA8 }; +static const symbol s_7_3[4] = { 0xD9, 0x83, 0xD9, 0x83 }; +static const struct among a_7[4] = { +{ 2, s_7_0, 0, 1, 0}, +{ 4, s_7_1, -1, -1, 0}, +{ 4, s_7_2, -2, 2, 0}, +{ 4, s_7_3, 0, 3, 0} +}; + +static const symbol s_8_0[4] = { 0xD8, 0xB3, 0xD8, 0xA3 }; +static const symbol s_8_1[4] = { 0xD8, 0xB3, 0xD8, 0xAA }; +static const symbol s_8_2[4] = { 0xD8, 0xB3, 0xD9, 0x86 }; +static const symbol s_8_3[4] = { 0xD8, 0xB3, 0xD9, 0x8A }; +static const struct among a_8[4] = { +{ 4, s_8_0, 0, 4, 0}, +{ 4, s_8_1, 0, 2, 0}, +{ 4, s_8_2, 0, 3, 0}, +{ 4, s_8_3, 0, 1, 0} +}; + +static const symbol s_9_0[6] = { 0xD8, 0xAA, 0xD8, 0xB3, 0xD8, 0xAA }; +static const symbol s_9_1[6] = { 0xD9, 0x86, 0xD8, 0xB3, 0xD8, 0xAA }; +static const symbol s_9_2[6] = { 0xD9, 0x8A, 0xD8, 0xB3, 0xD8, 0xAA }; +static const struct among a_9[3] = { +{ 6, s_9_0, 0, 1, 0}, +{ 6, s_9_1, 0, 1, 0}, +{ 6, s_9_2, 0, 1, 0} +}; + +static const symbol s_10_0[2] = { 0xD9, 0x83 }; +static const symbol s_10_1[4] = { 0xD9, 0x83, 0xD9, 0x85 }; +static const symbol s_10_2[4] = { 0xD9, 0x87, 0xD9, 0x85 }; +static const symbol s_10_3[4] = { 0xD9, 0x87, 0xD9, 0x86 }; +static const symbol s_10_4[2] = { 0xD9, 0x87 }; +static const symbol s_10_5[2] = { 0xD9, 0x8A }; +static const symbol s_10_6[6] = { 0xD9, 0x83, 0xD9, 0x85, 0xD8, 0xA7 }; +static const symbol s_10_7[6] = { 0xD9, 0x87, 0xD9, 0x85, 0xD8, 0xA7 }; +static const symbol s_10_8[4] = { 0xD9, 0x86, 0xD8, 0xA7 }; +static const symbol s_10_9[4] = { 0xD9, 0x87, 0xD8, 0xA7 }; +static const struct among a_10[10] = { +{ 2, s_10_0, 0, 1, 0}, +{ 4, s_10_1, 0, 2, 0}, +{ 4, s_10_2, 0, 2, 0}, +{ 4, s_10_3, 0, 2, 0}, +{ 2, s_10_4, 0, 1, 0}, +{ 2, s_10_5, 0, 1, 0}, +{ 6, s_10_6, 0, 3, 0}, +{ 6, s_10_7, 0, 3, 0}, +{ 4, s_10_8, 0, 2, 0}, +{ 4, s_10_9, 0, 2, 0} +}; + +static const symbol s_11_0[2] = { 0xD9, 0x86 }; +static const struct among a_11[1] = { +{ 2, s_11_0, 0, 1, 0} +}; + +static const symbol s_12_0[2] = { 0xD9, 0x88 }; +static const symbol s_12_1[2] = { 0xD9, 0x8A }; +static const symbol s_12_2[2] = { 0xD8, 0xA7 }; +static const struct among a_12[3] = { +{ 2, s_12_0, 0, 1, 0}, +{ 2, s_12_1, 0, 1, 0}, +{ 2, s_12_2, 0, 1, 0} +}; + +static const symbol s_13_0[4] = { 0xD8, 0xA7, 0xD8, 0xAA }; +static const struct among a_13[1] = { +{ 4, s_13_0, 0, 1, 0} +}; + +static const symbol s_14_0[2] = { 0xD8, 0xAA }; +static const struct among a_14[1] = { +{ 2, s_14_0, 0, 1, 0} +}; + +static const symbol s_15_0[2] = { 0xD8, 0xA9 }; +static const struct among a_15[1] = { +{ 2, s_15_0, 0, 1, 0} +}; + +static const symbol s_16_0[2] = { 0xD9, 0x8A }; +static const struct among a_16[1] = { +{ 2, s_16_0, 0, 1, 0} +}; + +static const symbol s_17_0[2] = { 0xD9, 0x83 }; +static const symbol s_17_1[4] = { 0xD9, 0x83, 0xD9, 0x85 }; +static const symbol s_17_2[4] = { 0xD9, 0x87, 0xD9, 0x85 }; +static const symbol s_17_3[4] = { 0xD9, 0x83, 0xD9, 0x86 }; +static const symbol s_17_4[4] = { 0xD9, 0x87, 0xD9, 0x86 }; +static const symbol s_17_5[2] = { 0xD9, 0x87 }; +static const symbol s_17_6[6] = { 0xD9, 0x83, 0xD9, 0x85, 0xD9, 0x88 }; +static const symbol s_17_7[4] = { 0xD9, 0x86, 0xD9, 0x8A }; +static const symbol s_17_8[6] = { 0xD9, 0x83, 0xD9, 0x85, 0xD8, 0xA7 }; +static const symbol s_17_9[6] = { 0xD9, 0x87, 0xD9, 0x85, 0xD8, 0xA7 }; +static const symbol s_17_10[4] = { 0xD9, 0x86, 0xD8, 0xA7 }; +static const symbol s_17_11[4] = { 0xD9, 0x87, 0xD8, 0xA7 }; +static const struct among a_17[12] = { +{ 2, s_17_0, 0, 1, 0}, +{ 4, s_17_1, 0, 2, 0}, +{ 4, s_17_2, 0, 2, 0}, +{ 4, s_17_3, 0, 2, 0}, +{ 4, s_17_4, 0, 2, 0}, +{ 2, s_17_5, 0, 1, 0}, +{ 6, s_17_6, 0, 3, 0}, +{ 4, s_17_7, 0, 2, 0}, +{ 6, s_17_8, 0, 3, 0}, +{ 6, s_17_9, 0, 3, 0}, +{ 4, s_17_10, 0, 2, 0}, +{ 4, s_17_11, 0, 2, 0} +}; + +static const symbol s_18_0[2] = { 0xD9, 0x86 }; +static const symbol s_18_1[4] = { 0xD9, 0x88, 0xD9, 0x86 }; +static const symbol s_18_2[4] = { 0xD9, 0x8A, 0xD9, 0x86 }; +static const symbol s_18_3[4] = { 0xD8, 0xA7, 0xD9, 0x86 }; +static const symbol s_18_4[4] = { 0xD8, 0xAA, 0xD9, 0x86 }; +static const symbol s_18_5[2] = { 0xD9, 0x8A }; +static const symbol s_18_6[2] = { 0xD8, 0xA7 }; +static const symbol s_18_7[6] = { 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xA7 }; +static const symbol s_18_8[4] = { 0xD9, 0x86, 0xD8, 0xA7 }; +static const symbol s_18_9[4] = { 0xD8, 0xAA, 0xD8, 0xA7 }; +static const symbol s_18_10[2] = { 0xD8, 0xAA }; +static const struct among a_18[11] = { +{ 2, s_18_0, 0, 1, 0}, +{ 4, s_18_1, -1, 3, 0}, +{ 4, s_18_2, -2, 3, 0}, +{ 4, s_18_3, -3, 3, 0}, +{ 4, s_18_4, -4, 2, 0}, +{ 2, s_18_5, 0, 1, 0}, +{ 2, s_18_6, 0, 1, 0}, +{ 6, s_18_7, -1, 4, 0}, +{ 4, s_18_8, -2, 2, 0}, +{ 4, s_18_9, -3, 2, 0}, +{ 2, s_18_10, 0, 1, 0} +}; + +static const symbol s_19_0[4] = { 0xD8, 0xAA, 0xD9, 0x85 }; +static const symbol s_19_1[4] = { 0xD9, 0x88, 0xD8, 0xA7 }; +static const struct among a_19[2] = { +{ 4, s_19_0, 0, 1, 0}, +{ 4, s_19_1, 0, 1, 0} +}; + +static const symbol s_20_0[2] = { 0xD9, 0x88 }; +static const symbol s_20_1[6] = { 0xD8, 0xAA, 0xD9, 0x85, 0xD9, 0x88 }; +static const struct among a_20[2] = { +{ 2, s_20_0, 0, 1, 0}, +{ 6, s_20_1, -1, 2, 0} +}; + +static const symbol s_21_0[2] = { 0xD9, 0x89 }; +static const struct among a_21[1] = { +{ 2, s_21_0, 0, 1, 0} +}; + +static const symbol s_0[] = { '0' }; +static const symbol s_1[] = { '1' }; +static const symbol s_2[] = { '2' }; +static const symbol s_3[] = { '3' }; +static const symbol s_4[] = { '4' }; +static const symbol s_5[] = { '5' }; +static const symbol s_6[] = { '6' }; +static const symbol s_7[] = { '7' }; +static const symbol s_8[] = { '8' }; +static const symbol s_9[] = { '9' }; +static const symbol s_10[] = { 0xD8, 0xA1 }; +static const symbol s_11[] = { 0xD8, 0xA3 }; +static const symbol s_12[] = { 0xD8, 0xA5 }; +static const symbol s_13[] = { 0xD8, 0xA6 }; +static const symbol s_14[] = { 0xD8, 0xA2 }; +static const symbol s_15[] = { 0xD8, 0xA4 }; +static const symbol s_16[] = { 0xD8, 0xA7 }; +static const symbol s_17[] = { 0xD8, 0xA8 }; +static const symbol s_18[] = { 0xD8, 0xA9 }; +static const symbol s_19[] = { 0xD8, 0xAA }; +static const symbol s_20[] = { 0xD8, 0xAB }; +static const symbol s_21[] = { 0xD8, 0xAC }; +static const symbol s_22[] = { 0xD8, 0xAD }; +static const symbol s_23[] = { 0xD8, 0xAE }; +static const symbol s_24[] = { 0xD8, 0xAF }; +static const symbol s_25[] = { 0xD8, 0xB0 }; +static const symbol s_26[] = { 0xD8, 0xB1 }; +static const symbol s_27[] = { 0xD8, 0xB2 }; +static const symbol s_28[] = { 0xD8, 0xB3 }; +static const symbol s_29[] = { 0xD8, 0xB4 }; +static const symbol s_30[] = { 0xD8, 0xB5 }; +static const symbol s_31[] = { 0xD8, 0xB6 }; +static const symbol s_32[] = { 0xD8, 0xB7 }; +static const symbol s_33[] = { 0xD8, 0xB8 }; +static const symbol s_34[] = { 0xD8, 0xB9 }; +static const symbol s_35[] = { 0xD8, 0xBA }; +static const symbol s_36[] = { 0xD9, 0x81 }; +static const symbol s_37[] = { 0xD9, 0x82 }; +static const symbol s_38[] = { 0xD9, 0x83 }; +static const symbol s_39[] = { 0xD9, 0x84 }; +static const symbol s_40[] = { 0xD9, 0x85 }; +static const symbol s_41[] = { 0xD9, 0x86 }; +static const symbol s_42[] = { 0xD9, 0x87 }; +static const symbol s_43[] = { 0xD9, 0x88 }; +static const symbol s_44[] = { 0xD9, 0x89 }; +static const symbol s_45[] = { 0xD9, 0x8A }; +static const symbol s_46[] = { 0xD9, 0x84, 0xD8, 0xA7 }; +static const symbol s_47[] = { 0xD9, 0x84, 0xD8, 0xA3 }; +static const symbol s_48[] = { 0xD9, 0x84, 0xD8, 0xA5 }; +static const symbol s_49[] = { 0xD9, 0x84, 0xD8, 0xA2 }; +static const symbol s_50[] = { 0xD8, 0xA1 }; +static const symbol s_51[] = { 0xD8, 0xA7 }; +static const symbol s_52[] = { 0xD9, 0x88 }; +static const symbol s_53[] = { 0xD9, 0x8A }; +static const symbol s_54[] = { 0xD8, 0xA3 }; +static const symbol s_55[] = { 0xD8, 0xA2 }; +static const symbol s_56[] = { 0xD8, 0xA7 }; +static const symbol s_57[] = { 0xD8, 0xA5 }; +static const symbol s_58[] = { 0xD8, 0xA7 }; +static const symbol s_59[] = { 0xD8, 0xA8 }; +static const symbol s_60[] = { 0xD9, 0x83 }; +static const symbol s_61[] = { 0xD9, 0x8A }; +static const symbol s_62[] = { 0xD8, 0xAA }; +static const symbol s_63[] = { 0xD9, 0x86 }; +static const symbol s_64[] = { 0xD8, 0xA3 }; +static const symbol s_65[] = { 0xD8, 0xA7, 0xD8, 0xB3, 0xD8, 0xAA }; +static const symbol s_66[] = { 0xD9, 0x8A }; + +static int r_Normalize_pre(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + { + int v_3 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 144); + if (!among_var) goto lab3; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 2, s_11); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 2, s_12); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 2, s_13); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 2, s_15); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 2, s_16); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 2, s_17); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 2, s_19); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 2, s_20); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 2, s_21); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 2, s_22); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 2, s_23); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 2, s_24); + if (ret < 0) return ret; + } + break; + case 27: + { + int ret = slice_from_s(z, 2, s_25); + if (ret < 0) return ret; + } + break; + case 28: + { + int ret = slice_from_s(z, 2, s_26); + if (ret < 0) return ret; + } + break; + case 29: + { + int ret = slice_from_s(z, 2, s_27); + if (ret < 0) return ret; + } + break; + case 30: + { + int ret = slice_from_s(z, 2, s_28); + if (ret < 0) return ret; + } + break; + case 31: + { + int ret = slice_from_s(z, 2, s_29); + if (ret < 0) return ret; + } + break; + case 32: + { + int ret = slice_from_s(z, 2, s_30); + if (ret < 0) return ret; + } + break; + case 33: + { + int ret = slice_from_s(z, 2, s_31); + if (ret < 0) return ret; + } + break; + case 34: + { + int ret = slice_from_s(z, 2, s_32); + if (ret < 0) return ret; + } + break; + case 35: + { + int ret = slice_from_s(z, 2, s_33); + if (ret < 0) return ret; + } + break; + case 36: + { + int ret = slice_from_s(z, 2, s_34); + if (ret < 0) return ret; + } + break; + case 37: + { + int ret = slice_from_s(z, 2, s_35); + if (ret < 0) return ret; + } + break; + case 38: + { + int ret = slice_from_s(z, 2, s_36); + if (ret < 0) return ret; + } + break; + case 39: + { + int ret = slice_from_s(z, 2, s_37); + if (ret < 0) return ret; + } + break; + case 40: + { + int ret = slice_from_s(z, 2, s_38); + if (ret < 0) return ret; + } + break; + case 41: + { + int ret = slice_from_s(z, 2, s_39); + if (ret < 0) return ret; + } + break; + case 42: + { + int ret = slice_from_s(z, 2, s_40); + if (ret < 0) return ret; + } + break; + case 43: + { + int ret = slice_from_s(z, 2, s_41); + if (ret < 0) return ret; + } + break; + case 44: + { + int ret = slice_from_s(z, 2, s_42); + if (ret < 0) return ret; + } + break; + case 45: + { + int ret = slice_from_s(z, 2, s_43); + if (ret < 0) return ret; + } + break; + case 46: + { + int ret = slice_from_s(z, 2, s_44); + if (ret < 0) return ret; + } + break; + case 47: + { + int ret = slice_from_s(z, 2, s_45); + if (ret < 0) return ret; + } + break; + case 48: + { + int ret = slice_from_s(z, 4, s_46); + if (ret < 0) return ret; + } + break; + case 49: + { + int ret = slice_from_s(z, 4, s_47); + if (ret < 0) return ret; + } + break; + case 50: + { + int ret = slice_from_s(z, 4, s_48); + if (ret < 0) return ret; + } + break; + case 51: + { + int ret = slice_from_s(z, 4, s_49); + if (ret < 0) return ret; + } + break; + } + goto lab2; + lab3: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + lab2: + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + return 1; +} + +static int r_Normalize_post(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + z->lb = z->c; z->c = z->l; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 5 || !((124 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + if (!find_among_b(z, a_1, 5)) goto lab0; + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_50); + if (ret < 0) return ret; + } + z->c = z->lb; + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 5 || !((124 >> (z->p[z->c + 1] & 0x1f)) & 1)) goto lab4; + among_var = find_among(z, a_2, 5); + if (!among_var) goto lab4; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_51); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_52); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_53); + if (ret < 0) return ret; + } + break; + } + goto lab3; + lab4: + z->c = v_4; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + } + lab3: + continue; + lab2: + z->c = v_3; + break; + } + z->c = v_2; + } + return 1; +} + +static int r_Checks1(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 3 >= z->l || (z->p[z->c + 3] != 132 && z->p[z->c + 3] != 167)) return 0; + among_var = find_among(z, a_3, 4); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) <= 4) return 0; + z->I[2] = 1; + z->I[1] = 0; + z->I[0] = 1; + break; + case 2: + if (len_utf8(z->p) <= 3) return 0; + z->I[2] = 1; + z->I[1] = 0; + z->I[0] = 1; + break; + } + return 1; +} + +static int r_Prefix_Step1(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 3 >= z->l || z->p[z->c + 3] >> 5 != 5 || !((188 >> (z->p[z->c + 3] & 0x1f)) & 1)) return 0; + among_var = find_among(z, a_4, 5); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_54); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_55); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_56); + if (ret < 0) return ret; + } + break; + case 4: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_57); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Prefix_Step2(struct SN_env * z) { + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 129 && z->p[z->c + 1] != 136)) return 0; + if (!find_among(z, a_5, 2)) return 0; + z->ket = z->c; + if (len_utf8(z->p) <= 3) return 0; + { + int v_1 = z->c; + if (!(eq_s(z, 2, s_58))) goto lab0; + return 0; + lab0: + z->c = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Prefix_Step3a_Noun(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 3 >= z->l || (z->p[z->c + 3] != 132 && z->p[z->c + 3] != 167)) return 0; + among_var = find_among(z, a_6, 4); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) <= 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Prefix_Step3b_Noun(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 168 && z->p[z->c + 1] != 131)) return 0; + among_var = find_among(z, a_7, 4); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_59); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) <= 3) return 0; + { + int ret = slice_from_s(z, 2, s_60); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Prefix_Step3_Verb(struct SN_env * z) { + int among_var; + z->bra = z->c; + among_var = find_among(z, a_8, 4); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_from_s(z, 2, s_61); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_from_s(z, 2, s_62); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_from_s(z, 2, s_63); + if (ret < 0) return ret; + } + break; + case 4: + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_from_s(z, 2, s_64); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Prefix_Step4_Verb(struct SN_env * z) { + z->bra = z->c; + if (z->c + 5 >= z->l || z->p[z->c + 5] != 170) return 0; + if (!find_among(z, a_9, 3)) return 0; + z->ket = z->c; + if (len_utf8(z->p) <= 4) return 0; + z->I[1] = 1; + z->I[2] = 0; + { + int ret = slice_from_s(z, 6, s_65); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step1a(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_10, 10); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) < 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) < 6) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Suffix_Noun_Step1b(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 134) return 0; + if (!find_among_b(z, a_11, 1)) return 0; + z->bra = z->c; + if (len_utf8(z->p) <= 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step2a(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_12, 3)) return 0; + z->bra = z->c; + if (len_utf8(z->p) <= 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step2b(struct SN_env * z) { + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 170) return 0; + if (!find_among_b(z, a_13, 1)) return 0; + z->bra = z->c; + if (len_utf8(z->p) < 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step2c1(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 170) return 0; + if (!find_among_b(z, a_14, 1)) return 0; + z->bra = z->c; + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step2c2(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 169) return 0; + if (!find_among_b(z, a_15, 1)) return 0; + z->bra = z->c; + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Noun_Step3(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 138) return 0; + if (!find_among_b(z, a_16, 1)) return 0; + z->bra = z->c; + if (len_utf8(z->p) < 3) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Verb_Step1(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_17, 12); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) < 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) < 6) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Suffix_Verb_Step2a(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_18, 11); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) < 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + if (len_utf8(z->p) <= 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + if (len_utf8(z->p) < 6) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Suffix_Verb_Step2b(struct SN_env * z) { + z->ket = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 133 && z->p[z->c - 1] != 167)) return 0; + if (!find_among_b(z, a_19, 2)) return 0; + z->bra = z->c; + if (len_utf8(z->p) < 5) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Suffix_Verb_Step2c(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 136) return 0; + among_var = find_among_b(z, a_20, 2); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + if (len_utf8(z->p) < 4) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (len_utf8(z->p) < 6) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Suffix_All_alef_maqsura(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 137) return 0; + if (!find_among_b(z, a_21, 1)) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_66); + if (ret < 0) return ret; + } + return 1; +} + +extern int arabic_UTF_8_stem(struct SN_env * z) { + z->I[2] = 1; + z->I[1] = 1; + z->I[0] = 0; + { + int v_1 = z->c; + { + int ret = r_Checks1(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_Normalize_pre(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (!(z->I[1])) goto lab2; + { + int v_4 = z->l - z->c; + { + int v_5 = 1; + while (1) { + int v_6 = z->l - z->c; + { + int ret = r_Suffix_Verb_Step1(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + v_5--; + continue; + lab5: + z->c = z->l - v_6; + break; + } + if (v_5 > 0) goto lab4; + } + { + int v_7 = z->l - z->c; + { + int ret = r_Suffix_Verb_Step2a(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + goto lab6; + lab7: + z->c = z->l - v_7; + { + int ret = r_Suffix_Verb_Step2c(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + goto lab6; + lab8: + z->c = z->l - v_7; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab4; + z->c = ret; + } + } + lab6: + goto lab3; + lab4: + z->c = z->l - v_4; + { + int ret = r_Suffix_Verb_Step2b(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + goto lab3; + lab9: + z->c = z->l - v_4; + { + int ret = r_Suffix_Verb_Step2a(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + } + lab3: + goto lab1; + lab2: + z->c = z->l - v_3; + if (!(z->I[2])) goto lab10; + { + int v_8 = z->l - z->c; + { + int v_9 = z->l - z->c; + { + int ret = r_Suffix_Noun_Step2c2(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - v_9; + if (!(z->I[0])) goto lab15; + goto lab14; + lab15: + { + int ret = r_Suffix_Noun_Step1a(z); + if (ret == 0) goto lab14; + if (ret < 0) return ret; + } + { + int v_10 = z->l - z->c; + { + int ret = r_Suffix_Noun_Step2a(z); + if (ret == 0) goto lab17; + if (ret < 0) return ret; + } + goto lab16; + lab17: + z->c = z->l - v_10; + { + int ret = r_Suffix_Noun_Step2b(z); + if (ret == 0) goto lab18; + if (ret < 0) return ret; + } + goto lab16; + lab18: + z->c = z->l - v_10; + { + int ret = r_Suffix_Noun_Step2c1(z); + if (ret == 0) goto lab19; + if (ret < 0) return ret; + } + goto lab16; + lab19: + z->c = z->l - v_10; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab14; + z->c = ret; + } + } + lab16: + goto lab12; + lab14: + z->c = z->l - v_9; + { + int ret = r_Suffix_Noun_Step1b(z); + if (ret == 0) goto lab20; + if (ret < 0) return ret; + } + { + int v_11 = z->l - z->c; + { + int ret = r_Suffix_Noun_Step2a(z); + if (ret == 0) goto lab22; + if (ret < 0) return ret; + } + goto lab21; + lab22: + z->c = z->l - v_11; + { + int ret = r_Suffix_Noun_Step2b(z); + if (ret == 0) goto lab23; + if (ret < 0) return ret; + } + goto lab21; + lab23: + z->c = z->l - v_11; + { + int ret = r_Suffix_Noun_Step2c1(z); + if (ret == 0) goto lab20; + if (ret < 0) return ret; + } + } + lab21: + goto lab12; + lab20: + z->c = z->l - v_9; + if (!(z->I[0])) goto lab25; + goto lab24; + lab25: + { + int ret = r_Suffix_Noun_Step2a(z); + if (ret == 0) goto lab24; + if (ret < 0) return ret; + } + goto lab12; + lab24: + z->c = z->l - v_9; + { + int ret = r_Suffix_Noun_Step2b(z); + if (ret == 0) { z->c = z->l - v_8; goto lab11; } + if (ret < 0) return ret; + } + } + lab12: + lab11: + ; + } + { + int ret = r_Suffix_Noun_Step3(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + goto lab1; + lab10: + z->c = z->l - v_3; + { + int ret = r_Suffix_All_alef_maqsura(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + z->c = z->lb; + { + int v_12 = z->c; + { + int v_13 = z->c; + { + int ret = r_Prefix_Step1(z); + if (ret == 0) { z->c = v_13; goto lab27; } + if (ret < 0) return ret; + } + lab27: + ; + } + { + int v_14 = z->c; + { + int ret = r_Prefix_Step2(z); + if (ret == 0) { z->c = v_14; goto lab28; } + if (ret < 0) return ret; + } + lab28: + ; + } + { + int v_15 = z->c; + { + int ret = r_Prefix_Step3a_Noun(z); + if (ret == 0) goto lab30; + if (ret < 0) return ret; + } + goto lab29; + lab30: + z->c = v_15; + if (!(z->I[2])) goto lab31; + { + int ret = r_Prefix_Step3b_Noun(z); + if (ret == 0) goto lab31; + if (ret < 0) return ret; + } + goto lab29; + lab31: + z->c = v_15; + if (!(z->I[1])) goto lab26; + { + int v_16 = z->c; + { + int ret = r_Prefix_Step3_Verb(z); + if (ret == 0) { z->c = v_16; goto lab32; } + if (ret < 0) return ret; + } + lab32: + ; + } + { + int ret = r_Prefix_Step4_Verb(z); + if (ret == 0) goto lab26; + if (ret < 0) return ret; + } + } + lab29: + lab26: + z->c = v_12; + } + { + int ret = r_Normalize_post(z); + if (ret < 0) return ret; + } + return 1; +} + +extern struct SN_env * arabic_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void arabic_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_arabic.h b/contrib/libs/snowball/src_c/stem_UTF_8_arabic.h new file mode 100644 index 000000000000..8a0e15d9cfdf --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_arabic.h @@ -0,0 +1,15 @@ +/* Generated from arabic.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * arabic_UTF_8_create_env(void); +extern void arabic_UTF_8_close_env(struct SN_env * z); + +extern int arabic_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_armenian.c b/contrib/libs/snowball/src_c/stem_UTF_8_armenian.c new file mode 100644 index 000000000000..f7da03629f3f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_armenian.c @@ -0,0 +1,564 @@ +/* Generated from armenian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int armenian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_ending(struct SN_env * z); +static int r_noun(struct SN_env * z); +static int r_verb(struct SN_env * z); +static int r_adjective(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * armenian_UTF_8_create_env(void); +extern void armenian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[6] = { 0xD5, 0xA2, 0xD5, 0xA1, 0xD6, 0x80 }; +static const symbol s_0_1[8] = { 0xD6, 0x80, 0xD5, 0xB8, 0xD6, 0x80, 0xD5, 0xA4 }; +static const symbol s_0_2[10] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB8, 0xD6, 0x80, 0xD5, 0xA4 }; +static const symbol s_0_3[6] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xAB }; +static const symbol s_0_4[6] = { 0xD5, 0xA1, 0xD5, 0xAF, 0xD5, 0xAB }; +static const symbol s_0_5[8] = { 0xD5, 0xB8, 0xD6, 0x80, 0xD5, 0xA1, 0xD5, 0xAF }; +static const symbol s_0_6[4] = { 0xD5, 0xA5, 0xD5, 0xB2 }; +static const symbol s_0_7[8] = { 0xD5, 0xBE, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6 }; +static const symbol s_0_8[8] = { 0xD5, 0xA1, 0xD6, 0x80, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_0_9[8] = { 0xD5, 0xA1, 0xD5, 0xAF, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_0_10[4] = { 0xD5, 0xA5, 0xD5, 0xB6 }; +static const symbol s_0_11[8] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xA5, 0xD5, 0xB6 }; +static const symbol s_0_12[8] = { 0xD5, 0xA5, 0xD5, 0xAF, 0xD5, 0xA5, 0xD5, 0xB6 }; +static const symbol s_0_13[8] = { 0xD5, 0xB8, 0xD6, 0x80, 0xD5, 0xA7, 0xD5, 0xB6 }; +static const symbol s_0_14[4] = { 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_0_15[6] = { 0xD5, 0xA3, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_0_16[8] = { 0xD5, 0xB8, 0xD5, 0xBE, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_0_17[8] = { 0xD5, 0xAC, 0xD5, 0xA1, 0xD5, 0xB5, 0xD5, 0xB6 }; +static const symbol s_0_18[6] = { 0xD5, 0xBA, 0xD5, 0xA5, 0xD5, 0xBD }; +static const symbol s_0_19[4] = { 0xD5, 0xAB, 0xD5, 0xBE }; +static const symbol s_0_20[4] = { 0xD5, 0xA1, 0xD5, 0xBF }; +static const symbol s_0_21[8] = { 0xD5, 0xA1, 0xD5, 0xBE, 0xD5, 0xA5, 0xD5, 0xBF }; +static const symbol s_0_22[6] = { 0xD5, 0xAF, 0xD5, 0xB8, 0xD5, 0xBF }; +static const struct among a_0[23] = { +{ 6, s_0_0, 0, 1, 0}, +{ 8, s_0_1, 0, 1, 0}, +{ 10, s_0_2, -1, 1, 0}, +{ 6, s_0_3, 0, 1, 0}, +{ 6, s_0_4, 0, 1, 0}, +{ 8, s_0_5, 0, 1, 0}, +{ 4, s_0_6, 0, 1, 0}, +{ 8, s_0_7, 0, 1, 0}, +{ 8, s_0_8, 0, 1, 0}, +{ 8, s_0_9, 0, 1, 0}, +{ 4, s_0_10, 0, 1, 0}, +{ 8, s_0_11, -1, 1, 0}, +{ 8, s_0_12, -2, 1, 0}, +{ 8, s_0_13, 0, 1, 0}, +{ 4, s_0_14, 0, 1, 0}, +{ 6, s_0_15, -1, 1, 0}, +{ 8, s_0_16, -2, 1, 0}, +{ 8, s_0_17, 0, 1, 0}, +{ 6, s_0_18, 0, 1, 0}, +{ 4, s_0_19, 0, 1, 0}, +{ 4, s_0_20, 0, 1, 0}, +{ 8, s_0_21, 0, 1, 0}, +{ 6, s_0_22, 0, 1, 0} +}; + +static const symbol s_1_0[4] = { 0xD5, 0xA1, 0xD6, 0x80 }; +static const symbol s_1_1[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1, 0xD6, 0x80 }; +static const symbol s_1_2[8] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xA1, 0xD6, 0x80 }; +static const symbol s_1_3[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xAB, 0xD6, 0x80 }; +static const symbol s_1_4[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x80 }; +static const symbol s_1_5[8] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x80 }; +static const symbol s_1_6[10] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x80 }; +static const symbol s_1_7[10] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xB8, 0xD6, 0x82, 0xD6, 0x81 }; +static const symbol s_1_8[10] = { 0xD5, 0xA5, 0xD5, 0xAC, 0xD5, 0xB8, 0xD6, 0x82, 0xD6, 0x81 }; +static const symbol s_1_9[4] = { 0xD5, 0xA1, 0xD6, 0x81 }; +static const symbol s_1_10[4] = { 0xD5, 0xA5, 0xD6, 0x81 }; +static const symbol s_1_11[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xA5, 0xD6, 0x81 }; +static const symbol s_1_12[8] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xB8, 0xD6, 0x82 }; +static const symbol s_1_13[8] = { 0xD5, 0xA5, 0xD5, 0xAC, 0xD5, 0xB8, 0xD6, 0x82 }; +static const symbol s_1_14[4] = { 0xD5, 0xA1, 0xD6, 0x84 }; +static const symbol s_1_15[6] = { 0xD6, 0x81, 0xD5, 0xA1, 0xD6, 0x84 }; +static const symbol s_1_16[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1, 0xD6, 0x84 }; +static const symbol s_1_17[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_1_18[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_1_19[8] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_1_20[10] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_1_21[6] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_22[8] = { 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_23[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_24[12] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xAB, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_25[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_26[10] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_27[12] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_1_28[2] = { 0xD5, 0xA1 }; +static const symbol s_1_29[6] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1 }; +static const symbol s_1_30[6] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xA1 }; +static const symbol s_1_31[4] = { 0xD5, 0xBE, 0xD5, 0xA5 }; +static const symbol s_1_32[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xAB }; +static const symbol s_1_33[6] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xAB }; +static const symbol s_1_34[6] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB }; +static const symbol s_1_35[8] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB }; +static const symbol s_1_36[4] = { 0xD5, 0xA1, 0xD5, 0xAC }; +static const symbol s_1_37[6] = { 0xD5, 0xA8, 0xD5, 0xA1, 0xD5, 0xAC }; +static const symbol s_1_38[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xB6, 0xD5, 0xA1, 0xD5, 0xAC }; +static const symbol s_1_39[8] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA1, 0xD5, 0xAC }; +static const symbol s_1_40[8] = { 0xD5, 0xA5, 0xD5, 0xB6, 0xD5, 0xA1, 0xD5, 0xAC }; +static const symbol s_1_41[4] = { 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_42[6] = { 0xD5, 0xA8, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_43[6] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_44[8] = { 0xD6, 0x81, 0xD5, 0xB6, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_45[10] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xB6, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_46[6] = { 0xD5, 0xB9, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_47[6] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_48[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xBE, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_49[10] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xBE, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_50[6] = { 0xD5, 0xBF, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_51[8] = { 0xD5, 0xA1, 0xD5, 0xBF, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_52[8] = { 0xD5, 0xB8, 0xD5, 0xBF, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_53[10] = { 0xD5, 0xAF, 0xD5, 0xB8, 0xD5, 0xBF, 0xD5, 0xA5, 0xD5, 0xAC }; +static const symbol s_1_54[6] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xAE }; +static const symbol s_1_55[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB4 }; +static const symbol s_1_56[8] = { 0xD5, 0xBE, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB4 }; +static const symbol s_1_57[4] = { 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_1_58[6] = { 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_1_59[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_1_60[10] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD6, 0x80, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_1_61[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_1_62[8] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_1_63[10] = { 0xD5, 0xBE, 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_1_64[8] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xAB, 0xD5, 0xBD }; +static const symbol s_1_65[8] = { 0xD5, 0xA5, 0xD5, 0xAC, 0xD5, 0xAB, 0xD5, 0xBD }; +static const symbol s_1_66[4] = { 0xD5, 0xA1, 0xD5, 0xBE }; +static const symbol s_1_67[8] = { 0xD5, 0xA1, 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xBE }; +static const symbol s_1_68[8] = { 0xD5, 0xA5, 0xD6, 0x81, 0xD5, 0xA1, 0xD5, 0xBE }; +static const symbol s_1_69[8] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xB8, 0xD5, 0xBE }; +static const symbol s_1_70[8] = { 0xD5, 0xA5, 0xD5, 0xAC, 0xD5, 0xB8, 0xD5, 0xBE }; +static const struct among a_1[71] = { +{ 4, s_1_0, 0, 1, 0}, +{ 8, s_1_1, -1, 1, 0}, +{ 8, s_1_2, -2, 1, 0}, +{ 10, s_1_3, 0, 1, 0}, +{ 8, s_1_4, 0, 1, 0}, +{ 8, s_1_5, 0, 1, 0}, +{ 10, s_1_6, -1, 1, 0}, +{ 10, s_1_7, 0, 1, 0}, +{ 10, s_1_8, 0, 1, 0}, +{ 4, s_1_9, 0, 1, 0}, +{ 4, s_1_10, 0, 1, 0}, +{ 10, s_1_11, -1, 1, 0}, +{ 8, s_1_12, 0, 1, 0}, +{ 8, s_1_13, 0, 1, 0}, +{ 4, s_1_14, 0, 1, 0}, +{ 6, s_1_15, -1, 1, 0}, +{ 8, s_1_16, -1, 1, 0}, +{ 10, s_1_17, 0, 1, 0}, +{ 8, s_1_18, 0, 1, 0}, +{ 8, s_1_19, 0, 1, 0}, +{ 10, s_1_20, -1, 1, 0}, +{ 6, s_1_21, 0, 1, 0}, +{ 8, s_1_22, -1, 1, 0}, +{ 10, s_1_23, -1, 1, 0}, +{ 12, s_1_24, 0, 1, 0}, +{ 10, s_1_25, 0, 1, 0}, +{ 10, s_1_26, 0, 1, 0}, +{ 12, s_1_27, -1, 1, 0}, +{ 2, s_1_28, 0, 1, 0}, +{ 6, s_1_29, -1, 1, 0}, +{ 6, s_1_30, -2, 1, 0}, +{ 4, s_1_31, 0, 1, 0}, +{ 8, s_1_32, 0, 1, 0}, +{ 6, s_1_33, 0, 1, 0}, +{ 6, s_1_34, 0, 1, 0}, +{ 8, s_1_35, -1, 1, 0}, +{ 4, s_1_36, 0, 1, 0}, +{ 6, s_1_37, -1, 1, 0}, +{ 10, s_1_38, -2, 1, 0}, +{ 8, s_1_39, -3, 1, 0}, +{ 8, s_1_40, -4, 1, 0}, +{ 4, s_1_41, 0, 1, 0}, +{ 6, s_1_42, -1, 1, 0}, +{ 6, s_1_43, -2, 1, 0}, +{ 8, s_1_44, -1, 1, 0}, +{ 10, s_1_45, -1, 1, 0}, +{ 6, s_1_46, -5, 1, 0}, +{ 6, s_1_47, -6, 1, 0}, +{ 10, s_1_48, -1, 1, 0}, +{ 10, s_1_49, -2, 1, 0}, +{ 6, s_1_50, -9, 1, 0}, +{ 8, s_1_51, -1, 1, 0}, +{ 8, s_1_52, -2, 1, 0}, +{ 10, s_1_53, -1, 1, 0}, +{ 6, s_1_54, 0, 1, 0}, +{ 6, s_1_55, 0, 1, 0}, +{ 8, s_1_56, -1, 1, 0}, +{ 4, s_1_57, 0, 1, 0}, +{ 6, s_1_58, -1, 1, 0}, +{ 8, s_1_59, -1, 1, 0}, +{ 10, s_1_60, 0, 1, 0}, +{ 8, s_1_61, 0, 1, 0}, +{ 8, s_1_62, 0, 1, 0}, +{ 10, s_1_63, -1, 1, 0}, +{ 8, s_1_64, 0, 1, 0}, +{ 8, s_1_65, 0, 1, 0}, +{ 4, s_1_66, 0, 1, 0}, +{ 8, s_1_67, -1, 1, 0}, +{ 8, s_1_68, -2, 1, 0}, +{ 8, s_1_69, 0, 1, 0}, +{ 8, s_1_70, 0, 1, 0} +}; + +static const symbol s_2_0[6] = { 0xD5, 0xA3, 0xD5, 0xA1, 0xD6, 0x80 }; +static const symbol s_2_1[6] = { 0xD5, 0xBE, 0xD5, 0xB8, 0xD6, 0x80 }; +static const symbol s_2_2[8] = { 0xD5, 0xA1, 0xD5, 0xBE, 0xD5, 0xB8, 0xD6, 0x80 }; +static const symbol s_2_3[8] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD6, 0x85, 0xD6, 0x81 }; +static const symbol s_2_4[4] = { 0xD5, 0xB8, 0xD6, 0x81 }; +static const symbol s_2_5[4] = { 0xD5, 0xB8, 0xD6, 0x82 }; +static const symbol s_2_6[2] = { 0xD6, 0x84 }; +static const symbol s_2_7[6] = { 0xD5, 0xA1, 0xD6, 0x80, 0xD6, 0x84 }; +static const symbol s_2_8[6] = { 0xD5, 0xB9, 0xD5, 0xA5, 0xD6, 0x84 }; +static const symbol s_2_9[4] = { 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_2_10[8] = { 0xD5, 0xA1, 0xD5, 0xAC, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_2_11[8] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xAB, 0xD6, 0x84 }; +static const symbol s_2_12[8] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xAE, 0xD6, 0x84 }; +static const symbol s_2_13[8] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB5, 0xD6, 0x84 }; +static const symbol s_2_14[8] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_2_15[10] = { 0xD5, 0xB4, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_2_16[6] = { 0xD5, 0xA5, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_2_17[6] = { 0xD5, 0xB8, 0xD5, 0xB6, 0xD6, 0x84 }; +static const symbol s_2_18[6] = { 0xD5, 0xAB, 0xD5, 0xB9, 0xD6, 0x84 }; +static const symbol s_2_19[6] = { 0xD5, 0xB8, 0xD6, 0x80, 0xD5, 0xA4 }; +static const symbol s_2_20[8] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB5, 0xD5, 0xA9 }; +static const symbol s_2_21[4] = { 0xD6, 0x81, 0xD5, 0xAB }; +static const symbol s_2_22[8] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB0, 0xD5, 0xAB }; +static const symbol s_2_23[4] = { 0xD5, 0xAB, 0xD5, 0xAC }; +static const symbol s_2_24[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xAF }; +static const symbol s_2_25[4] = { 0xD5, 0xA1, 0xD5, 0xAF }; +static const symbol s_2_26[6] = { 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xAF }; +static const symbol s_2_27[8] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA1, 0xD5, 0xAF }; +static const symbol s_2_28[4] = { 0xD5, 0xAB, 0xD5, 0xAF }; +static const symbol s_2_29[8] = { 0xD5, 0xB5, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6 }; +static const symbol s_2_30[14] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6 }; +static const symbol s_2_31[4] = { 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_2_32[8] = { 0xD5, 0xA1, 0xD6, 0x80, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_2_33[6] = { 0xD5, 0xBA, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_2_34[8] = { 0xD5, 0xBD, 0xD5, 0xBF, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_2_35[8] = { 0xD5, 0xA5, 0xD5, 0xB2, 0xD5, 0xA7, 0xD5, 0xB6 }; +static const symbol s_2_36[6] = { 0xD5, 0xA1, 0xD5, 0xAE, 0xD5, 0xB8 }; +static const symbol s_2_37[4] = { 0xD5, 0xAB, 0xD5, 0xB9 }; +static const symbol s_2_38[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xBD }; +static const symbol s_2_39[8] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xBD, 0xD5, 0xBF }; +static const struct among a_2[40] = { +{ 6, s_2_0, 0, 1, 0}, +{ 6, s_2_1, 0, 1, 0}, +{ 8, s_2_2, -1, 1, 0}, +{ 8, s_2_3, 0, 1, 0}, +{ 4, s_2_4, 0, 1, 0}, +{ 4, s_2_5, 0, 1, 0}, +{ 2, s_2_6, 0, 1, 0}, +{ 6, s_2_7, -1, 1, 0}, +{ 6, s_2_8, -2, 1, 0}, +{ 4, s_2_9, -3, 1, 0}, +{ 8, s_2_10, -1, 1, 0}, +{ 8, s_2_11, -2, 1, 0}, +{ 8, s_2_12, -6, 1, 0}, +{ 8, s_2_13, -7, 1, 0}, +{ 8, s_2_14, -8, 1, 0}, +{ 10, s_2_15, -1, 1, 0}, +{ 6, s_2_16, -10, 1, 0}, +{ 6, s_2_17, -11, 1, 0}, +{ 6, s_2_18, -12, 1, 0}, +{ 6, s_2_19, 0, 1, 0}, +{ 8, s_2_20, 0, 1, 0}, +{ 4, s_2_21, 0, 1, 0}, +{ 8, s_2_22, 0, 1, 0}, +{ 4, s_2_23, 0, 1, 0}, +{ 6, s_2_24, 0, 1, 0}, +{ 4, s_2_25, 0, 1, 0}, +{ 6, s_2_26, -1, 1, 0}, +{ 8, s_2_27, -2, 1, 0}, +{ 4, s_2_28, 0, 1, 0}, +{ 8, s_2_29, 0, 1, 0}, +{ 14, s_2_30, -1, 1, 0}, +{ 4, s_2_31, 0, 1, 0}, +{ 8, s_2_32, -1, 1, 0}, +{ 6, s_2_33, -2, 1, 0}, +{ 8, s_2_34, -3, 1, 0}, +{ 8, s_2_35, 0, 1, 0}, +{ 6, s_2_36, 0, 1, 0}, +{ 4, s_2_37, 0, 1, 0}, +{ 6, s_2_38, 0, 1, 0}, +{ 8, s_2_39, 0, 1, 0} +}; + +static const symbol s_3_0[4] = { 0xD5, 0xA5, 0xD6, 0x80 }; +static const symbol s_3_1[6] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80 }; +static const symbol s_3_2[2] = { 0xD6, 0x81 }; +static const symbol s_3_3[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD6, 0x81 }; +static const symbol s_3_4[4] = { 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_5[8] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_6[10] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_7[6] = { 0xD6, 0x81, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_8[10] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_9[8] = { 0xD5, 0xB8, 0xD5, 0xBB, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_10[6] = { 0xD5, 0xBE, 0xD5, 0xAB, 0xD6, 0x81 }; +static const symbol s_3_11[4] = { 0xD5, 0xB8, 0xD6, 0x81 }; +static const symbol s_3_12[4] = { 0xD5, 0xBD, 0xD5, 0xA1 }; +static const symbol s_3_13[4] = { 0xD5, 0xBE, 0xD5, 0xA1 }; +static const symbol s_3_14[6] = { 0xD5, 0xA1, 0xD5, 0xB4, 0xD5, 0xA2 }; +static const symbol s_3_15[2] = { 0xD5, 0xA4 }; +static const symbol s_3_16[6] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xA4 }; +static const symbol s_3_17[8] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xA4 }; +static const symbol s_3_18[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA4 }; +static const symbol s_3_19[6] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA4 }; +static const symbol s_3_20[14] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA4 }; +static const symbol s_3_21[8] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA4 }; +static const symbol s_3_22[6] = { 0xD5, 0xB8, 0xD5, 0xBB, 0xD5, 0xA4 }; +static const symbol s_3_23[2] = { 0xD5, 0xA8 }; +static const symbol s_3_24[6] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xA8 }; +static const symbol s_3_25[8] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xA8 }; +static const symbol s_3_26[6] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA8 }; +static const symbol s_3_27[14] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA8 }; +static const symbol s_3_28[8] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xA8 }; +static const symbol s_3_29[6] = { 0xD5, 0xB8, 0xD5, 0xBB, 0xD5, 0xA8 }; +static const symbol s_3_30[2] = { 0xD5, 0xAB }; +static const symbol s_3_31[6] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB }; +static const symbol s_3_32[8] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB }; +static const symbol s_3_33[4] = { 0xD5, 0xBE, 0xD5, 0xAB }; +static const symbol s_3_34[10] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB4 }; +static const symbol s_3_35[12] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB4 }; +static const symbol s_3_36[10] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB4 }; +static const symbol s_3_37[2] = { 0xD5, 0xB6 }; +static const symbol s_3_38[6] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB6 }; +static const symbol s_3_39[8] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB6 }; +static const symbol s_3_40[6] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xB6 }; +static const symbol s_3_41[4] = { 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_3_42[12] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_3_43[6] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xB6 }; +static const symbol s_3_44[4] = { 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_3_45[8] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_3_46[10] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xAB, 0xD5, 0xB6 }; +static const symbol s_3_47[14] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xB6 }; +static const symbol s_3_48[4] = { 0xD5, 0xB8, 0xD5, 0xBB }; +static const symbol s_3_49[14] = { 0xD5, 0xB8, 0xD6, 0x82, 0xD5, 0xA9, 0xD5, 0xB5, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xBD }; +static const symbol s_3_50[8] = { 0xD5, 0xBE, 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xBD }; +static const symbol s_3_51[6] = { 0xD5, 0xB8, 0xD5, 0xBB, 0xD5, 0xBD }; +static const symbol s_3_52[4] = { 0xD5, 0xB8, 0xD5, 0xBE }; +static const symbol s_3_53[8] = { 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB8, 0xD5, 0xBE }; +static const symbol s_3_54[10] = { 0xD5, 0xB6, 0xD5, 0xA5, 0xD6, 0x80, 0xD5, 0xB8, 0xD5, 0xBE }; +static const symbol s_3_55[8] = { 0xD5, 0xA1, 0xD5, 0xB6, 0xD5, 0xB8, 0xD5, 0xBE }; +static const symbol s_3_56[6] = { 0xD5, 0xBE, 0xD5, 0xB8, 0xD5, 0xBE }; +static const struct among a_3[57] = { +{ 4, s_3_0, 0, 1, 0}, +{ 6, s_3_1, -1, 1, 0}, +{ 2, s_3_2, 0, 1, 0}, +{ 6, s_3_3, -1, 1, 0}, +{ 4, s_3_4, -2, 1, 0}, +{ 8, s_3_5, -1, 1, 0}, +{ 10, s_3_6, -1, 1, 0}, +{ 6, s_3_7, -3, 1, 0}, +{ 10, s_3_8, -4, 1, 0}, +{ 8, s_3_9, -5, 1, 0}, +{ 6, s_3_10, -6, 1, 0}, +{ 4, s_3_11, -9, 1, 0}, +{ 4, s_3_12, 0, 1, 0}, +{ 4, s_3_13, 0, 1, 0}, +{ 6, s_3_14, 0, 1, 0}, +{ 2, s_3_15, 0, 1, 0}, +{ 6, s_3_16, -1, 1, 0}, +{ 8, s_3_17, -1, 1, 0}, +{ 6, s_3_18, -3, 1, 0}, +{ 6, s_3_19, -4, 1, 0}, +{ 14, s_3_20, -1, 1, 0}, +{ 8, s_3_21, -2, 1, 0}, +{ 6, s_3_22, -7, 1, 0}, +{ 2, s_3_23, 0, 1, 0}, +{ 6, s_3_24, -1, 1, 0}, +{ 8, s_3_25, -1, 1, 0}, +{ 6, s_3_26, -3, 1, 0}, +{ 14, s_3_27, -1, 1, 0}, +{ 8, s_3_28, -2, 1, 0}, +{ 6, s_3_29, -6, 1, 0}, +{ 2, s_3_30, 0, 1, 0}, +{ 6, s_3_31, -1, 1, 0}, +{ 8, s_3_32, -1, 1, 0}, +{ 4, s_3_33, -3, 1, 0}, +{ 10, s_3_34, 0, 1, 0}, +{ 12, s_3_35, -1, 1, 0}, +{ 10, s_3_36, 0, 1, 0}, +{ 2, s_3_37, 0, 1, 0}, +{ 6, s_3_38, -1, 1, 0}, +{ 8, s_3_39, -1, 1, 0}, +{ 6, s_3_40, -3, 1, 0}, +{ 4, s_3_41, -4, 1, 0}, +{ 12, s_3_42, -1, 1, 0}, +{ 6, s_3_43, -2, 1, 0}, +{ 4, s_3_44, -7, 1, 0}, +{ 8, s_3_45, -1, 1, 0}, +{ 10, s_3_46, -1, 1, 0}, +{ 14, s_3_47, -10, 1, 0}, +{ 4, s_3_48, 0, 1, 0}, +{ 14, s_3_49, 0, 1, 0}, +{ 8, s_3_50, 0, 1, 0}, +{ 6, s_3_51, 0, 1, 0}, +{ 4, s_3_52, 0, 1, 0}, +{ 8, s_3_53, -1, 1, 0}, +{ 10, s_3_54, -1, 1, 0}, +{ 8, s_3_55, -3, 1, 0}, +{ 6, s_3_56, -4, 1, 0} +}; + +static const unsigned char g_v[] = { 209, 4, 128, 0, 18 }; + + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping_U(z, g_v, 1377, 1413, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = in_grouping_U(z, g_v, 1377, 1413, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = out_grouping_U(z, g_v, 1377, 1413, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 1377, 1413, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_adjective(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_0, 23)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_verb(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_1, 71)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_noun(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_2, 40)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_ending(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_3, 57)) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int armenian_UTF_8_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + { + int v_2 = z->l - z->c; + { + int ret = r_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_verb(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_adjective(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_noun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + z->lb = v_1; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * armenian_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void armenian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_armenian.h b/contrib/libs/snowball/src_c/stem_UTF_8_armenian.h new file mode 100644 index 000000000000..b97cef0adb65 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_armenian.h @@ -0,0 +1,15 @@ +/* Generated from armenian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * armenian_UTF_8_create_env(void); +extern void armenian_UTF_8_close_env(struct SN_env * z); + +extern int armenian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_basque.c b/contrib/libs/snowball/src_c/stem_UTF_8_basque.c new file mode 100644 index 000000000000..04ad16ae800f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_basque.c @@ -0,0 +1,1158 @@ +/* Generated from basque.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int basque_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_R1(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_adjetiboak(struct SN_env * z); +static int r_izenak(struct SN_env * z); +static int r_aditzak(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * basque_UTF_8_create_env(void); +extern void basque_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[4] = { 'i', 'd', 'e', 'a' }; +static const symbol s_0_1[5] = { 'b', 'i', 'd', 'e', 'a' }; +static const symbol s_0_2[5] = { 'k', 'i', 'd', 'e', 'a' }; +static const symbol s_0_3[5] = { 'p', 'i', 'd', 'e', 'a' }; +static const symbol s_0_4[6] = { 'k', 'u', 'n', 'd', 'e', 'a' }; +static const symbol s_0_5[5] = { 'g', 'a', 'l', 'e', 'a' }; +static const symbol s_0_6[6] = { 't', 'a', 'i', 'l', 'e', 'a' }; +static const symbol s_0_7[7] = { 't', 'z', 'a', 'i', 'l', 'e', 'a' }; +static const symbol s_0_8[5] = { 'g', 'u', 'n', 'e', 'a' }; +static const symbol s_0_9[5] = { 'k', 'u', 'n', 'e', 'a' }; +static const symbol s_0_10[5] = { 't', 'z', 'a', 'g', 'a' }; +static const symbol s_0_11[4] = { 'g', 'a', 'i', 'a' }; +static const symbol s_0_12[5] = { 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_0_13[6] = { 't', 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_0_14[5] = { 'k', 'a', 'r', 'i', 'a' }; +static const symbol s_0_15[6] = { 'g', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_0_16[6] = { 'k', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_0_17[2] = { 'k', 'a' }; +static const symbol s_0_18[5] = { 't', 'z', 'a', 'k', 'a' }; +static const symbol s_0_19[2] = { 'l', 'a' }; +static const symbol s_0_20[4] = { 'm', 'e', 'n', 'a' }; +static const symbol s_0_21[4] = { 'p', 'e', 'n', 'a' }; +static const symbol s_0_22[4] = { 'k', 'i', 'n', 'a' }; +static const symbol s_0_23[5] = { 'e', 'z', 'i', 'n', 'a' }; +static const symbol s_0_24[6] = { 't', 'e', 'z', 'i', 'n', 'a' }; +static const symbol s_0_25[4] = { 'k', 'u', 'n', 'a' }; +static const symbol s_0_26[4] = { 't', 'u', 'n', 'a' }; +static const symbol s_0_27[6] = { 'k', 'i', 'z', 'u', 'n', 'a' }; +static const symbol s_0_28[3] = { 'e', 'r', 'a' }; +static const symbol s_0_29[4] = { 'b', 'e', 'r', 'a' }; +static const symbol s_0_30[7] = { 'a', 'r', 'a', 'b', 'e', 'r', 'a' }; +static const symbol s_0_31[4] = { 'k', 'e', 'r', 'a' }; +static const symbol s_0_32[4] = { 'p', 'e', 'r', 'a' }; +static const symbol s_0_33[4] = { 'o', 'r', 'r', 'a' }; +static const symbol s_0_34[5] = { 'k', 'o', 'r', 'r', 'a' }; +static const symbol s_0_35[4] = { 'd', 'u', 'r', 'a' }; +static const symbol s_0_36[4] = { 'g', 'u', 'r', 'a' }; +static const symbol s_0_37[4] = { 'k', 'u', 'r', 'a' }; +static const symbol s_0_38[4] = { 't', 'u', 'r', 'a' }; +static const symbol s_0_39[3] = { 'e', 't', 'a' }; +static const symbol s_0_40[4] = { 'k', 'e', 't', 'a' }; +static const symbol s_0_41[6] = { 'g', 'a', 'i', 'l', 'u', 'a' }; +static const symbol s_0_42[3] = { 'e', 'z', 'a' }; +static const symbol s_0_43[6] = { 'e', 'r', 'r', 'e', 'z', 'a' }; +static const symbol s_0_44[3] = { 't', 'z', 'a' }; +static const symbol s_0_45[6] = { 'g', 'a', 'i', 't', 'z', 'a' }; +static const symbol s_0_46[6] = { 'k', 'a', 'i', 't', 'z', 'a' }; +static const symbol s_0_47[6] = { 'k', 'u', 'n', 't', 'z', 'a' }; +static const symbol s_0_48[3] = { 'i', 'd', 'e' }; +static const symbol s_0_49[4] = { 'b', 'i', 'd', 'e' }; +static const symbol s_0_50[4] = { 'k', 'i', 'd', 'e' }; +static const symbol s_0_51[4] = { 'p', 'i', 'd', 'e' }; +static const symbol s_0_52[5] = { 'k', 'u', 'n', 'd', 'e' }; +static const symbol s_0_53[5] = { 't', 'z', 'a', 'k', 'e' }; +static const symbol s_0_54[5] = { 't', 'z', 'e', 'k', 'e' }; +static const symbol s_0_55[2] = { 'l', 'e' }; +static const symbol s_0_56[4] = { 'g', 'a', 'l', 'e' }; +static const symbol s_0_57[5] = { 't', 'a', 'i', 'l', 'e' }; +static const symbol s_0_58[6] = { 't', 'z', 'a', 'i', 'l', 'e' }; +static const symbol s_0_59[4] = { 'g', 'u', 'n', 'e' }; +static const symbol s_0_60[4] = { 'k', 'u', 'n', 'e' }; +static const symbol s_0_61[3] = { 't', 'z', 'e' }; +static const symbol s_0_62[4] = { 'a', 't', 'z', 'e' }; +static const symbol s_0_63[3] = { 'g', 'a', 'i' }; +static const symbol s_0_64[4] = { 'a', 'l', 'd', 'i' }; +static const symbol s_0_65[5] = { 't', 'a', 'l', 'd', 'i' }; +static const symbol s_0_66[2] = { 'k', 'i' }; +static const symbol s_0_67[3] = { 'a', 'r', 'i' }; +static const symbol s_0_68[4] = { 'k', 'a', 'r', 'i' }; +static const symbol s_0_69[4] = { 'l', 'a', 'r', 'i' }; +static const symbol s_0_70[4] = { 't', 'a', 'r', 'i' }; +static const symbol s_0_71[5] = { 'e', 't', 'a', 'r', 'i' }; +static const symbol s_0_72[5] = { 'g', 'a', 'r', 'r', 'i' }; +static const symbol s_0_73[5] = { 'k', 'a', 'r', 'r', 'i' }; +static const symbol s_0_74[5] = { 'a', 'r', 'a', 'z', 'i' }; +static const symbol s_0_75[6] = { 't', 'a', 'r', 'a', 'z', 'i' }; +static const symbol s_0_76[2] = { 'a', 'n' }; +static const symbol s_0_77[3] = { 'e', 'a', 'n' }; +static const symbol s_0_78[4] = { 'r', 'e', 'a', 'n' }; +static const symbol s_0_79[3] = { 'k', 'a', 'n' }; +static const symbol s_0_80[4] = { 'e', 't', 'a', 'n' }; +static const symbol s_0_81[7] = { 'a', 't', 's', 'e', 'd', 'e', 'n' }; +static const symbol s_0_82[3] = { 'm', 'e', 'n' }; +static const symbol s_0_83[3] = { 'p', 'e', 'n' }; +static const symbol s_0_84[3] = { 'k', 'i', 'n' }; +static const symbol s_0_85[5] = { 'r', 'e', 'k', 'i', 'n' }; +static const symbol s_0_86[4] = { 'e', 'z', 'i', 'n' }; +static const symbol s_0_87[5] = { 't', 'e', 'z', 'i', 'n' }; +static const symbol s_0_88[3] = { 't', 'u', 'n' }; +static const symbol s_0_89[5] = { 'k', 'i', 'z', 'u', 'n' }; +static const symbol s_0_90[2] = { 'g', 'o' }; +static const symbol s_0_91[3] = { 'a', 'g', 'o' }; +static const symbol s_0_92[3] = { 't', 'i', 'o' }; +static const symbol s_0_93[4] = { 'd', 'a', 'k', 'o' }; +static const symbol s_0_94[2] = { 'o', 'r' }; +static const symbol s_0_95[3] = { 'k', 'o', 'r' }; +static const symbol s_0_96[4] = { 't', 'z', 'a', 't' }; +static const symbol s_0_97[2] = { 'd', 'u' }; +static const symbol s_0_98[5] = { 'g', 'a', 'i', 'l', 'u' }; +static const symbol s_0_99[2] = { 't', 'u' }; +static const symbol s_0_100[3] = { 'a', 't', 'u' }; +static const symbol s_0_101[6] = { 'a', 'l', 'd', 'a', 't', 'u' }; +static const symbol s_0_102[4] = { 't', 'a', 't', 'u' }; +static const symbol s_0_103[6] = { 'b', 'a', 'd', 'i', 't', 'u' }; +static const symbol s_0_104[2] = { 'e', 'z' }; +static const symbol s_0_105[5] = { 'e', 'r', 'r', 'e', 'z' }; +static const symbol s_0_106[4] = { 't', 'z', 'e', 'z' }; +static const symbol s_0_107[5] = { 'g', 'a', 'i', 't', 'z' }; +static const symbol s_0_108[5] = { 'k', 'a', 'i', 't', 'z' }; +static const struct among a_0[109] = { +{ 4, s_0_0, 0, 1, 0}, +{ 5, s_0_1, -1, 1, 0}, +{ 5, s_0_2, -2, 1, 0}, +{ 5, s_0_3, -3, 1, 0}, +{ 6, s_0_4, 0, 1, 0}, +{ 5, s_0_5, 0, 1, 0}, +{ 6, s_0_6, 0, 1, 0}, +{ 7, s_0_7, 0, 1, 0}, +{ 5, s_0_8, 0, 1, 0}, +{ 5, s_0_9, 0, 1, 0}, +{ 5, s_0_10, 0, 1, 0}, +{ 4, s_0_11, 0, 1, 0}, +{ 5, s_0_12, 0, 1, 0}, +{ 6, s_0_13, -1, 1, 0}, +{ 5, s_0_14, 0, 1, 0}, +{ 6, s_0_15, 0, 2, 0}, +{ 6, s_0_16, 0, 1, 0}, +{ 2, s_0_17, 0, 1, 0}, +{ 5, s_0_18, -1, 1, 0}, +{ 2, s_0_19, 0, 1, 0}, +{ 4, s_0_20, 0, 1, 0}, +{ 4, s_0_21, 0, 1, 0}, +{ 4, s_0_22, 0, 1, 0}, +{ 5, s_0_23, 0, 1, 0}, +{ 6, s_0_24, -1, 1, 0}, +{ 4, s_0_25, 0, 1, 0}, +{ 4, s_0_26, 0, 1, 0}, +{ 6, s_0_27, 0, 1, 0}, +{ 3, s_0_28, 0, 1, 0}, +{ 4, s_0_29, -1, 1, 0}, +{ 7, s_0_30, -1, -1, 0}, +{ 4, s_0_31, -3, 1, 0}, +{ 4, s_0_32, -4, 1, 0}, +{ 4, s_0_33, 0, 1, 0}, +{ 5, s_0_34, -1, 1, 0}, +{ 4, s_0_35, 0, 1, 0}, +{ 4, s_0_36, 0, 1, 0}, +{ 4, s_0_37, 0, 1, 0}, +{ 4, s_0_38, 0, 1, 0}, +{ 3, s_0_39, 0, 1, 0}, +{ 4, s_0_40, -1, 1, 0}, +{ 6, s_0_41, 0, 1, 0}, +{ 3, s_0_42, 0, 1, 0}, +{ 6, s_0_43, -1, 1, 0}, +{ 3, s_0_44, 0, 2, 0}, +{ 6, s_0_45, -1, 1, 0}, +{ 6, s_0_46, -2, 1, 0}, +{ 6, s_0_47, -3, 1, 0}, +{ 3, s_0_48, 0, 1, 0}, +{ 4, s_0_49, -1, 1, 0}, +{ 4, s_0_50, -2, 1, 0}, +{ 4, s_0_51, -3, 1, 0}, +{ 5, s_0_52, 0, 1, 0}, +{ 5, s_0_53, 0, 1, 0}, +{ 5, s_0_54, 0, 1, 0}, +{ 2, s_0_55, 0, 1, 0}, +{ 4, s_0_56, -1, 1, 0}, +{ 5, s_0_57, -2, 1, 0}, +{ 6, s_0_58, -3, 1, 0}, +{ 4, s_0_59, 0, 1, 0}, +{ 4, s_0_60, 0, 1, 0}, +{ 3, s_0_61, 0, 1, 0}, +{ 4, s_0_62, -1, 1, 0}, +{ 3, s_0_63, 0, 1, 0}, +{ 4, s_0_64, 0, 1, 0}, +{ 5, s_0_65, -1, 1, 0}, +{ 2, s_0_66, 0, 1, 0}, +{ 3, s_0_67, 0, 1, 0}, +{ 4, s_0_68, -1, 1, 0}, +{ 4, s_0_69, -2, 1, 0}, +{ 4, s_0_70, -3, 1, 0}, +{ 5, s_0_71, -1, 1, 0}, +{ 5, s_0_72, 0, 2, 0}, +{ 5, s_0_73, 0, 1, 0}, +{ 5, s_0_74, 0, 1, 0}, +{ 6, s_0_75, -1, 1, 0}, +{ 2, s_0_76, 0, 1, 0}, +{ 3, s_0_77, -1, 1, 0}, +{ 4, s_0_78, -1, 1, 0}, +{ 3, s_0_79, -3, 1, 0}, +{ 4, s_0_80, -4, 1, 0}, +{ 7, s_0_81, 0, -1, 0}, +{ 3, s_0_82, 0, 1, 0}, +{ 3, s_0_83, 0, 1, 0}, +{ 3, s_0_84, 0, 1, 0}, +{ 5, s_0_85, -1, 1, 0}, +{ 4, s_0_86, 0, 1, 0}, +{ 5, s_0_87, -1, 1, 0}, +{ 3, s_0_88, 0, 1, 0}, +{ 5, s_0_89, 0, 1, 0}, +{ 2, s_0_90, 0, 1, 0}, +{ 3, s_0_91, -1, 1, 0}, +{ 3, s_0_92, 0, 1, 0}, +{ 4, s_0_93, 0, 1, 0}, +{ 2, s_0_94, 0, 1, 0}, +{ 3, s_0_95, -1, 1, 0}, +{ 4, s_0_96, 0, 1, 0}, +{ 2, s_0_97, 0, 1, 0}, +{ 5, s_0_98, 0, 1, 0}, +{ 2, s_0_99, 0, 1, 0}, +{ 3, s_0_100, -1, 1, 0}, +{ 6, s_0_101, -1, 1, 0}, +{ 4, s_0_102, -2, 1, 0}, +{ 6, s_0_103, -4, -1, 0}, +{ 2, s_0_104, 0, 1, 0}, +{ 5, s_0_105, -1, 1, 0}, +{ 4, s_0_106, -2, 1, 0}, +{ 5, s_0_107, 0, 1, 0}, +{ 5, s_0_108, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'a', 'd', 'a' }; +static const symbol s_1_1[4] = { 'k', 'a', 'd', 'a' }; +static const symbol s_1_2[4] = { 'a', 'n', 'd', 'a' }; +static const symbol s_1_3[5] = { 'd', 'e', 'n', 'd', 'a' }; +static const symbol s_1_4[5] = { 'g', 'a', 'b', 'e', 'a' }; +static const symbol s_1_5[5] = { 'k', 'a', 'b', 'e', 'a' }; +static const symbol s_1_6[5] = { 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_7[6] = { 'k', 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_8[6] = { 't', 'a', 'l', 'd', 'e', 'a' }; +static const symbol s_1_9[5] = { 'o', 'r', 'd', 'e', 'a' }; +static const symbol s_1_10[5] = { 'z', 'a', 'l', 'e', 'a' }; +static const symbol s_1_11[6] = { 't', 'z', 'a', 'l', 'e', 'a' }; +static const symbol s_1_12[5] = { 'g', 'i', 'l', 'e', 'a' }; +static const symbol s_1_13[4] = { 'e', 'm', 'e', 'a' }; +static const symbol s_1_14[5] = { 'k', 'u', 'm', 'e', 'a' }; +static const symbol s_1_15[3] = { 'n', 'e', 'a' }; +static const symbol s_1_16[4] = { 'e', 'n', 'e', 'a' }; +static const symbol s_1_17[6] = { 'z', 'i', 'o', 'n', 'e', 'a' }; +static const symbol s_1_18[4] = { 'u', 'n', 'e', 'a' }; +static const symbol s_1_19[5] = { 'g', 'u', 'n', 'e', 'a' }; +static const symbol s_1_20[3] = { 'p', 'e', 'a' }; +static const symbol s_1_21[6] = { 'a', 'u', 'r', 'r', 'e', 'a' }; +static const symbol s_1_22[3] = { 't', 'e', 'a' }; +static const symbol s_1_23[5] = { 'k', 'o', 't', 'e', 'a' }; +static const symbol s_1_24[5] = { 'a', 'r', 't', 'e', 'a' }; +static const symbol s_1_25[5] = { 'o', 's', 't', 'e', 'a' }; +static const symbol s_1_26[5] = { 'e', 't', 'x', 'e', 'a' }; +static const symbol s_1_27[2] = { 'g', 'a' }; +static const symbol s_1_28[4] = { 'a', 'n', 'g', 'a' }; +static const symbol s_1_29[4] = { 'g', 'a', 'i', 'a' }; +static const symbol s_1_30[5] = { 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_1_31[6] = { 't', 'a', 'l', 'd', 'i', 'a' }; +static const symbol s_1_32[6] = { 'h', 'a', 'n', 'd', 'i', 'a' }; +static const symbol s_1_33[6] = { 'm', 'e', 'n', 'd', 'i', 'a' }; +static const symbol s_1_34[4] = { 'g', 'e', 'i', 'a' }; +static const symbol s_1_35[4] = { 'e', 'g', 'i', 'a' }; +static const symbol s_1_36[5] = { 'd', 'e', 'g', 'i', 'a' }; +static const symbol s_1_37[5] = { 't', 'e', 'g', 'i', 'a' }; +static const symbol s_1_38[5] = { 'n', 'a', 'h', 'i', 'a' }; +static const symbol s_1_39[4] = { 'o', 'h', 'i', 'a' }; +static const symbol s_1_40[3] = { 'k', 'i', 'a' }; +static const symbol s_1_41[5] = { 't', 'o', 'k', 'i', 'a' }; +static const symbol s_1_42[3] = { 'o', 'i', 'a' }; +static const symbol s_1_43[4] = { 'k', 'o', 'i', 'a' }; +static const symbol s_1_44[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_1_45[5] = { 'k', 'a', 'r', 'i', 'a' }; +static const symbol s_1_46[5] = { 'l', 'a', 'r', 'i', 'a' }; +static const symbol s_1_47[5] = { 't', 'a', 'r', 'i', 'a' }; +static const symbol s_1_48[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_1_49[5] = { 'k', 'e', 'r', 'i', 'a' }; +static const symbol s_1_50[5] = { 't', 'e', 'r', 'i', 'a' }; +static const symbol s_1_51[6] = { 'g', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_1_52[6] = { 'l', 'a', 'r', 'r', 'i', 'a' }; +static const symbol s_1_53[6] = { 'k', 'i', 'r', 'r', 'i', 'a' }; +static const symbol s_1_54[5] = { 'd', 'u', 'r', 'i', 'a' }; +static const symbol s_1_55[4] = { 'a', 's', 'i', 'a' }; +static const symbol s_1_56[3] = { 't', 'i', 'a' }; +static const symbol s_1_57[4] = { 'e', 'z', 'i', 'a' }; +static const symbol s_1_58[5] = { 'b', 'i', 'z', 'i', 'a' }; +static const symbol s_1_59[6] = { 'o', 'n', 't', 'z', 'i', 'a' }; +static const symbol s_1_60[2] = { 'k', 'a' }; +static const symbol s_1_61[4] = { 'j', 'o', 'k', 'a' }; +static const symbol s_1_62[5] = { 'a', 'u', 'r', 'k', 'a' }; +static const symbol s_1_63[3] = { 's', 'k', 'a' }; +static const symbol s_1_64[3] = { 'x', 'k', 'a' }; +static const symbol s_1_65[3] = { 'z', 'k', 'a' }; +static const symbol s_1_66[6] = { 'g', 'i', 'b', 'e', 'l', 'a' }; +static const symbol s_1_67[4] = { 'g', 'e', 'l', 'a' }; +static const symbol s_1_68[5] = { 'k', 'a', 'i', 'l', 'a' }; +static const symbol s_1_69[5] = { 's', 'k', 'i', 'l', 'a' }; +static const symbol s_1_70[4] = { 't', 'i', 'l', 'a' }; +static const symbol s_1_71[3] = { 'o', 'l', 'a' }; +static const symbol s_1_72[2] = { 'n', 'a' }; +static const symbol s_1_73[4] = { 'k', 'a', 'n', 'a' }; +static const symbol s_1_74[3] = { 'e', 'n', 'a' }; +static const symbol s_1_75[7] = { 'g', 'a', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_76[7] = { 'g', 'e', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_77[6] = { 'u', 'r', 'r', 'e', 'n', 'a' }; +static const symbol s_1_78[5] = { 'z', 'a', 'i', 'n', 'a' }; +static const symbol s_1_79[6] = { 't', 'z', 'a', 'i', 'n', 'a' }; +static const symbol s_1_80[4] = { 'k', 'i', 'n', 'a' }; +static const symbol s_1_81[4] = { 'm', 'i', 'n', 'a' }; +static const symbol s_1_82[5] = { 'g', 'a', 'r', 'n', 'a' }; +static const symbol s_1_83[3] = { 'u', 'n', 'a' }; +static const symbol s_1_84[4] = { 'd', 'u', 'n', 'a' }; +static const symbol s_1_85[5] = { 'a', 's', 'u', 'n', 'a' }; +static const symbol s_1_86[6] = { 't', 'a', 's', 'u', 'n', 'a' }; +static const symbol s_1_87[5] = { 'o', 'n', 'd', 'o', 'a' }; +static const symbol s_1_88[6] = { 'k', 'o', 'n', 'd', 'o', 'a' }; +static const symbol s_1_89[4] = { 'n', 'g', 'o', 'a' }; +static const symbol s_1_90[4] = { 'z', 'i', 'o', 'a' }; +static const symbol s_1_91[3] = { 'k', 'o', 'a' }; +static const symbol s_1_92[5] = { 't', 'a', 'k', 'o', 'a' }; +static const symbol s_1_93[4] = { 'z', 'k', 'o', 'a' }; +static const symbol s_1_94[3] = { 'n', 'o', 'a' }; +static const symbol s_1_95[5] = { 'z', 'i', 'n', 'o', 'a' }; +static const symbol s_1_96[4] = { 'a', 'r', 'o', 'a' }; +static const symbol s_1_97[5] = { 't', 'a', 'r', 'o', 'a' }; +static const symbol s_1_98[5] = { 'z', 'a', 'r', 'o', 'a' }; +static const symbol s_1_99[4] = { 'e', 'r', 'o', 'a' }; +static const symbol s_1_100[4] = { 'o', 'r', 'o', 'a' }; +static const symbol s_1_101[4] = { 'o', 's', 'o', 'a' }; +static const symbol s_1_102[3] = { 't', 'o', 'a' }; +static const symbol s_1_103[4] = { 't', 't', 'o', 'a' }; +static const symbol s_1_104[4] = { 'z', 't', 'o', 'a' }; +static const symbol s_1_105[4] = { 't', 'x', 'o', 'a' }; +static const symbol s_1_106[4] = { 't', 'z', 'o', 'a' }; +static const symbol s_1_107[4] = { 0xC3, 0xB1, 'o', 'a' }; +static const symbol s_1_108[2] = { 'r', 'a' }; +static const symbol s_1_109[3] = { 'a', 'r', 'a' }; +static const symbol s_1_110[4] = { 'd', 'a', 'r', 'a' }; +static const symbol s_1_111[5] = { 'l', 'i', 'a', 'r', 'a' }; +static const symbol s_1_112[5] = { 't', 'i', 'a', 'r', 'a' }; +static const symbol s_1_113[4] = { 't', 'a', 'r', 'a' }; +static const symbol s_1_114[5] = { 'e', 't', 'a', 'r', 'a' }; +static const symbol s_1_115[5] = { 't', 'z', 'a', 'r', 'a' }; +static const symbol s_1_116[4] = { 'b', 'e', 'r', 'a' }; +static const symbol s_1_117[4] = { 'k', 'e', 'r', 'a' }; +static const symbol s_1_118[4] = { 'p', 'e', 'r', 'a' }; +static const symbol s_1_119[3] = { 'o', 'r', 'a' }; +static const symbol s_1_120[6] = { 't', 'z', 'a', 'r', 'r', 'a' }; +static const symbol s_1_121[5] = { 'k', 'o', 'r', 'r', 'a' }; +static const symbol s_1_122[3] = { 't', 'r', 'a' }; +static const symbol s_1_123[2] = { 's', 'a' }; +static const symbol s_1_124[3] = { 'o', 's', 'a' }; +static const symbol s_1_125[2] = { 't', 'a' }; +static const symbol s_1_126[3] = { 'e', 't', 'a' }; +static const symbol s_1_127[4] = { 'k', 'e', 't', 'a' }; +static const symbol s_1_128[3] = { 's', 't', 'a' }; +static const symbol s_1_129[3] = { 'd', 'u', 'a' }; +static const symbol s_1_130[6] = { 'm', 'e', 'n', 'd', 'u', 'a' }; +static const symbol s_1_131[5] = { 'o', 'r', 'd', 'u', 'a' }; +static const symbol s_1_132[5] = { 'l', 'e', 'k', 'u', 'a' }; +static const symbol s_1_133[5] = { 'b', 'u', 'r', 'u', 'a' }; +static const symbol s_1_134[5] = { 'd', 'u', 'r', 'u', 'a' }; +static const symbol s_1_135[4] = { 't', 's', 'u', 'a' }; +static const symbol s_1_136[3] = { 't', 'u', 'a' }; +static const symbol s_1_137[6] = { 'm', 'e', 'n', 't', 'u', 'a' }; +static const symbol s_1_138[5] = { 'e', 's', 't', 'u', 'a' }; +static const symbol s_1_139[4] = { 't', 'x', 'u', 'a' }; +static const symbol s_1_140[3] = { 'z', 'u', 'a' }; +static const symbol s_1_141[4] = { 't', 'z', 'u', 'a' }; +static const symbol s_1_142[2] = { 'z', 'a' }; +static const symbol s_1_143[3] = { 'e', 'z', 'a' }; +static const symbol s_1_144[5] = { 'e', 'r', 'o', 'z', 'a' }; +static const symbol s_1_145[3] = { 't', 'z', 'a' }; +static const symbol s_1_146[6] = { 'k', 'o', 'i', 't', 'z', 'a' }; +static const symbol s_1_147[5] = { 'a', 'n', 't', 'z', 'a' }; +static const symbol s_1_148[6] = { 'g', 'i', 'n', 't', 'z', 'a' }; +static const symbol s_1_149[6] = { 'k', 'i', 'n', 't', 'z', 'a' }; +static const symbol s_1_150[6] = { 'k', 'u', 'n', 't', 'z', 'a' }; +static const symbol s_1_151[4] = { 'g', 'a', 'b', 'e' }; +static const symbol s_1_152[4] = { 'k', 'a', 'b', 'e' }; +static const symbol s_1_153[4] = { 'k', 'i', 'd', 'e' }; +static const symbol s_1_154[4] = { 'a', 'l', 'd', 'e' }; +static const symbol s_1_155[5] = { 'k', 'a', 'l', 'd', 'e' }; +static const symbol s_1_156[5] = { 't', 'a', 'l', 'd', 'e' }; +static const symbol s_1_157[4] = { 'o', 'r', 'd', 'e' }; +static const symbol s_1_158[2] = { 'g', 'e' }; +static const symbol s_1_159[4] = { 'z', 'a', 'l', 'e' }; +static const symbol s_1_160[5] = { 't', 'z', 'a', 'l', 'e' }; +static const symbol s_1_161[4] = { 'g', 'i', 'l', 'e' }; +static const symbol s_1_162[3] = { 'e', 'm', 'e' }; +static const symbol s_1_163[4] = { 'k', 'u', 'm', 'e' }; +static const symbol s_1_164[2] = { 'n', 'e' }; +static const symbol s_1_165[5] = { 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_1_166[3] = { 'u', 'n', 'e' }; +static const symbol s_1_167[4] = { 'g', 'u', 'n', 'e' }; +static const symbol s_1_168[2] = { 'p', 'e' }; +static const symbol s_1_169[5] = { 'a', 'u', 'r', 'r', 'e' }; +static const symbol s_1_170[2] = { 't', 'e' }; +static const symbol s_1_171[4] = { 'k', 'o', 't', 'e' }; +static const symbol s_1_172[4] = { 'a', 'r', 't', 'e' }; +static const symbol s_1_173[4] = { 'o', 's', 't', 'e' }; +static const symbol s_1_174[4] = { 'e', 't', 'x', 'e' }; +static const symbol s_1_175[3] = { 'g', 'a', 'i' }; +static const symbol s_1_176[2] = { 'd', 'i' }; +static const symbol s_1_177[4] = { 'a', 'l', 'd', 'i' }; +static const symbol s_1_178[5] = { 't', 'a', 'l', 'd', 'i' }; +static const symbol s_1_179[5] = { 'g', 'e', 'l', 'd', 'i' }; +static const symbol s_1_180[5] = { 'h', 'a', 'n', 'd', 'i' }; +static const symbol s_1_181[5] = { 'm', 'e', 'n', 'd', 'i' }; +static const symbol s_1_182[3] = { 'g', 'e', 'i' }; +static const symbol s_1_183[3] = { 'e', 'g', 'i' }; +static const symbol s_1_184[4] = { 'd', 'e', 'g', 'i' }; +static const symbol s_1_185[4] = { 't', 'e', 'g', 'i' }; +static const symbol s_1_186[4] = { 'n', 'a', 'h', 'i' }; +static const symbol s_1_187[3] = { 'o', 'h', 'i' }; +static const symbol s_1_188[2] = { 'k', 'i' }; +static const symbol s_1_189[4] = { 't', 'o', 'k', 'i' }; +static const symbol s_1_190[2] = { 'o', 'i' }; +static const symbol s_1_191[3] = { 'g', 'o', 'i' }; +static const symbol s_1_192[3] = { 'k', 'o', 'i' }; +static const symbol s_1_193[3] = { 'a', 'r', 'i' }; +static const symbol s_1_194[4] = { 'k', 'a', 'r', 'i' }; +static const symbol s_1_195[4] = { 'l', 'a', 'r', 'i' }; +static const symbol s_1_196[4] = { 't', 'a', 'r', 'i' }; +static const symbol s_1_197[5] = { 'g', 'a', 'r', 'r', 'i' }; +static const symbol s_1_198[5] = { 'l', 'a', 'r', 'r', 'i' }; +static const symbol s_1_199[5] = { 'k', 'i', 'r', 'r', 'i' }; +static const symbol s_1_200[4] = { 'd', 'u', 'r', 'i' }; +static const symbol s_1_201[3] = { 'a', 's', 'i' }; +static const symbol s_1_202[2] = { 't', 'i' }; +static const symbol s_1_203[5] = { 'o', 'n', 't', 'z', 'i' }; +static const symbol s_1_204[3] = { 0xC3, 0xB1, 'i' }; +static const symbol s_1_205[2] = { 'a', 'k' }; +static const symbol s_1_206[2] = { 'e', 'k' }; +static const symbol s_1_207[5] = { 't', 'a', 'r', 'i', 'k' }; +static const symbol s_1_208[5] = { 'g', 'i', 'b', 'e', 'l' }; +static const symbol s_1_209[3] = { 'a', 'i', 'l' }; +static const symbol s_1_210[4] = { 'k', 'a', 'i', 'l' }; +static const symbol s_1_211[3] = { 'k', 'a', 'n' }; +static const symbol s_1_212[3] = { 't', 'a', 'n' }; +static const symbol s_1_213[4] = { 'e', 't', 'a', 'n' }; +static const symbol s_1_214[2] = { 'e', 'n' }; +static const symbol s_1_215[3] = { 'r', 'e', 'n' }; +static const symbol s_1_216[6] = { 'g', 'a', 'r', 'r', 'e', 'n' }; +static const symbol s_1_217[6] = { 'g', 'e', 'r', 'r', 'e', 'n' }; +static const symbol s_1_218[5] = { 'u', 'r', 'r', 'e', 'n' }; +static const symbol s_1_219[3] = { 't', 'e', 'n' }; +static const symbol s_1_220[4] = { 't', 'z', 'e', 'n' }; +static const symbol s_1_221[4] = { 'z', 'a', 'i', 'n' }; +static const symbol s_1_222[5] = { 't', 'z', 'a', 'i', 'n' }; +static const symbol s_1_223[3] = { 'k', 'i', 'n' }; +static const symbol s_1_224[3] = { 'm', 'i', 'n' }; +static const symbol s_1_225[3] = { 'd', 'u', 'n' }; +static const symbol s_1_226[4] = { 'a', 's', 'u', 'n' }; +static const symbol s_1_227[5] = { 't', 'a', 's', 'u', 'n' }; +static const symbol s_1_228[5] = { 'a', 'i', 'z', 'u', 'n' }; +static const symbol s_1_229[4] = { 'o', 'n', 'd', 'o' }; +static const symbol s_1_230[5] = { 'k', 'o', 'n', 'd', 'o' }; +static const symbol s_1_231[2] = { 'g', 'o' }; +static const symbol s_1_232[3] = { 'n', 'g', 'o' }; +static const symbol s_1_233[3] = { 'z', 'i', 'o' }; +static const symbol s_1_234[2] = { 'k', 'o' }; +static const symbol s_1_235[5] = { 't', 'r', 'a', 'k', 'o' }; +static const symbol s_1_236[4] = { 't', 'a', 'k', 'o' }; +static const symbol s_1_237[5] = { 'e', 't', 'a', 'k', 'o' }; +static const symbol s_1_238[3] = { 'e', 'k', 'o' }; +static const symbol s_1_239[6] = { 't', 'a', 'r', 'i', 'k', 'o' }; +static const symbol s_1_240[3] = { 's', 'k', 'o' }; +static const symbol s_1_241[4] = { 't', 'u', 'k', 'o' }; +static const symbol s_1_242[8] = { 'm', 'i', 'n', 'u', 't', 'u', 'k', 'o' }; +static const symbol s_1_243[3] = { 'z', 'k', 'o' }; +static const symbol s_1_244[2] = { 'n', 'o' }; +static const symbol s_1_245[4] = { 'z', 'i', 'n', 'o' }; +static const symbol s_1_246[2] = { 'r', 'o' }; +static const symbol s_1_247[3] = { 'a', 'r', 'o' }; +static const symbol s_1_248[5] = { 'i', 'g', 'a', 'r', 'o' }; +static const symbol s_1_249[4] = { 't', 'a', 'r', 'o' }; +static const symbol s_1_250[4] = { 'z', 'a', 'r', 'o' }; +static const symbol s_1_251[3] = { 'e', 'r', 'o' }; +static const symbol s_1_252[4] = { 'g', 'i', 'r', 'o' }; +static const symbol s_1_253[3] = { 'o', 'r', 'o' }; +static const symbol s_1_254[3] = { 'o', 's', 'o' }; +static const symbol s_1_255[2] = { 't', 'o' }; +static const symbol s_1_256[3] = { 't', 't', 'o' }; +static const symbol s_1_257[3] = { 'z', 't', 'o' }; +static const symbol s_1_258[3] = { 't', 'x', 'o' }; +static const symbol s_1_259[3] = { 't', 'z', 'o' }; +static const symbol s_1_260[6] = { 'g', 'i', 'n', 't', 'z', 'o' }; +static const symbol s_1_261[3] = { 0xC3, 0xB1, 'o' }; +static const symbol s_1_262[2] = { 'z', 'p' }; +static const symbol s_1_263[2] = { 'a', 'r' }; +static const symbol s_1_264[3] = { 'd', 'a', 'r' }; +static const symbol s_1_265[5] = { 'b', 'e', 'h', 'a', 'r' }; +static const symbol s_1_266[5] = { 'z', 'e', 'h', 'a', 'r' }; +static const symbol s_1_267[4] = { 'l', 'i', 'a', 'r' }; +static const symbol s_1_268[4] = { 't', 'i', 'a', 'r' }; +static const symbol s_1_269[3] = { 't', 'a', 'r' }; +static const symbol s_1_270[4] = { 't', 'z', 'a', 'r' }; +static const symbol s_1_271[2] = { 'o', 'r' }; +static const symbol s_1_272[3] = { 'k', 'o', 'r' }; +static const symbol s_1_273[2] = { 'o', 's' }; +static const symbol s_1_274[3] = { 'k', 'e', 't' }; +static const symbol s_1_275[2] = { 'd', 'u' }; +static const symbol s_1_276[5] = { 'm', 'e', 'n', 'd', 'u' }; +static const symbol s_1_277[4] = { 'o', 'r', 'd', 'u' }; +static const symbol s_1_278[4] = { 'l', 'e', 'k', 'u' }; +static const symbol s_1_279[4] = { 'b', 'u', 'r', 'u' }; +static const symbol s_1_280[4] = { 'd', 'u', 'r', 'u' }; +static const symbol s_1_281[3] = { 't', 's', 'u' }; +static const symbol s_1_282[2] = { 't', 'u' }; +static const symbol s_1_283[4] = { 't', 'a', 't', 'u' }; +static const symbol s_1_284[5] = { 'm', 'e', 'n', 't', 'u' }; +static const symbol s_1_285[4] = { 'e', 's', 't', 'u' }; +static const symbol s_1_286[3] = { 't', 'x', 'u' }; +static const symbol s_1_287[2] = { 'z', 'u' }; +static const symbol s_1_288[3] = { 't', 'z', 'u' }; +static const symbol s_1_289[6] = { 'g', 'i', 'n', 't', 'z', 'u' }; +static const symbol s_1_290[1] = { 'z' }; +static const symbol s_1_291[2] = { 'e', 'z' }; +static const symbol s_1_292[4] = { 'e', 'r', 'o', 'z' }; +static const symbol s_1_293[2] = { 't', 'z' }; +static const symbol s_1_294[5] = { 'k', 'o', 'i', 't', 'z' }; +static const struct among a_1[295] = { +{ 3, s_1_0, 0, 1, 0}, +{ 4, s_1_1, -1, 1, 0}, +{ 4, s_1_2, 0, 1, 0}, +{ 5, s_1_3, 0, 1, 0}, +{ 5, s_1_4, 0, 1, 0}, +{ 5, s_1_5, 0, 1, 0}, +{ 5, s_1_6, 0, 1, 0}, +{ 6, s_1_7, -1, 1, 0}, +{ 6, s_1_8, -2, 1, 0}, +{ 5, s_1_9, 0, 1, 0}, +{ 5, s_1_10, 0, 1, 0}, +{ 6, s_1_11, -1, 1, 0}, +{ 5, s_1_12, 0, 1, 0}, +{ 4, s_1_13, 0, 1, 0}, +{ 5, s_1_14, 0, 1, 0}, +{ 3, s_1_15, 0, 1, 0}, +{ 4, s_1_16, -1, 1, 0}, +{ 6, s_1_17, -2, 1, 0}, +{ 4, s_1_18, -3, 1, 0}, +{ 5, s_1_19, -1, 1, 0}, +{ 3, s_1_20, 0, 1, 0}, +{ 6, s_1_21, 0, 1, 0}, +{ 3, s_1_22, 0, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 5, s_1_24, -2, 1, 0}, +{ 5, s_1_25, -3, 1, 0}, +{ 5, s_1_26, 0, 1, 0}, +{ 2, s_1_27, 0, 1, 0}, +{ 4, s_1_28, -1, 1, 0}, +{ 4, s_1_29, 0, 1, 0}, +{ 5, s_1_30, 0, 1, 0}, +{ 6, s_1_31, -1, 1, 0}, +{ 6, s_1_32, 0, 1, 0}, +{ 6, s_1_33, 0, 1, 0}, +{ 4, s_1_34, 0, 1, 0}, +{ 4, s_1_35, 0, 1, 0}, +{ 5, s_1_36, -1, 1, 0}, +{ 5, s_1_37, -2, 1, 0}, +{ 5, s_1_38, 0, 1, 0}, +{ 4, s_1_39, 0, 1, 0}, +{ 3, s_1_40, 0, 1, 0}, +{ 5, s_1_41, -1, 1, 0}, +{ 3, s_1_42, 0, 1, 0}, +{ 4, s_1_43, -1, 1, 0}, +{ 4, s_1_44, 0, 1, 0}, +{ 5, s_1_45, -1, 1, 0}, +{ 5, s_1_46, -2, 1, 0}, +{ 5, s_1_47, -3, 1, 0}, +{ 4, s_1_48, 0, 1, 0}, +{ 5, s_1_49, -1, 1, 0}, +{ 5, s_1_50, -2, 1, 0}, +{ 6, s_1_51, 0, 2, 0}, +{ 6, s_1_52, 0, 1, 0}, +{ 6, s_1_53, 0, 1, 0}, +{ 5, s_1_54, 0, 1, 0}, +{ 4, s_1_55, 0, 1, 0}, +{ 3, s_1_56, 0, 1, 0}, +{ 4, s_1_57, 0, 1, 0}, +{ 5, s_1_58, 0, 1, 0}, +{ 6, s_1_59, 0, 1, 0}, +{ 2, s_1_60, 0, 1, 0}, +{ 4, s_1_61, -1, 3, 0}, +{ 5, s_1_62, -2, -1, 0}, +{ 3, s_1_63, -3, 1, 0}, +{ 3, s_1_64, -4, 1, 0}, +{ 3, s_1_65, -5, 1, 0}, +{ 6, s_1_66, 0, 1, 0}, +{ 4, s_1_67, 0, 1, 0}, +{ 5, s_1_68, 0, 1, 0}, +{ 5, s_1_69, 0, 1, 0}, +{ 4, s_1_70, 0, 1, 0}, +{ 3, s_1_71, 0, 1, 0}, +{ 2, s_1_72, 0, 1, 0}, +{ 4, s_1_73, -1, 1, 0}, +{ 3, s_1_74, -2, 1, 0}, +{ 7, s_1_75, -1, 1, 0}, +{ 7, s_1_76, -2, 1, 0}, +{ 6, s_1_77, -3, 1, 0}, +{ 5, s_1_78, -6, 1, 0}, +{ 6, s_1_79, -1, 1, 0}, +{ 4, s_1_80, -8, 1, 0}, +{ 4, s_1_81, -9, 1, 0}, +{ 5, s_1_82, -10, 1, 0}, +{ 3, s_1_83, -11, 1, 0}, +{ 4, s_1_84, -1, 1, 0}, +{ 5, s_1_85, -2, 1, 0}, +{ 6, s_1_86, -1, 1, 0}, +{ 5, s_1_87, 0, 1, 0}, +{ 6, s_1_88, -1, 1, 0}, +{ 4, s_1_89, 0, 1, 0}, +{ 4, s_1_90, 0, 1, 0}, +{ 3, s_1_91, 0, 1, 0}, +{ 5, s_1_92, -1, 1, 0}, +{ 4, s_1_93, -2, 1, 0}, +{ 3, s_1_94, 0, 1, 0}, +{ 5, s_1_95, -1, 1, 0}, +{ 4, s_1_96, 0, 1, 0}, +{ 5, s_1_97, -1, 1, 0}, +{ 5, s_1_98, -2, 1, 0}, +{ 4, s_1_99, 0, 1, 0}, +{ 4, s_1_100, 0, 1, 0}, +{ 4, s_1_101, 0, 1, 0}, +{ 3, s_1_102, 0, 1, 0}, +{ 4, s_1_103, -1, 1, 0}, +{ 4, s_1_104, -2, 1, 0}, +{ 4, s_1_105, 0, 1, 0}, +{ 4, s_1_106, 0, 1, 0}, +{ 4, s_1_107, 0, 1, 0}, +{ 2, s_1_108, 0, 1, 0}, +{ 3, s_1_109, -1, 1, 0}, +{ 4, s_1_110, -1, 1, 0}, +{ 5, s_1_111, -2, 1, 0}, +{ 5, s_1_112, -3, 1, 0}, +{ 4, s_1_113, -4, 1, 0}, +{ 5, s_1_114, -1, 1, 0}, +{ 5, s_1_115, -6, 1, 0}, +{ 4, s_1_116, -8, 1, 0}, +{ 4, s_1_117, -9, 1, 0}, +{ 4, s_1_118, -10, 1, 0}, +{ 3, s_1_119, -11, 2, 0}, +{ 6, s_1_120, -12, 1, 0}, +{ 5, s_1_121, -13, 1, 0}, +{ 3, s_1_122, -14, 1, 0}, +{ 2, s_1_123, 0, 1, 0}, +{ 3, s_1_124, -1, 1, 0}, +{ 2, s_1_125, 0, 1, 0}, +{ 3, s_1_126, -1, 1, 0}, +{ 4, s_1_127, -1, 1, 0}, +{ 3, s_1_128, -3, 1, 0}, +{ 3, s_1_129, 0, 1, 0}, +{ 6, s_1_130, -1, 1, 0}, +{ 5, s_1_131, -2, 1, 0}, +{ 5, s_1_132, 0, 1, 0}, +{ 5, s_1_133, 0, 1, 0}, +{ 5, s_1_134, 0, 1, 0}, +{ 4, s_1_135, 0, 1, 0}, +{ 3, s_1_136, 0, 1, 0}, +{ 6, s_1_137, -1, 1, 0}, +{ 5, s_1_138, -2, 1, 0}, +{ 4, s_1_139, 0, 1, 0}, +{ 3, s_1_140, 0, 1, 0}, +{ 4, s_1_141, -1, 1, 0}, +{ 2, s_1_142, 0, 1, 0}, +{ 3, s_1_143, -1, 1, 0}, +{ 5, s_1_144, -2, 1, 0}, +{ 3, s_1_145, -3, 2, 0}, +{ 6, s_1_146, -1, 1, 0}, +{ 5, s_1_147, -2, 1, 0}, +{ 6, s_1_148, -3, 1, 0}, +{ 6, s_1_149, -4, 1, 0}, +{ 6, s_1_150, -5, 1, 0}, +{ 4, s_1_151, 0, 1, 0}, +{ 4, s_1_152, 0, 1, 0}, +{ 4, s_1_153, 0, 1, 0}, +{ 4, s_1_154, 0, 1, 0}, +{ 5, s_1_155, -1, 1, 0}, +{ 5, s_1_156, -2, 1, 0}, +{ 4, s_1_157, 0, 1, 0}, +{ 2, s_1_158, 0, 1, 0}, +{ 4, s_1_159, 0, 1, 0}, +{ 5, s_1_160, -1, 1, 0}, +{ 4, s_1_161, 0, 1, 0}, +{ 3, s_1_162, 0, 1, 0}, +{ 4, s_1_163, 0, 1, 0}, +{ 2, s_1_164, 0, 1, 0}, +{ 5, s_1_165, -1, 1, 0}, +{ 3, s_1_166, -2, 1, 0}, +{ 4, s_1_167, -1, 1, 0}, +{ 2, s_1_168, 0, 1, 0}, +{ 5, s_1_169, 0, 1, 0}, +{ 2, s_1_170, 0, 1, 0}, +{ 4, s_1_171, -1, 1, 0}, +{ 4, s_1_172, -2, 1, 0}, +{ 4, s_1_173, -3, 1, 0}, +{ 4, s_1_174, 0, 1, 0}, +{ 3, s_1_175, 0, 1, 0}, +{ 2, s_1_176, 0, 1, 0}, +{ 4, s_1_177, -1, 1, 0}, +{ 5, s_1_178, -1, 1, 0}, +{ 5, s_1_179, -3, -1, 0}, +{ 5, s_1_180, -4, 1, 0}, +{ 5, s_1_181, -5, 1, 0}, +{ 3, s_1_182, 0, 1, 0}, +{ 3, s_1_183, 0, 1, 0}, +{ 4, s_1_184, -1, 1, 0}, +{ 4, s_1_185, -2, 1, 0}, +{ 4, s_1_186, 0, 1, 0}, +{ 3, s_1_187, 0, 1, 0}, +{ 2, s_1_188, 0, 1, 0}, +{ 4, s_1_189, -1, 1, 0}, +{ 2, s_1_190, 0, 1, 0}, +{ 3, s_1_191, -1, 1, 0}, +{ 3, s_1_192, -2, 1, 0}, +{ 3, s_1_193, 0, 1, 0}, +{ 4, s_1_194, -1, 1, 0}, +{ 4, s_1_195, -2, 1, 0}, +{ 4, s_1_196, -3, 1, 0}, +{ 5, s_1_197, 0, 2, 0}, +{ 5, s_1_198, 0, 1, 0}, +{ 5, s_1_199, 0, 1, 0}, +{ 4, s_1_200, 0, 1, 0}, +{ 3, s_1_201, 0, 1, 0}, +{ 2, s_1_202, 0, 1, 0}, +{ 5, s_1_203, 0, 1, 0}, +{ 3, s_1_204, 0, 1, 0}, +{ 2, s_1_205, 0, 1, 0}, +{ 2, s_1_206, 0, 1, 0}, +{ 5, s_1_207, 0, 1, 0}, +{ 5, s_1_208, 0, 1, 0}, +{ 3, s_1_209, 0, 1, 0}, +{ 4, s_1_210, -1, 1, 0}, +{ 3, s_1_211, 0, 1, 0}, +{ 3, s_1_212, 0, 1, 0}, +{ 4, s_1_213, -1, 1, 0}, +{ 2, s_1_214, 0, 4, 0}, +{ 3, s_1_215, -1, 2, 0}, +{ 6, s_1_216, -1, 1, 0}, +{ 6, s_1_217, -2, 1, 0}, +{ 5, s_1_218, -3, 1, 0}, +{ 3, s_1_219, -5, 4, 0}, +{ 4, s_1_220, -6, 4, 0}, +{ 4, s_1_221, 0, 1, 0}, +{ 5, s_1_222, -1, 1, 0}, +{ 3, s_1_223, 0, 1, 0}, +{ 3, s_1_224, 0, 1, 0}, +{ 3, s_1_225, 0, 1, 0}, +{ 4, s_1_226, 0, 1, 0}, +{ 5, s_1_227, -1, 1, 0}, +{ 5, s_1_228, 0, 1, 0}, +{ 4, s_1_229, 0, 1, 0}, +{ 5, s_1_230, -1, 1, 0}, +{ 2, s_1_231, 0, 1, 0}, +{ 3, s_1_232, -1, 1, 0}, +{ 3, s_1_233, 0, 1, 0}, +{ 2, s_1_234, 0, 1, 0}, +{ 5, s_1_235, -1, 5, 0}, +{ 4, s_1_236, -2, 1, 0}, +{ 5, s_1_237, -1, 1, 0}, +{ 3, s_1_238, -4, 1, 0}, +{ 6, s_1_239, -5, 1, 0}, +{ 3, s_1_240, -6, 1, 0}, +{ 4, s_1_241, -7, 1, 0}, +{ 8, s_1_242, -1, 6, 0}, +{ 3, s_1_243, -9, 1, 0}, +{ 2, s_1_244, 0, 1, 0}, +{ 4, s_1_245, -1, 1, 0}, +{ 2, s_1_246, 0, 1, 0}, +{ 3, s_1_247, -1, 1, 0}, +{ 5, s_1_248, -1, -1, 0}, +{ 4, s_1_249, -2, 1, 0}, +{ 4, s_1_250, -3, 1, 0}, +{ 3, s_1_251, -5, 1, 0}, +{ 4, s_1_252, -6, 1, 0}, +{ 3, s_1_253, -7, 1, 0}, +{ 3, s_1_254, 0, 1, 0}, +{ 2, s_1_255, 0, 1, 0}, +{ 3, s_1_256, -1, 1, 0}, +{ 3, s_1_257, -2, 1, 0}, +{ 3, s_1_258, 0, 1, 0}, +{ 3, s_1_259, 0, 1, 0}, +{ 6, s_1_260, -1, 1, 0}, +{ 3, s_1_261, 0, 1, 0}, +{ 2, s_1_262, 0, 1, 0}, +{ 2, s_1_263, 0, 1, 0}, +{ 3, s_1_264, -1, 1, 0}, +{ 5, s_1_265, -2, 1, 0}, +{ 5, s_1_266, -3, -1, 0}, +{ 4, s_1_267, -4, 1, 0}, +{ 4, s_1_268, -5, 1, 0}, +{ 3, s_1_269, -6, 1, 0}, +{ 4, s_1_270, -7, 1, 0}, +{ 2, s_1_271, 0, 2, 0}, +{ 3, s_1_272, -1, 1, 0}, +{ 2, s_1_273, 0, 1, 0}, +{ 3, s_1_274, 0, 1, 0}, +{ 2, s_1_275, 0, 1, 0}, +{ 5, s_1_276, -1, 1, 0}, +{ 4, s_1_277, -2, 1, 0}, +{ 4, s_1_278, 0, 1, 0}, +{ 4, s_1_279, 0, 2, 0}, +{ 4, s_1_280, 0, 1, 0}, +{ 3, s_1_281, 0, 1, 0}, +{ 2, s_1_282, 0, 1, 0}, +{ 4, s_1_283, -1, 4, 0}, +{ 5, s_1_284, -2, 1, 0}, +{ 4, s_1_285, -3, 1, 0}, +{ 3, s_1_286, 0, 1, 0}, +{ 2, s_1_287, 0, 1, 0}, +{ 3, s_1_288, -1, 1, 0}, +{ 6, s_1_289, -1, 1, 0}, +{ 1, s_1_290, 0, 1, 0}, +{ 2, s_1_291, -1, 1, 0}, +{ 4, s_1_292, -2, 1, 0}, +{ 2, s_1_293, -3, 1, 0}, +{ 5, s_1_294, -1, 1, 0} +}; + +static const symbol s_2_0[4] = { 'z', 'l', 'e', 'a' }; +static const symbol s_2_1[5] = { 'k', 'e', 'r', 'i', 'a' }; +static const symbol s_2_2[2] = { 'l', 'a' }; +static const symbol s_2_3[3] = { 'e', 'r', 'a' }; +static const symbol s_2_4[4] = { 'd', 'a', 'd', 'e' }; +static const symbol s_2_5[4] = { 't', 'a', 'd', 'e' }; +static const symbol s_2_6[4] = { 'd', 'a', 't', 'e' }; +static const symbol s_2_7[4] = { 't', 'a', 't', 'e' }; +static const symbol s_2_8[2] = { 'g', 'i' }; +static const symbol s_2_9[2] = { 'k', 'i' }; +static const symbol s_2_10[2] = { 'i', 'k' }; +static const symbol s_2_11[5] = { 'l', 'a', 'n', 'i', 'k' }; +static const symbol s_2_12[3] = { 'r', 'i', 'k' }; +static const symbol s_2_13[5] = { 'l', 'a', 'r', 'i', 'k' }; +static const symbol s_2_14[4] = { 'z', 't', 'i', 'k' }; +static const symbol s_2_15[2] = { 'g', 'o' }; +static const symbol s_2_16[2] = { 'r', 'o' }; +static const symbol s_2_17[3] = { 'e', 'r', 'o' }; +static const symbol s_2_18[2] = { 't', 'o' }; +static const struct among a_2[19] = { +{ 4, s_2_0, 0, 2, 0}, +{ 5, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 1, 0}, +{ 3, s_2_3, 0, 1, 0}, +{ 4, s_2_4, 0, 1, 0}, +{ 4, s_2_5, 0, 1, 0}, +{ 4, s_2_6, 0, 1, 0}, +{ 4, s_2_7, 0, 1, 0}, +{ 2, s_2_8, 0, 1, 0}, +{ 2, s_2_9, 0, 1, 0}, +{ 2, s_2_10, 0, 1, 0}, +{ 5, s_2_11, -1, 1, 0}, +{ 3, s_2_12, -2, 1, 0}, +{ 5, s_2_13, -1, 1, 0}, +{ 4, s_2_14, -4, 1, 0}, +{ 2, s_2_15, 0, 1, 0}, +{ 2, s_2_16, 0, 1, 0}, +{ 3, s_2_17, -1, 1, 0}, +{ 2, s_2_18, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16 }; + +static const symbol s_0[] = { 'j', 'o', 'k' }; +static const symbol s_1[] = { 't', 'r', 'a' }; +static const symbol s_2[] = { 'm', 'i', 'n', 'u', 't', 'u' }; +static const symbol s_3[] = { 'z' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 117, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping_U(z, g_v, 97, 117, 0)) goto lab4; + { + int ret = out_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping_U(z, g_v, 97, 117, 0)) goto lab2; + { + int ret = in_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping_U(z, g_v, 97, 117, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping_U(z, g_v, 97, 117, 0)) goto lab6; + { + int ret = out_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 117, 0)) goto lab0; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_aditzak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((70566434 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_0, 109); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_izenak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((71162402 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 295); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_0); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_adjetiboak(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((35362 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_2, 19); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int basque_UTF_8_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + while (1) { + int v_1 = z->l - z->c; + { + int ret = r_aditzak(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + continue; + lab0: + z->c = z->l - v_1; + break; + } + while (1) { + int v_2 = z->l - z->c; + { + int ret = r_izenak(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + continue; + lab1: + z->c = z->l - v_2; + break; + } + { + int v_3 = z->l - z->c; + { + int ret = r_adjetiboak(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * basque_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void basque_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_basque.h b/contrib/libs/snowball/src_c/stem_UTF_8_basque.h new file mode 100644 index 000000000000..9a0284225556 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_basque.h @@ -0,0 +1,15 @@ +/* Generated from basque.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_UTF_8_create_env(void); +extern void basque_UTF_8_close_env(struct SN_env * z); + +extern int basque_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_catalan.c b/contrib/libs/snowball/src_c/stem_UTF_8_catalan.c new file mode 100644 index 000000000000..a00667360e75 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_catalan.c @@ -0,0 +1,1473 @@ +/* Generated from catalan.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int catalan_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_cleaning(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * catalan_UTF_8_create_env(void); +extern void catalan_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 0xC2, 0xB7 }; +static const symbol s_0_2[2] = { 0xC3, 0xA0 }; +static const symbol s_0_3[2] = { 0xC3, 0xA1 }; +static const symbol s_0_4[2] = { 0xC3, 0xA8 }; +static const symbol s_0_5[2] = { 0xC3, 0xA9 }; +static const symbol s_0_6[2] = { 0xC3, 0xAC }; +static const symbol s_0_7[2] = { 0xC3, 0xAD }; +static const symbol s_0_8[2] = { 0xC3, 0xAF }; +static const symbol s_0_9[2] = { 0xC3, 0xB2 }; +static const symbol s_0_10[2] = { 0xC3, 0xB3 }; +static const symbol s_0_11[2] = { 0xC3, 0xBA }; +static const symbol s_0_12[2] = { 0xC3, 0xBC }; +static const struct among a_0[13] = { +{ 0, 0, 0, 7, 0}, +{ 2, s_0_1, -1, 6, 0}, +{ 2, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, 1, 0}, +{ 2, s_0_4, -4, 2, 0}, +{ 2, s_0_5, -5, 2, 0}, +{ 2, s_0_6, -6, 3, 0}, +{ 2, s_0_7, -7, 3, 0}, +{ 2, s_0_8, -8, 3, 0}, +{ 2, s_0_9, -9, 4, 0}, +{ 2, s_0_10, -10, 4, 0}, +{ 2, s_0_11, -11, 5, 0}, +{ 2, s_0_12, -12, 5, 0} +}; + +static const symbol s_1_0[2] = { 'l', 'a' }; +static const symbol s_1_1[3] = { '-', 'l', 'a' }; +static const symbol s_1_2[4] = { 's', 'e', 'l', 'a' }; +static const symbol s_1_3[2] = { 'l', 'e' }; +static const symbol s_1_4[2] = { 'm', 'e' }; +static const symbol s_1_5[3] = { '-', 'm', 'e' }; +static const symbol s_1_6[2] = { 's', 'e' }; +static const symbol s_1_7[3] = { '-', 't', 'e' }; +static const symbol s_1_8[2] = { 'h', 'i' }; +static const symbol s_1_9[3] = { '\'', 'h', 'i' }; +static const symbol s_1_10[2] = { 'l', 'i' }; +static const symbol s_1_11[3] = { '-', 'l', 'i' }; +static const symbol s_1_12[2] = { '\'', 'l' }; +static const symbol s_1_13[2] = { '\'', 'm' }; +static const symbol s_1_14[2] = { '-', 'm' }; +static const symbol s_1_15[2] = { '\'', 'n' }; +static const symbol s_1_16[2] = { '-', 'n' }; +static const symbol s_1_17[2] = { 'h', 'o' }; +static const symbol s_1_18[3] = { '\'', 'h', 'o' }; +static const symbol s_1_19[2] = { 'l', 'o' }; +static const symbol s_1_20[4] = { 's', 'e', 'l', 'o' }; +static const symbol s_1_21[2] = { '\'', 's' }; +static const symbol s_1_22[3] = { 'l', 'a', 's' }; +static const symbol s_1_23[5] = { 's', 'e', 'l', 'a', 's' }; +static const symbol s_1_24[3] = { 'l', 'e', 's' }; +static const symbol s_1_25[4] = { '-', 'l', 'e', 's' }; +static const symbol s_1_26[3] = { '\'', 'l', 's' }; +static const symbol s_1_27[3] = { '-', 'l', 's' }; +static const symbol s_1_28[3] = { '\'', 'n', 's' }; +static const symbol s_1_29[3] = { '-', 'n', 's' }; +static const symbol s_1_30[3] = { 'e', 'n', 's' }; +static const symbol s_1_31[3] = { 'l', 'o', 's' }; +static const symbol s_1_32[5] = { 's', 'e', 'l', 'o', 's' }; +static const symbol s_1_33[3] = { 'n', 'o', 's' }; +static const symbol s_1_34[4] = { '-', 'n', 'o', 's' }; +static const symbol s_1_35[3] = { 'v', 'o', 's' }; +static const symbol s_1_36[2] = { 'u', 's' }; +static const symbol s_1_37[3] = { '-', 'u', 's' }; +static const symbol s_1_38[2] = { '\'', 't' }; +static const struct among a_1[39] = { +{ 2, s_1_0, 0, 1, 0}, +{ 3, s_1_1, -1, 1, 0}, +{ 4, s_1_2, -2, 1, 0}, +{ 2, s_1_3, 0, 1, 0}, +{ 2, s_1_4, 0, 1, 0}, +{ 3, s_1_5, -1, 1, 0}, +{ 2, s_1_6, 0, 1, 0}, +{ 3, s_1_7, 0, 1, 0}, +{ 2, s_1_8, 0, 1, 0}, +{ 3, s_1_9, -1, 1, 0}, +{ 2, s_1_10, 0, 1, 0}, +{ 3, s_1_11, -1, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 2, s_1_13, 0, 1, 0}, +{ 2, s_1_14, 0, 1, 0}, +{ 2, s_1_15, 0, 1, 0}, +{ 2, s_1_16, 0, 1, 0}, +{ 2, s_1_17, 0, 1, 0}, +{ 3, s_1_18, -1, 1, 0}, +{ 2, s_1_19, 0, 1, 0}, +{ 4, s_1_20, -1, 1, 0}, +{ 2, s_1_21, 0, 1, 0}, +{ 3, s_1_22, 0, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 3, s_1_24, 0, 1, 0}, +{ 4, s_1_25, -1, 1, 0}, +{ 3, s_1_26, 0, 1, 0}, +{ 3, s_1_27, 0, 1, 0}, +{ 3, s_1_28, 0, 1, 0}, +{ 3, s_1_29, 0, 1, 0}, +{ 3, s_1_30, 0, 1, 0}, +{ 3, s_1_31, 0, 1, 0}, +{ 5, s_1_32, -1, 1, 0}, +{ 3, s_1_33, 0, 1, 0}, +{ 4, s_1_34, -1, 1, 0}, +{ 3, s_1_35, 0, 1, 0}, +{ 2, s_1_36, 0, 1, 0}, +{ 3, s_1_37, -1, 1, 0}, +{ 2, s_1_38, 0, 1, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'c', 'a' }; +static const symbol s_2_1[7] = { 'l', 0xC3, 0xB3, 'g', 'i', 'c', 'a' }; +static const symbol s_2_2[4] = { 'e', 'n', 'c', 'a' }; +static const symbol s_2_3[3] = { 'a', 'd', 'a' }; +static const symbol s_2_4[5] = { 'a', 'n', 'c', 'i', 'a' }; +static const symbol s_2_5[5] = { 'e', 'n', 'c', 'i', 'a' }; +static const symbol s_2_6[6] = { 0xC3, 0xA8, 'n', 'c', 'i', 'a' }; +static const symbol s_2_7[5] = { 0xC3, 0xAD, 'c', 'i', 'a' }; +static const symbol s_2_8[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_2_9[4] = { 'i', 'n', 'i', 'a' }; +static const symbol s_2_10[6] = { 0xC3, 0xAD, 'i', 'n', 'i', 'a' }; +static const symbol s_2_11[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_2_12[5] = { 0xC3, 0xA0, 'r', 'i', 'a' }; +static const symbol s_2_13[7] = { 'a', 't', 0xC3, 0xB2, 'r', 'i', 'a' }; +static const symbol s_2_14[4] = { 'a', 'l', 'l', 'a' }; +static const symbol s_2_15[4] = { 'e', 'l', 'l', 'a' }; +static const symbol s_2_16[6] = { 0xC3, 0xAD, 'v', 'o', 'l', 'a' }; +static const symbol s_2_17[3] = { 'i', 'm', 'a' }; +static const symbol s_2_18[7] = { 0xC3, 0xAD, 's', 's', 'i', 'm', 'a' }; +static const symbol s_2_19[9] = { 'q', 'u', 0xC3, 0xAD, 's', 's', 'i', 'm', 'a' }; +static const symbol s_2_20[3] = { 'a', 'n', 'a' }; +static const symbol s_2_21[3] = { 'i', 'n', 'a' }; +static const symbol s_2_22[3] = { 'e', 'r', 'a' }; +static const symbol s_2_23[5] = { 's', 'f', 'e', 'r', 'a' }; +static const symbol s_2_24[3] = { 'o', 'r', 'a' }; +static const symbol s_2_25[4] = { 'd', 'o', 'r', 'a' }; +static const symbol s_2_26[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_2_27[5] = { 'a', 'd', 'u', 'r', 'a' }; +static const symbol s_2_28[3] = { 'e', 's', 'a' }; +static const symbol s_2_29[3] = { 'o', 's', 'a' }; +static const symbol s_2_30[4] = { 'a', 's', 's', 'a' }; +static const symbol s_2_31[4] = { 'e', 's', 's', 'a' }; +static const symbol s_2_32[4] = { 'i', 's', 's', 'a' }; +static const symbol s_2_33[3] = { 'e', 't', 'a' }; +static const symbol s_2_34[3] = { 'i', 't', 'a' }; +static const symbol s_2_35[3] = { 'o', 't', 'a' }; +static const symbol s_2_36[4] = { 'i', 's', 't', 'a' }; +static const symbol s_2_37[7] = { 'i', 'a', 'l', 'i', 's', 't', 'a' }; +static const symbol s_2_38[7] = { 'i', 'o', 'n', 'i', 's', 't', 'a' }; +static const symbol s_2_39[3] = { 'i', 'v', 'a' }; +static const symbol s_2_40[5] = { 'a', 't', 'i', 'v', 'a' }; +static const symbol s_2_41[4] = { 'n', 0xC3, 0xA7, 'a' }; +static const symbol s_2_42[6] = { 'l', 'o', 'g', 0xC3, 0xAD, 'a' }; +static const symbol s_2_43[2] = { 'i', 'c' }; +static const symbol s_2_44[6] = { 0xC3, 0xAD, 's', 't', 'i', 'c' }; +static const symbol s_2_45[3] = { 'e', 'n', 'c' }; +static const symbol s_2_46[3] = { 'e', 's', 'c' }; +static const symbol s_2_47[2] = { 'u', 'd' }; +static const symbol s_2_48[4] = { 'a', 't', 'g', 'e' }; +static const symbol s_2_49[3] = { 'b', 'l', 'e' }; +static const symbol s_2_50[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_2_51[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_2_52[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_2_53[7] = { 'i', 'a', 'l', 'i', 's', 'm', 'e' }; +static const symbol s_2_54[7] = { 'i', 'o', 'n', 'i', 's', 'm', 'e' }; +static const symbol s_2_55[6] = { 'i', 'v', 'i', 's', 'm', 'e' }; +static const symbol s_2_56[4] = { 'a', 'i', 'r', 'e' }; +static const symbol s_2_57[4] = { 'i', 'c', 't', 'e' }; +static const symbol s_2_58[4] = { 'i', 's', 't', 'e' }; +static const symbol s_2_59[3] = { 'i', 'c', 'i' }; +static const symbol s_2_60[4] = { 0xC3, 0xAD, 'c', 'i' }; +static const symbol s_2_61[4] = { 'l', 'o', 'g', 'i' }; +static const symbol s_2_62[3] = { 'a', 'r', 'i' }; +static const symbol s_2_63[4] = { 't', 'o', 'r', 'i' }; +static const symbol s_2_64[2] = { 'a', 'l' }; +static const symbol s_2_65[2] = { 'i', 'l' }; +static const symbol s_2_66[3] = { 'a', 'l', 'l' }; +static const symbol s_2_67[3] = { 'e', 'l', 'l' }; +static const symbol s_2_68[5] = { 0xC3, 0xAD, 'v', 'o', 'l' }; +static const symbol s_2_69[4] = { 'i', 's', 'a', 'm' }; +static const symbol s_2_70[5] = { 'i', 's', 's', 'e', 'm' }; +static const symbol s_2_71[6] = { 0xC3, 0xAC, 's', 's', 'e', 'm' }; +static const symbol s_2_72[6] = { 0xC3, 0xAD, 's', 's', 'e', 'm' }; +static const symbol s_2_73[6] = { 0xC3, 0xAD, 's', 's', 'i', 'm' }; +static const symbol s_2_74[8] = { 'q', 'u', 0xC3, 0xAD, 's', 's', 'i', 'm' }; +static const symbol s_2_75[4] = { 'a', 'm', 'e', 'n' }; +static const symbol s_2_76[6] = { 0xC3, 0xAC, 's', 's', 'i', 'n' }; +static const symbol s_2_77[2] = { 'a', 'r' }; +static const symbol s_2_78[6] = { 'i', 'f', 'i', 'c', 'a', 'r' }; +static const symbol s_2_79[4] = { 'e', 'g', 'a', 'r' }; +static const symbol s_2_80[4] = { 'e', 'j', 'a', 'r' }; +static const symbol s_2_81[4] = { 'i', 't', 'a', 'r' }; +static const symbol s_2_82[5] = { 'i', 't', 'z', 'a', 'r' }; +static const symbol s_2_83[3] = { 'f', 'e', 'r' }; +static const symbol s_2_84[2] = { 'o', 'r' }; +static const symbol s_2_85[3] = { 'd', 'o', 'r' }; +static const symbol s_2_86[3] = { 'd', 'u', 'r' }; +static const symbol s_2_87[5] = { 'd', 'o', 'r', 'a', 's' }; +static const symbol s_2_88[3] = { 'i', 'c', 's' }; +static const symbol s_2_89[7] = { 'l', 0xC3, 0xB3, 'g', 'i', 'c', 's' }; +static const symbol s_2_90[3] = { 'u', 'd', 's' }; +static const symbol s_2_91[4] = { 'n', 'c', 'e', 's' }; +static const symbol s_2_92[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_2_93[6] = { 'a', 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_94[6] = { 'e', 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_95[7] = { 0xC3, 0xA8, 'n', 'c', 'i', 'e', 's' }; +static const symbol s_2_96[6] = { 0xC3, 0xAD, 'c', 'i', 'e', 's' }; +static const symbol s_2_97[6] = { 'l', 'o', 'g', 'i', 'e', 's' }; +static const symbol s_2_98[5] = { 'i', 'n', 'i', 'e', 's' }; +static const symbol s_2_99[6] = { 0xC3, 0xAD, 'n', 'i', 'e', 's' }; +static const symbol s_2_100[5] = { 'e', 'r', 'i', 'e', 's' }; +static const symbol s_2_101[6] = { 0xC3, 0xA0, 'r', 'i', 'e', 's' }; +static const symbol s_2_102[8] = { 'a', 't', 0xC3, 0xB2, 'r', 'i', 'e', 's' }; +static const symbol s_2_103[4] = { 'b', 'l', 'e', 's' }; +static const symbol s_2_104[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_2_105[5] = { 'i', 'b', 'l', 'e', 's' }; +static const symbol s_2_106[4] = { 'i', 'm', 'e', 's' }; +static const symbol s_2_107[8] = { 0xC3, 0xAD, 's', 's', 'i', 'm', 'e', 's' }; +static const symbol s_2_108[10] = { 'q', 'u', 0xC3, 0xAD, 's', 's', 'i', 'm', 'e', 's' }; +static const symbol s_2_109[6] = { 'f', 'o', 'r', 'm', 'e', 's' }; +static const symbol s_2_110[5] = { 'i', 's', 'm', 'e', 's' }; +static const symbol s_2_111[8] = { 'i', 'a', 'l', 'i', 's', 'm', 'e', 's' }; +static const symbol s_2_112[4] = { 'i', 'n', 'e', 's' }; +static const symbol s_2_113[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_2_114[4] = { 'o', 'r', 'e', 's' }; +static const symbol s_2_115[5] = { 'd', 'o', 'r', 'e', 's' }; +static const symbol s_2_116[6] = { 'i', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_2_117[5] = { 'd', 'u', 'r', 'e', 's' }; +static const symbol s_2_118[4] = { 'e', 's', 'e', 's' }; +static const symbol s_2_119[4] = { 'o', 's', 'e', 's' }; +static const symbol s_2_120[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_2_121[5] = { 'i', 'c', 't', 'e', 's' }; +static const symbol s_2_122[4] = { 'i', 't', 'e', 's' }; +static const symbol s_2_123[4] = { 'o', 't', 'e', 's' }; +static const symbol s_2_124[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_2_125[8] = { 'i', 'a', 'l', 'i', 's', 't', 'e', 's' }; +static const symbol s_2_126[8] = { 'i', 'o', 'n', 'i', 's', 't', 'e', 's' }; +static const symbol s_2_127[5] = { 'i', 'q', 'u', 'e', 's' }; +static const symbol s_2_128[9] = { 'l', 0xC3, 0xB3, 'g', 'i', 'q', 'u', 'e', 's' }; +static const symbol s_2_129[4] = { 'i', 'v', 'e', 's' }; +static const symbol s_2_130[6] = { 'a', 't', 'i', 'v', 'e', 's' }; +static const symbol s_2_131[7] = { 'l', 'o', 'g', 0xC3, 0xAD, 'e', 's' }; +static const symbol s_2_132[10] = { 'a', 'l', 'l', 'e', 'n', 'g', 0xC3, 0xBC, 'e', 's' }; +static const symbol s_2_133[4] = { 'i', 'c', 'i', 's' }; +static const symbol s_2_134[5] = { 0xC3, 0xAD, 'c', 'i', 's' }; +static const symbol s_2_135[5] = { 'l', 'o', 'g', 'i', 's' }; +static const symbol s_2_136[4] = { 'a', 'r', 'i', 's' }; +static const symbol s_2_137[5] = { 't', 'o', 'r', 'i', 's' }; +static const symbol s_2_138[2] = { 'l', 's' }; +static const symbol s_2_139[3] = { 'a', 'l', 's' }; +static const symbol s_2_140[4] = { 'e', 'l', 'l', 's' }; +static const symbol s_2_141[3] = { 'i', 'm', 's' }; +static const symbol s_2_142[7] = { 0xC3, 0xAD, 's', 's', 'i', 'm', 's' }; +static const symbol s_2_143[9] = { 'q', 'u', 0xC3, 0xAD, 's', 's', 'i', 'm', 's' }; +static const symbol s_2_144[4] = { 'i', 'o', 'n', 's' }; +static const symbol s_2_145[5] = { 'c', 'i', 'o', 'n', 's' }; +static const symbol s_2_146[6] = { 'a', 'c', 'i', 'o', 'n', 's' }; +static const symbol s_2_147[4] = { 'e', 's', 'o', 's' }; +static const symbol s_2_148[4] = { 'o', 's', 'o', 's' }; +static const symbol s_2_149[5] = { 'a', 's', 's', 'o', 's' }; +static const symbol s_2_150[5] = { 'i', 's', 's', 'o', 's' }; +static const symbol s_2_151[3] = { 'e', 'r', 's' }; +static const symbol s_2_152[3] = { 'o', 'r', 's' }; +static const symbol s_2_153[4] = { 'd', 'o', 'r', 's' }; +static const symbol s_2_154[5] = { 'a', 'd', 'o', 'r', 's' }; +static const symbol s_2_155[5] = { 'i', 'd', 'o', 'r', 's' }; +static const symbol s_2_156[3] = { 'a', 't', 's' }; +static const symbol s_2_157[5] = { 'i', 't', 'a', 't', 's' }; +static const symbol s_2_158[8] = { 'b', 'i', 'l', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_159[7] = { 'i', 'v', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_160[9] = { 'a', 't', 'i', 'v', 'i', 't', 'a', 't', 's' }; +static const symbol s_2_161[6] = { 0xC3, 0xAF, 't', 'a', 't', 's' }; +static const symbol s_2_162[3] = { 'e', 't', 's' }; +static const symbol s_2_163[4] = { 'a', 'n', 't', 's' }; +static const symbol s_2_164[4] = { 'e', 'n', 't', 's' }; +static const symbol s_2_165[5] = { 'm', 'e', 'n', 't', 's' }; +static const symbol s_2_166[6] = { 'a', 'm', 'e', 'n', 't', 's' }; +static const symbol s_2_167[3] = { 'o', 't', 's' }; +static const symbol s_2_168[3] = { 'u', 't', 's' }; +static const symbol s_2_169[3] = { 'i', 'u', 's' }; +static const symbol s_2_170[5] = { 't', 'r', 'i', 'u', 's' }; +static const symbol s_2_171[5] = { 'a', 't', 'i', 'u', 's' }; +static const symbol s_2_172[3] = { 0xC3, 0xA8, 's' }; +static const symbol s_2_173[3] = { 0xC3, 0xA9, 's' }; +static const symbol s_2_174[3] = { 0xC3, 0xAD, 's' }; +static const symbol s_2_175[4] = { 'd', 0xC3, 0xAD, 's' }; +static const symbol s_2_176[3] = { 0xC3, 0xB3, 's' }; +static const symbol s_2_177[4] = { 'i', 't', 'a', 't' }; +static const symbol s_2_178[7] = { 'b', 'i', 'l', 'i', 't', 'a', 't' }; +static const symbol s_2_179[6] = { 'i', 'v', 'i', 't', 'a', 't' }; +static const symbol s_2_180[8] = { 'a', 't', 'i', 'v', 'i', 't', 'a', 't' }; +static const symbol s_2_181[5] = { 0xC3, 0xAF, 't', 'a', 't' }; +static const symbol s_2_182[2] = { 'e', 't' }; +static const symbol s_2_183[3] = { 'a', 'n', 't' }; +static const symbol s_2_184[3] = { 'e', 'n', 't' }; +static const symbol s_2_185[4] = { 'i', 'e', 'n', 't' }; +static const symbol s_2_186[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_2_187[5] = { 'a', 'm', 'e', 'n', 't' }; +static const symbol s_2_188[7] = { 'i', 's', 'a', 'm', 'e', 'n', 't' }; +static const symbol s_2_189[2] = { 'o', 't' }; +static const symbol s_2_190[5] = { 'i', 's', 's', 'e', 'u' }; +static const symbol s_2_191[6] = { 0xC3, 0xAC, 's', 's', 'e', 'u' }; +static const symbol s_2_192[6] = { 0xC3, 0xAD, 's', 's', 'e', 'u' }; +static const symbol s_2_193[4] = { 't', 'r', 'i', 'u' }; +static const symbol s_2_194[6] = { 0xC3, 0xAD, 's', 's', 'i', 'u' }; +static const symbol s_2_195[4] = { 'a', 't', 'i', 'u' }; +static const symbol s_2_196[2] = { 0xC3, 0xB3 }; +static const symbol s_2_197[3] = { 'i', 0xC3, 0xB3 }; +static const symbol s_2_198[4] = { 'c', 'i', 0xC3, 0xB3 }; +static const symbol s_2_199[5] = { 'a', 'c', 'i', 0xC3, 0xB3 }; +static const struct among a_2[200] = { +{ 3, s_2_0, 0, 4, 0}, +{ 7, s_2_1, -1, 3, 0}, +{ 4, s_2_2, 0, 1, 0}, +{ 3, s_2_3, 0, 2, 0}, +{ 5, s_2_4, 0, 1, 0}, +{ 5, s_2_5, 0, 1, 0}, +{ 6, s_2_6, 0, 1, 0}, +{ 5, s_2_7, 0, 1, 0}, +{ 5, s_2_8, 0, 3, 0}, +{ 4, s_2_9, 0, 1, 0}, +{ 6, s_2_10, -1, 1, 0}, +{ 4, s_2_11, 0, 1, 0}, +{ 5, s_2_12, 0, 1, 0}, +{ 7, s_2_13, 0, 1, 0}, +{ 4, s_2_14, 0, 1, 0}, +{ 4, s_2_15, 0, 1, 0}, +{ 6, s_2_16, 0, 1, 0}, +{ 3, s_2_17, 0, 1, 0}, +{ 7, s_2_18, -1, 1, 0}, +{ 9, s_2_19, -1, 5, 0}, +{ 3, s_2_20, 0, 1, 0}, +{ 3, s_2_21, 0, 1, 0}, +{ 3, s_2_22, 0, 1, 0}, +{ 5, s_2_23, -1, 1, 0}, +{ 3, s_2_24, 0, 1, 0}, +{ 4, s_2_25, -1, 1, 0}, +{ 5, s_2_26, -1, 1, 0}, +{ 5, s_2_27, 0, 1, 0}, +{ 3, s_2_28, 0, 1, 0}, +{ 3, s_2_29, 0, 1, 0}, +{ 4, s_2_30, 0, 1, 0}, +{ 4, s_2_31, 0, 1, 0}, +{ 4, s_2_32, 0, 1, 0}, +{ 3, s_2_33, 0, 1, 0}, +{ 3, s_2_34, 0, 1, 0}, +{ 3, s_2_35, 0, 1, 0}, +{ 4, s_2_36, 0, 1, 0}, +{ 7, s_2_37, -1, 1, 0}, +{ 7, s_2_38, -2, 1, 0}, +{ 3, s_2_39, 0, 1, 0}, +{ 5, s_2_40, -1, 1, 0}, +{ 4, s_2_41, 0, 1, 0}, +{ 6, s_2_42, 0, 3, 0}, +{ 2, s_2_43, 0, 4, 0}, +{ 6, s_2_44, -1, 1, 0}, +{ 3, s_2_45, 0, 1, 0}, +{ 3, s_2_46, 0, 1, 0}, +{ 2, s_2_47, 0, 1, 0}, +{ 4, s_2_48, 0, 1, 0}, +{ 3, s_2_49, 0, 1, 0}, +{ 4, s_2_50, -1, 1, 0}, +{ 4, s_2_51, -2, 1, 0}, +{ 4, s_2_52, 0, 1, 0}, +{ 7, s_2_53, -1, 1, 0}, +{ 7, s_2_54, -2, 1, 0}, +{ 6, s_2_55, -3, 1, 0}, +{ 4, s_2_56, 0, 1, 0}, +{ 4, s_2_57, 0, 1, 0}, +{ 4, s_2_58, 0, 1, 0}, +{ 3, s_2_59, 0, 1, 0}, +{ 4, s_2_60, 0, 1, 0}, +{ 4, s_2_61, 0, 3, 0}, +{ 3, s_2_62, 0, 1, 0}, +{ 4, s_2_63, 0, 1, 0}, +{ 2, s_2_64, 0, 1, 0}, +{ 2, s_2_65, 0, 1, 0}, +{ 3, s_2_66, 0, 1, 0}, +{ 3, s_2_67, 0, 1, 0}, +{ 5, s_2_68, 0, 1, 0}, +{ 4, s_2_69, 0, 1, 0}, +{ 5, s_2_70, 0, 1, 0}, +{ 6, s_2_71, 0, 1, 0}, +{ 6, s_2_72, 0, 1, 0}, +{ 6, s_2_73, 0, 1, 0}, +{ 8, s_2_74, -1, 5, 0}, +{ 4, s_2_75, 0, 1, 0}, +{ 6, s_2_76, 0, 1, 0}, +{ 2, s_2_77, 0, 1, 0}, +{ 6, s_2_78, -1, 1, 0}, +{ 4, s_2_79, -2, 1, 0}, +{ 4, s_2_80, -3, 1, 0}, +{ 4, s_2_81, -4, 1, 0}, +{ 5, s_2_82, -5, 1, 0}, +{ 3, s_2_83, 0, 1, 0}, +{ 2, s_2_84, 0, 1, 0}, +{ 3, s_2_85, -1, 1, 0}, +{ 3, s_2_86, 0, 1, 0}, +{ 5, s_2_87, 0, 1, 0}, +{ 3, s_2_88, 0, 4, 0}, +{ 7, s_2_89, -1, 3, 0}, +{ 3, s_2_90, 0, 1, 0}, +{ 4, s_2_91, 0, 1, 0}, +{ 4, s_2_92, 0, 2, 0}, +{ 6, s_2_93, 0, 1, 0}, +{ 6, s_2_94, 0, 1, 0}, +{ 7, s_2_95, 0, 1, 0}, +{ 6, s_2_96, 0, 1, 0}, +{ 6, s_2_97, 0, 3, 0}, +{ 5, s_2_98, 0, 1, 0}, +{ 6, s_2_99, 0, 1, 0}, +{ 5, s_2_100, 0, 1, 0}, +{ 6, s_2_101, 0, 1, 0}, +{ 8, s_2_102, 0, 1, 0}, +{ 4, s_2_103, 0, 1, 0}, +{ 5, s_2_104, -1, 1, 0}, +{ 5, s_2_105, -2, 1, 0}, +{ 4, s_2_106, 0, 1, 0}, +{ 8, s_2_107, -1, 1, 0}, +{ 10, s_2_108, -1, 5, 0}, +{ 6, s_2_109, 0, 1, 0}, +{ 5, s_2_110, 0, 1, 0}, +{ 8, s_2_111, -1, 1, 0}, +{ 4, s_2_112, 0, 1, 0}, +{ 4, s_2_113, 0, 1, 0}, +{ 4, s_2_114, 0, 1, 0}, +{ 5, s_2_115, -1, 1, 0}, +{ 6, s_2_116, -1, 1, 0}, +{ 5, s_2_117, 0, 1, 0}, +{ 4, s_2_118, 0, 1, 0}, +{ 4, s_2_119, 0, 1, 0}, +{ 5, s_2_120, 0, 1, 0}, +{ 5, s_2_121, 0, 1, 0}, +{ 4, s_2_122, 0, 1, 0}, +{ 4, s_2_123, 0, 1, 0}, +{ 5, s_2_124, 0, 1, 0}, +{ 8, s_2_125, -1, 1, 0}, +{ 8, s_2_126, -2, 1, 0}, +{ 5, s_2_127, 0, 4, 0}, +{ 9, s_2_128, -1, 3, 0}, +{ 4, s_2_129, 0, 1, 0}, +{ 6, s_2_130, -1, 1, 0}, +{ 7, s_2_131, 0, 3, 0}, +{ 10, s_2_132, 0, 1, 0}, +{ 4, s_2_133, 0, 1, 0}, +{ 5, s_2_134, 0, 1, 0}, +{ 5, s_2_135, 0, 3, 0}, +{ 4, s_2_136, 0, 1, 0}, +{ 5, s_2_137, 0, 1, 0}, +{ 2, s_2_138, 0, 1, 0}, +{ 3, s_2_139, -1, 1, 0}, +{ 4, s_2_140, -2, 1, 0}, +{ 3, s_2_141, 0, 1, 0}, +{ 7, s_2_142, -1, 1, 0}, +{ 9, s_2_143, -1, 5, 0}, +{ 4, s_2_144, 0, 1, 0}, +{ 5, s_2_145, -1, 1, 0}, +{ 6, s_2_146, -1, 2, 0}, +{ 4, s_2_147, 0, 1, 0}, +{ 4, s_2_148, 0, 1, 0}, +{ 5, s_2_149, 0, 1, 0}, +{ 5, s_2_150, 0, 1, 0}, +{ 3, s_2_151, 0, 1, 0}, +{ 3, s_2_152, 0, 1, 0}, +{ 4, s_2_153, -1, 1, 0}, +{ 5, s_2_154, -1, 1, 0}, +{ 5, s_2_155, -2, 1, 0}, +{ 3, s_2_156, 0, 1, 0}, +{ 5, s_2_157, -1, 1, 0}, +{ 8, s_2_158, -1, 1, 0}, +{ 7, s_2_159, -2, 1, 0}, +{ 9, s_2_160, -1, 1, 0}, +{ 6, s_2_161, -5, 1, 0}, +{ 3, s_2_162, 0, 1, 0}, +{ 4, s_2_163, 0, 1, 0}, +{ 4, s_2_164, 0, 1, 0}, +{ 5, s_2_165, -1, 1, 0}, +{ 6, s_2_166, -1, 1, 0}, +{ 3, s_2_167, 0, 1, 0}, +{ 3, s_2_168, 0, 1, 0}, +{ 3, s_2_169, 0, 1, 0}, +{ 5, s_2_170, -1, 1, 0}, +{ 5, s_2_171, -2, 1, 0}, +{ 3, s_2_172, 0, 1, 0}, +{ 3, s_2_173, 0, 1, 0}, +{ 3, s_2_174, 0, 1, 0}, +{ 4, s_2_175, -1, 1, 0}, +{ 3, s_2_176, 0, 1, 0}, +{ 4, s_2_177, 0, 1, 0}, +{ 7, s_2_178, -1, 1, 0}, +{ 6, s_2_179, -2, 1, 0}, +{ 8, s_2_180, -1, 1, 0}, +{ 5, s_2_181, 0, 1, 0}, +{ 2, s_2_182, 0, 1, 0}, +{ 3, s_2_183, 0, 1, 0}, +{ 3, s_2_184, 0, 1, 0}, +{ 4, s_2_185, -1, 1, 0}, +{ 4, s_2_186, -2, 1, 0}, +{ 5, s_2_187, -1, 1, 0}, +{ 7, s_2_188, -1, 1, 0}, +{ 2, s_2_189, 0, 1, 0}, +{ 5, s_2_190, 0, 1, 0}, +{ 6, s_2_191, 0, 1, 0}, +{ 6, s_2_192, 0, 1, 0}, +{ 4, s_2_193, 0, 1, 0}, +{ 6, s_2_194, 0, 1, 0}, +{ 4, s_2_195, 0, 1, 0}, +{ 2, s_2_196, 0, 1, 0}, +{ 3, s_2_197, -1, 1, 0}, +{ 4, s_2_198, -1, 1, 0}, +{ 5, s_2_199, -1, 1, 0} +}; + +static const symbol s_3_0[3] = { 'a', 'b', 'a' }; +static const symbol s_3_1[4] = { 'e', 's', 'c', 'a' }; +static const symbol s_3_2[4] = { 'i', 's', 'c', 'a' }; +static const symbol s_3_3[5] = { 0xC3, 0xAF, 's', 'c', 'a' }; +static const symbol s_3_4[3] = { 'a', 'd', 'a' }; +static const symbol s_3_5[3] = { 'i', 'd', 'a' }; +static const symbol s_3_6[3] = { 'u', 'd', 'a' }; +static const symbol s_3_7[4] = { 0xC3, 0xAF, 'd', 'a' }; +static const symbol s_3_8[2] = { 'i', 'a' }; +static const symbol s_3_9[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_3_10[4] = { 'i', 'r', 'i', 'a' }; +static const symbol s_3_11[3] = { 'a', 'r', 'a' }; +static const symbol s_3_12[4] = { 'i', 'e', 'r', 'a' }; +static const symbol s_3_13[3] = { 'i', 'r', 'a' }; +static const symbol s_3_14[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_3_15[4] = { 0xC3, 0xAF, 'r', 'a' }; +static const symbol s_3_16[3] = { 'a', 'v', 'a' }; +static const symbol s_3_17[3] = { 'i', 'x', 'a' }; +static const symbol s_3_18[4] = { 'i', 't', 'z', 'a' }; +static const symbol s_3_19[3] = { 0xC3, 0xAD, 'a' }; +static const symbol s_3_20[5] = { 'a', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_3_21[5] = { 'e', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_3_22[5] = { 'i', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_3_23[3] = { 0xC3, 0xAF, 'a' }; +static const symbol s_3_24[3] = { 'i', 's', 'c' }; +static const symbol s_3_25[4] = { 0xC3, 0xAF, 's', 'c' }; +static const symbol s_3_26[2] = { 'a', 'd' }; +static const symbol s_3_27[2] = { 'e', 'd' }; +static const symbol s_3_28[2] = { 'i', 'd' }; +static const symbol s_3_29[2] = { 'i', 'e' }; +static const symbol s_3_30[2] = { 'r', 'e' }; +static const symbol s_3_31[3] = { 'd', 'r', 'e' }; +static const symbol s_3_32[3] = { 'a', 's', 'e' }; +static const symbol s_3_33[4] = { 'i', 'e', 's', 'e' }; +static const symbol s_3_34[4] = { 'a', 's', 't', 'e' }; +static const symbol s_3_35[4] = { 'i', 's', 't', 'e' }; +static const symbol s_3_36[2] = { 'i', 'i' }; +static const symbol s_3_37[3] = { 'i', 'n', 'i' }; +static const symbol s_3_38[5] = { 'e', 's', 'q', 'u', 'i' }; +static const symbol s_3_39[4] = { 'e', 'i', 'x', 'i' }; +static const symbol s_3_40[4] = { 'i', 't', 'z', 'i' }; +static const symbol s_3_41[2] = { 'a', 'm' }; +static const symbol s_3_42[2] = { 'e', 'm' }; +static const symbol s_3_43[4] = { 'a', 'r', 'e', 'm' }; +static const symbol s_3_44[4] = { 'i', 'r', 'e', 'm' }; +static const symbol s_3_45[5] = { 0xC3, 0xA0, 'r', 'e', 'm' }; +static const symbol s_3_46[5] = { 0xC3, 0xAD, 'r', 'e', 'm' }; +static const symbol s_3_47[6] = { 0xC3, 0xA0, 's', 's', 'e', 'm' }; +static const symbol s_3_48[6] = { 0xC3, 0xA9, 's', 's', 'e', 'm' }; +static const symbol s_3_49[5] = { 'i', 'g', 'u', 'e', 'm' }; +static const symbol s_3_50[6] = { 0xC3, 0xAF, 'g', 'u', 'e', 'm' }; +static const symbol s_3_51[4] = { 'a', 'v', 'e', 'm' }; +static const symbol s_3_52[5] = { 0xC3, 0xA0, 'v', 'e', 'm' }; +static const symbol s_3_53[5] = { 0xC3, 0xA1, 'v', 'e', 'm' }; +static const symbol s_3_54[6] = { 'i', 'r', 0xC3, 0xAC, 'e', 'm' }; +static const symbol s_3_55[4] = { 0xC3, 0xAD, 'e', 'm' }; +static const symbol s_3_56[6] = { 'a', 'r', 0xC3, 0xAD, 'e', 'm' }; +static const symbol s_3_57[6] = { 'i', 'r', 0xC3, 0xAD, 'e', 'm' }; +static const symbol s_3_58[5] = { 'a', 's', 's', 'i', 'm' }; +static const symbol s_3_59[5] = { 'e', 's', 's', 'i', 'm' }; +static const symbol s_3_60[5] = { 'i', 's', 's', 'i', 'm' }; +static const symbol s_3_61[6] = { 0xC3, 0xA0, 's', 's', 'i', 'm' }; +static const symbol s_3_62[6] = { 0xC3, 0xA8, 's', 's', 'i', 'm' }; +static const symbol s_3_63[6] = { 0xC3, 0xA9, 's', 's', 'i', 'm' }; +static const symbol s_3_64[6] = { 0xC3, 0xAD, 's', 's', 'i', 'm' }; +static const symbol s_3_65[3] = { 0xC3, 0xAF, 'm' }; +static const symbol s_3_66[2] = { 'a', 'n' }; +static const symbol s_3_67[4] = { 'a', 'b', 'a', 'n' }; +static const symbol s_3_68[5] = { 'a', 'r', 'i', 'a', 'n' }; +static const symbol s_3_69[4] = { 'a', 'r', 'a', 'n' }; +static const symbol s_3_70[5] = { 'i', 'e', 'r', 'a', 'n' }; +static const symbol s_3_71[4] = { 'i', 'r', 'a', 'n' }; +static const symbol s_3_72[4] = { 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_3_73[6] = { 'a', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_3_74[6] = { 'e', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_3_75[6] = { 'i', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_3_76[2] = { 'e', 'n' }; +static const symbol s_3_77[3] = { 'i', 'e', 'n' }; +static const symbol s_3_78[5] = { 'a', 'r', 'i', 'e', 'n' }; +static const symbol s_3_79[5] = { 'i', 'r', 'i', 'e', 'n' }; +static const symbol s_3_80[4] = { 'a', 'r', 'e', 'n' }; +static const symbol s_3_81[4] = { 'e', 'r', 'e', 'n' }; +static const symbol s_3_82[4] = { 'i', 'r', 'e', 'n' }; +static const symbol s_3_83[5] = { 0xC3, 0xA0, 'r', 'e', 'n' }; +static const symbol s_3_84[5] = { 0xC3, 0xAF, 'r', 'e', 'n' }; +static const symbol s_3_85[4] = { 'a', 's', 'e', 'n' }; +static const symbol s_3_86[5] = { 'i', 'e', 's', 'e', 'n' }; +static const symbol s_3_87[5] = { 'a', 's', 's', 'e', 'n' }; +static const symbol s_3_88[5] = { 'e', 's', 's', 'e', 'n' }; +static const symbol s_3_89[5] = { 'i', 's', 's', 'e', 'n' }; +static const symbol s_3_90[6] = { 0xC3, 0xA9, 's', 's', 'e', 'n' }; +static const symbol s_3_91[6] = { 0xC3, 0xAF, 's', 's', 'e', 'n' }; +static const symbol s_3_92[6] = { 'e', 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_93[6] = { 'i', 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_94[7] = { 0xC3, 0xAF, 's', 'q', 'u', 'e', 'n' }; +static const symbol s_3_95[4] = { 'a', 'v', 'e', 'n' }; +static const symbol s_3_96[4] = { 'i', 'x', 'e', 'n' }; +static const symbol s_3_97[5] = { 'e', 'i', 'x', 'e', 'n' }; +static const symbol s_3_98[5] = { 0xC3, 0xAF, 'x', 'e', 'n' }; +static const symbol s_3_99[4] = { 0xC3, 0xAF, 'e', 'n' }; +static const symbol s_3_100[2] = { 'i', 'n' }; +static const symbol s_3_101[4] = { 'i', 'n', 'i', 'n' }; +static const symbol s_3_102[3] = { 's', 'i', 'n' }; +static const symbol s_3_103[4] = { 'i', 's', 'i', 'n' }; +static const symbol s_3_104[5] = { 'a', 's', 's', 'i', 'n' }; +static const symbol s_3_105[5] = { 'e', 's', 's', 'i', 'n' }; +static const symbol s_3_106[5] = { 'i', 's', 's', 'i', 'n' }; +static const symbol s_3_107[6] = { 0xC3, 0xAF, 's', 's', 'i', 'n' }; +static const symbol s_3_108[6] = { 'e', 's', 'q', 'u', 'i', 'n' }; +static const symbol s_3_109[5] = { 'e', 'i', 'x', 'i', 'n' }; +static const symbol s_3_110[4] = { 'a', 'r', 'o', 'n' }; +static const symbol s_3_111[5] = { 'i', 'e', 'r', 'o', 'n' }; +static const symbol s_3_112[5] = { 'a', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_3_113[5] = { 'e', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_3_114[5] = { 'i', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_3_115[4] = { 'i', 0xC3, 0xAF, 'n' }; +static const symbol s_3_116[3] = { 'a', 'd', 'o' }; +static const symbol s_3_117[3] = { 'i', 'd', 'o' }; +static const symbol s_3_118[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_3_119[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_3_120[2] = { 'i', 'o' }; +static const symbol s_3_121[3] = { 'i', 'x', 'o' }; +static const symbol s_3_122[4] = { 'e', 'i', 'x', 'o' }; +static const symbol s_3_123[4] = { 0xC3, 0xAF, 'x', 'o' }; +static const symbol s_3_124[4] = { 'i', 't', 'z', 'o' }; +static const symbol s_3_125[2] = { 'a', 'r' }; +static const symbol s_3_126[4] = { 't', 'z', 'a', 'r' }; +static const symbol s_3_127[2] = { 'e', 'r' }; +static const symbol s_3_128[5] = { 'e', 'i', 'x', 'e', 'r' }; +static const symbol s_3_129[2] = { 'i', 'r' }; +static const symbol s_3_130[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_3_131[2] = { 'a', 's' }; +static const symbol s_3_132[4] = { 'a', 'b', 'a', 's' }; +static const symbol s_3_133[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_3_134[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_3_135[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_3_136[5] = { 'i', 'e', 'r', 'a', 's' }; +static const symbol s_3_137[4] = { 0xC3, 0xAD, 'a', 's' }; +static const symbol s_3_138[6] = { 'a', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_3_139[6] = { 'e', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_3_140[6] = { 'i', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_3_141[3] = { 'i', 'd', 's' }; +static const symbol s_3_142[2] = { 'e', 's' }; +static const symbol s_3_143[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_3_144[4] = { 'i', 'd', 'e', 's' }; +static const symbol s_3_145[4] = { 'u', 'd', 'e', 's' }; +static const symbol s_3_146[5] = { 0xC3, 0xAF, 'd', 'e', 's' }; +static const symbol s_3_147[5] = { 'a', 't', 'g', 'e', 's' }; +static const symbol s_3_148[3] = { 'i', 'e', 's' }; +static const symbol s_3_149[5] = { 'a', 'r', 'i', 'e', 's' }; +static const symbol s_3_150[5] = { 'i', 'r', 'i', 'e', 's' }; +static const symbol s_3_151[4] = { 'a', 'r', 'e', 's' }; +static const symbol s_3_152[4] = { 'i', 'r', 'e', 's' }; +static const symbol s_3_153[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_3_154[5] = { 0xC3, 0xAF, 'r', 'e', 's' }; +static const symbol s_3_155[4] = { 'a', 's', 'e', 's' }; +static const symbol s_3_156[5] = { 'i', 'e', 's', 'e', 's' }; +static const symbol s_3_157[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_3_158[5] = { 'e', 's', 's', 'e', 's' }; +static const symbol s_3_159[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_3_160[6] = { 0xC3, 0xAF, 's', 's', 'e', 's' }; +static const symbol s_3_161[4] = { 'q', 'u', 'e', 's' }; +static const symbol s_3_162[6] = { 'e', 's', 'q', 'u', 'e', 's' }; +static const symbol s_3_163[7] = { 0xC3, 0xAF, 's', 'q', 'u', 'e', 's' }; +static const symbol s_3_164[4] = { 'a', 'v', 'e', 's' }; +static const symbol s_3_165[4] = { 'i', 'x', 'e', 's' }; +static const symbol s_3_166[5] = { 'e', 'i', 'x', 'e', 's' }; +static const symbol s_3_167[5] = { 0xC3, 0xAF, 'x', 'e', 's' }; +static const symbol s_3_168[4] = { 0xC3, 0xAF, 'e', 's' }; +static const symbol s_3_169[5] = { 'a', 'b', 'a', 'i', 's' }; +static const symbol s_3_170[5] = { 'a', 'r', 'a', 'i', 's' }; +static const symbol s_3_171[6] = { 'i', 'e', 'r', 'a', 'i', 's' }; +static const symbol s_3_172[5] = { 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_3_173[7] = { 'a', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_3_174[7] = { 'e', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_3_175[7] = { 'i', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_3_176[5] = { 'a', 's', 'e', 'i', 's' }; +static const symbol s_3_177[6] = { 'i', 'e', 's', 'e', 'i', 's' }; +static const symbol s_3_178[6] = { 'a', 's', 't', 'e', 'i', 's' }; +static const symbol s_3_179[6] = { 'i', 's', 't', 'e', 'i', 's' }; +static const symbol s_3_180[4] = { 'i', 'n', 'i', 's' }; +static const symbol s_3_181[3] = { 's', 'i', 's' }; +static const symbol s_3_182[4] = { 'i', 's', 'i', 's' }; +static const symbol s_3_183[5] = { 'a', 's', 's', 'i', 's' }; +static const symbol s_3_184[5] = { 'e', 's', 's', 'i', 's' }; +static const symbol s_3_185[5] = { 'i', 's', 's', 'i', 's' }; +static const symbol s_3_186[6] = { 0xC3, 0xAF, 's', 's', 'i', 's' }; +static const symbol s_3_187[6] = { 'e', 's', 'q', 'u', 'i', 's' }; +static const symbol s_3_188[5] = { 'e', 'i', 'x', 'i', 's' }; +static const symbol s_3_189[5] = { 'i', 't', 'z', 'i', 's' }; +static const symbol s_3_190[4] = { 0xC3, 0xA1, 'i', 's' }; +static const symbol s_3_191[6] = { 'a', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_3_192[6] = { 'e', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_3_193[6] = { 'i', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_3_194[3] = { 'a', 'm', 's' }; +static const symbol s_3_195[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_3_196[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_3_197[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_3_198[7] = { 0xC3, 0xA1, 'b', 'a', 'm', 'o', 's' }; +static const symbol s_3_199[7] = { 0xC3, 0xA1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_3_200[8] = { 'i', 0xC3, 0xA9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_3_201[6] = { 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_3_202[8] = { 'a', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_3_203[8] = { 'e', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_3_204[8] = { 'i', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_3_205[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_206[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_207[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_3_208[7] = { 0xC3, 0xA1, 's', 'e', 'm', 'o', 's' }; +static const symbol s_3_209[8] = { 'i', 0xC3, 0xA9, 's', 'e', 'm', 'o', 's' }; +static const symbol s_3_210[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_3_211[5] = { 'a', 'd', 'o', 'r', 's' }; +static const symbol s_3_212[3] = { 'a', 's', 's' }; +static const symbol s_3_213[5] = { 'e', 'r', 'a', 's', 's' }; +static const symbol s_3_214[3] = { 'e', 's', 's' }; +static const symbol s_3_215[3] = { 'a', 't', 's' }; +static const symbol s_3_216[3] = { 'i', 't', 's' }; +static const symbol s_3_217[4] = { 'e', 'n', 't', 's' }; +static const symbol s_3_218[3] = { 0xC3, 0xA0, 's' }; +static const symbol s_3_219[5] = { 'a', 'r', 0xC3, 0xA0, 's' }; +static const symbol s_3_220[5] = { 'i', 'r', 0xC3, 0xA0, 's' }; +static const symbol s_3_221[5] = { 'a', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_3_222[5] = { 'e', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_3_223[5] = { 'i', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_3_224[3] = { 0xC3, 0xA9, 's' }; +static const symbol s_3_225[5] = { 'a', 'r', 0xC3, 0xA9, 's' }; +static const symbol s_3_226[3] = { 0xC3, 0xAD, 's' }; +static const symbol s_3_227[4] = { 'i', 0xC3, 0xAF, 's' }; +static const symbol s_3_228[2] = { 'a', 't' }; +static const symbol s_3_229[2] = { 'i', 't' }; +static const symbol s_3_230[3] = { 'a', 'n', 't' }; +static const symbol s_3_231[3] = { 'e', 'n', 't' }; +static const symbol s_3_232[3] = { 'i', 'n', 't' }; +static const symbol s_3_233[2] = { 'u', 't' }; +static const symbol s_3_234[3] = { 0xC3, 0xAF, 't' }; +static const symbol s_3_235[2] = { 'a', 'u' }; +static const symbol s_3_236[4] = { 'e', 'r', 'a', 'u' }; +static const symbol s_3_237[3] = { 'i', 'e', 'u' }; +static const symbol s_3_238[4] = { 'i', 'n', 'e', 'u' }; +static const symbol s_3_239[4] = { 'a', 'r', 'e', 'u' }; +static const symbol s_3_240[4] = { 'i', 'r', 'e', 'u' }; +static const symbol s_3_241[5] = { 0xC3, 0xA0, 'r', 'e', 'u' }; +static const symbol s_3_242[5] = { 0xC3, 0xAD, 'r', 'e', 'u' }; +static const symbol s_3_243[5] = { 'a', 's', 's', 'e', 'u' }; +static const symbol s_3_244[5] = { 'e', 's', 's', 'e', 'u' }; +static const symbol s_3_245[7] = { 'e', 'r', 'e', 's', 's', 'e', 'u' }; +static const symbol s_3_246[6] = { 0xC3, 0xA0, 's', 's', 'e', 'u' }; +static const symbol s_3_247[6] = { 0xC3, 0xA9, 's', 's', 'e', 'u' }; +static const symbol s_3_248[5] = { 'i', 'g', 'u', 'e', 'u' }; +static const symbol s_3_249[6] = { 0xC3, 0xAF, 'g', 'u', 'e', 'u' }; +static const symbol s_3_250[5] = { 0xC3, 0xA0, 'v', 'e', 'u' }; +static const symbol s_3_251[5] = { 0xC3, 0xA1, 'v', 'e', 'u' }; +static const symbol s_3_252[5] = { 'i', 't', 'z', 'e', 'u' }; +static const symbol s_3_253[4] = { 0xC3, 0xAC, 'e', 'u' }; +static const symbol s_3_254[6] = { 'i', 'r', 0xC3, 0xAC, 'e', 'u' }; +static const symbol s_3_255[4] = { 0xC3, 0xAD, 'e', 'u' }; +static const symbol s_3_256[6] = { 'a', 'r', 0xC3, 0xAD, 'e', 'u' }; +static const symbol s_3_257[6] = { 'i', 'r', 0xC3, 0xAD, 'e', 'u' }; +static const symbol s_3_258[5] = { 'a', 's', 's', 'i', 'u' }; +static const symbol s_3_259[5] = { 'i', 's', 's', 'i', 'u' }; +static const symbol s_3_260[6] = { 0xC3, 0xA0, 's', 's', 'i', 'u' }; +static const symbol s_3_261[6] = { 0xC3, 0xA8, 's', 's', 'i', 'u' }; +static const symbol s_3_262[6] = { 0xC3, 0xA9, 's', 's', 'i', 'u' }; +static const symbol s_3_263[6] = { 0xC3, 0xAD, 's', 's', 'i', 'u' }; +static const symbol s_3_264[3] = { 0xC3, 0xAF, 'u' }; +static const symbol s_3_265[2] = { 'i', 'x' }; +static const symbol s_3_266[3] = { 'e', 'i', 'x' }; +static const symbol s_3_267[3] = { 0xC3, 0xAF, 'x' }; +static const symbol s_3_268[3] = { 'i', 't', 'z' }; +static const symbol s_3_269[3] = { 'i', 0xC3, 0xA0 }; +static const symbol s_3_270[4] = { 'a', 'r', 0xC3, 0xA0 }; +static const symbol s_3_271[4] = { 'i', 'r', 0xC3, 0xA0 }; +static const symbol s_3_272[5] = { 'i', 't', 'z', 0xC3, 0xA0 }; +static const symbol s_3_273[4] = { 'a', 'r', 0xC3, 0xA1 }; +static const symbol s_3_274[4] = { 'e', 'r', 0xC3, 0xA1 }; +static const symbol s_3_275[4] = { 'i', 'r', 0xC3, 0xA1 }; +static const symbol s_3_276[4] = { 'i', 'r', 0xC3, 0xA8 }; +static const symbol s_3_277[4] = { 'a', 'r', 0xC3, 0xA9 }; +static const symbol s_3_278[4] = { 'e', 'r', 0xC3, 0xA9 }; +static const symbol s_3_279[4] = { 'i', 'r', 0xC3, 0xA9 }; +static const symbol s_3_280[2] = { 0xC3, 0xAD }; +static const symbol s_3_281[3] = { 'i', 0xC3, 0xAF }; +static const symbol s_3_282[3] = { 'i', 0xC3, 0xB3 }; +static const struct among a_3[283] = { +{ 3, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 4, s_3_2, 0, 1, 0}, +{ 5, s_3_3, 0, 1, 0}, +{ 3, s_3_4, 0, 1, 0}, +{ 3, s_3_5, 0, 1, 0}, +{ 3, s_3_6, 0, 1, 0}, +{ 4, s_3_7, 0, 1, 0}, +{ 2, s_3_8, 0, 1, 0}, +{ 4, s_3_9, -1, 1, 0}, +{ 4, s_3_10, -2, 1, 0}, +{ 3, s_3_11, 0, 1, 0}, +{ 4, s_3_12, 0, 1, 0}, +{ 3, s_3_13, 0, 1, 0}, +{ 5, s_3_14, 0, 1, 0}, +{ 4, s_3_15, 0, 1, 0}, +{ 3, s_3_16, 0, 1, 0}, +{ 3, s_3_17, 0, 1, 0}, +{ 4, s_3_18, 0, 1, 0}, +{ 3, s_3_19, 0, 1, 0}, +{ 5, s_3_20, -1, 1, 0}, +{ 5, s_3_21, -2, 1, 0}, +{ 5, s_3_22, -3, 1, 0}, +{ 3, s_3_23, 0, 1, 0}, +{ 3, s_3_24, 0, 1, 0}, +{ 4, s_3_25, 0, 1, 0}, +{ 2, s_3_26, 0, 1, 0}, +{ 2, s_3_27, 0, 1, 0}, +{ 2, s_3_28, 0, 1, 0}, +{ 2, s_3_29, 0, 1, 0}, +{ 2, s_3_30, 0, 1, 0}, +{ 3, s_3_31, -1, 1, 0}, +{ 3, s_3_32, 0, 1, 0}, +{ 4, s_3_33, 0, 1, 0}, +{ 4, s_3_34, 0, 1, 0}, +{ 4, s_3_35, 0, 1, 0}, +{ 2, s_3_36, 0, 1, 0}, +{ 3, s_3_37, 0, 1, 0}, +{ 5, s_3_38, 0, 1, 0}, +{ 4, s_3_39, 0, 1, 0}, +{ 4, s_3_40, 0, 1, 0}, +{ 2, s_3_41, 0, 1, 0}, +{ 2, s_3_42, 0, 1, 0}, +{ 4, s_3_43, -1, 1, 0}, +{ 4, s_3_44, -2, 1, 0}, +{ 5, s_3_45, -3, 1, 0}, +{ 5, s_3_46, -4, 1, 0}, +{ 6, s_3_47, -5, 1, 0}, +{ 6, s_3_48, -6, 1, 0}, +{ 5, s_3_49, -7, 1, 0}, +{ 6, s_3_50, -8, 1, 0}, +{ 4, s_3_51, -9, 1, 0}, +{ 5, s_3_52, -10, 1, 0}, +{ 5, s_3_53, -11, 1, 0}, +{ 6, s_3_54, -12, 1, 0}, +{ 4, s_3_55, -13, 1, 0}, +{ 6, s_3_56, -1, 1, 0}, +{ 6, s_3_57, -2, 1, 0}, +{ 5, s_3_58, 0, 1, 0}, +{ 5, s_3_59, 0, 1, 0}, +{ 5, s_3_60, 0, 1, 0}, +{ 6, s_3_61, 0, 1, 0}, +{ 6, s_3_62, 0, 1, 0}, +{ 6, s_3_63, 0, 1, 0}, +{ 6, s_3_64, 0, 1, 0}, +{ 3, s_3_65, 0, 1, 0}, +{ 2, s_3_66, 0, 1, 0}, +{ 4, s_3_67, -1, 1, 0}, +{ 5, s_3_68, -2, 1, 0}, +{ 4, s_3_69, -3, 1, 0}, +{ 5, s_3_70, -4, 1, 0}, +{ 4, s_3_71, -5, 1, 0}, +{ 4, s_3_72, -6, 1, 0}, +{ 6, s_3_73, -1, 1, 0}, +{ 6, s_3_74, -2, 1, 0}, +{ 6, s_3_75, -3, 1, 0}, +{ 2, s_3_76, 0, 1, 0}, +{ 3, s_3_77, -1, 1, 0}, +{ 5, s_3_78, -1, 1, 0}, +{ 5, s_3_79, -2, 1, 0}, +{ 4, s_3_80, -4, 1, 0}, +{ 4, s_3_81, -5, 1, 0}, +{ 4, s_3_82, -6, 1, 0}, +{ 5, s_3_83, -7, 1, 0}, +{ 5, s_3_84, -8, 1, 0}, +{ 4, s_3_85, -9, 1, 0}, +{ 5, s_3_86, -10, 1, 0}, +{ 5, s_3_87, -11, 1, 0}, +{ 5, s_3_88, -12, 1, 0}, +{ 5, s_3_89, -13, 1, 0}, +{ 6, s_3_90, -14, 1, 0}, +{ 6, s_3_91, -15, 1, 0}, +{ 6, s_3_92, -16, 1, 0}, +{ 6, s_3_93, -17, 1, 0}, +{ 7, s_3_94, -18, 1, 0}, +{ 4, s_3_95, -19, 1, 0}, +{ 4, s_3_96, -20, 1, 0}, +{ 5, s_3_97, -1, 1, 0}, +{ 5, s_3_98, -22, 1, 0}, +{ 4, s_3_99, -23, 1, 0}, +{ 2, s_3_100, 0, 1, 0}, +{ 4, s_3_101, -1, 1, 0}, +{ 3, s_3_102, -2, 1, 0}, +{ 4, s_3_103, -1, 1, 0}, +{ 5, s_3_104, -2, 1, 0}, +{ 5, s_3_105, -3, 1, 0}, +{ 5, s_3_106, -4, 1, 0}, +{ 6, s_3_107, -5, 1, 0}, +{ 6, s_3_108, -8, 1, 0}, +{ 5, s_3_109, -9, 1, 0}, +{ 4, s_3_110, 0, 1, 0}, +{ 5, s_3_111, 0, 1, 0}, +{ 5, s_3_112, 0, 1, 0}, +{ 5, s_3_113, 0, 1, 0}, +{ 5, s_3_114, 0, 1, 0}, +{ 4, s_3_115, 0, 1, 0}, +{ 3, s_3_116, 0, 1, 0}, +{ 3, s_3_117, 0, 1, 0}, +{ 4, s_3_118, 0, 2, 0}, +{ 5, s_3_119, 0, 1, 0}, +{ 2, s_3_120, 0, 1, 0}, +{ 3, s_3_121, 0, 1, 0}, +{ 4, s_3_122, -1, 1, 0}, +{ 4, s_3_123, 0, 1, 0}, +{ 4, s_3_124, 0, 1, 0}, +{ 2, s_3_125, 0, 1, 0}, +{ 4, s_3_126, -1, 1, 0}, +{ 2, s_3_127, 0, 1, 0}, +{ 5, s_3_128, -1, 1, 0}, +{ 2, s_3_129, 0, 1, 0}, +{ 4, s_3_130, 0, 1, 0}, +{ 2, s_3_131, 0, 1, 0}, +{ 4, s_3_132, -1, 1, 0}, +{ 4, s_3_133, -2, 1, 0}, +{ 4, s_3_134, -3, 1, 0}, +{ 4, s_3_135, -4, 1, 0}, +{ 5, s_3_136, -5, 1, 0}, +{ 4, s_3_137, -6, 1, 0}, +{ 6, s_3_138, -1, 1, 0}, +{ 6, s_3_139, -2, 1, 0}, +{ 6, s_3_140, -3, 1, 0}, +{ 3, s_3_141, 0, 1, 0}, +{ 2, s_3_142, 0, 1, 0}, +{ 4, s_3_143, -1, 1, 0}, +{ 4, s_3_144, -2, 1, 0}, +{ 4, s_3_145, -3, 1, 0}, +{ 5, s_3_146, -4, 1, 0}, +{ 5, s_3_147, -5, 1, 0}, +{ 3, s_3_148, -6, 1, 0}, +{ 5, s_3_149, -1, 1, 0}, +{ 5, s_3_150, -2, 1, 0}, +{ 4, s_3_151, -9, 1, 0}, +{ 4, s_3_152, -10, 1, 0}, +{ 6, s_3_153, -11, 1, 0}, +{ 5, s_3_154, -12, 1, 0}, +{ 4, s_3_155, -13, 1, 0}, +{ 5, s_3_156, -14, 1, 0}, +{ 5, s_3_157, -15, 1, 0}, +{ 5, s_3_158, -16, 1, 0}, +{ 5, s_3_159, -17, 1, 0}, +{ 6, s_3_160, -18, 1, 0}, +{ 4, s_3_161, -19, 1, 0}, +{ 6, s_3_162, -1, 1, 0}, +{ 7, s_3_163, -2, 1, 0}, +{ 4, s_3_164, -22, 1, 0}, +{ 4, s_3_165, -23, 1, 0}, +{ 5, s_3_166, -1, 1, 0}, +{ 5, s_3_167, -25, 1, 0}, +{ 4, s_3_168, -26, 1, 0}, +{ 5, s_3_169, 0, 1, 0}, +{ 5, s_3_170, 0, 1, 0}, +{ 6, s_3_171, 0, 1, 0}, +{ 5, s_3_172, 0, 1, 0}, +{ 7, s_3_173, -1, 1, 0}, +{ 7, s_3_174, -2, 1, 0}, +{ 7, s_3_175, -3, 1, 0}, +{ 5, s_3_176, 0, 1, 0}, +{ 6, s_3_177, 0, 1, 0}, +{ 6, s_3_178, 0, 1, 0}, +{ 6, s_3_179, 0, 1, 0}, +{ 4, s_3_180, 0, 1, 0}, +{ 3, s_3_181, 0, 1, 0}, +{ 4, s_3_182, -1, 1, 0}, +{ 5, s_3_183, -2, 1, 0}, +{ 5, s_3_184, -3, 1, 0}, +{ 5, s_3_185, -4, 1, 0}, +{ 6, s_3_186, -5, 1, 0}, +{ 6, s_3_187, 0, 1, 0}, +{ 5, s_3_188, 0, 1, 0}, +{ 5, s_3_189, 0, 1, 0}, +{ 4, s_3_190, 0, 1, 0}, +{ 6, s_3_191, 0, 1, 0}, +{ 6, s_3_192, 0, 1, 0}, +{ 6, s_3_193, 0, 1, 0}, +{ 3, s_3_194, 0, 1, 0}, +{ 4, s_3_195, 0, 1, 0}, +{ 4, s_3_196, 0, 1, 0}, +{ 4, s_3_197, 0, 1, 0}, +{ 7, s_3_198, -1, 1, 0}, +{ 7, s_3_199, -2, 1, 0}, +{ 8, s_3_200, -3, 1, 0}, +{ 6, s_3_201, -4, 1, 0}, +{ 8, s_3_202, -1, 1, 0}, +{ 8, s_3_203, -2, 1, 0}, +{ 8, s_3_204, -3, 1, 0}, +{ 6, s_3_205, 0, 1, 0}, +{ 6, s_3_206, 0, 1, 0}, +{ 6, s_3_207, 0, 1, 0}, +{ 7, s_3_208, 0, 1, 0}, +{ 8, s_3_209, 0, 1, 0}, +{ 4, s_3_210, 0, 1, 0}, +{ 5, s_3_211, 0, 1, 0}, +{ 3, s_3_212, 0, 1, 0}, +{ 5, s_3_213, -1, 1, 0}, +{ 3, s_3_214, 0, 1, 0}, +{ 3, s_3_215, 0, 1, 0}, +{ 3, s_3_216, 0, 1, 0}, +{ 4, s_3_217, 0, 1, 0}, +{ 3, s_3_218, 0, 1, 0}, +{ 5, s_3_219, -1, 1, 0}, +{ 5, s_3_220, -2, 1, 0}, +{ 5, s_3_221, 0, 1, 0}, +{ 5, s_3_222, 0, 1, 0}, +{ 5, s_3_223, 0, 1, 0}, +{ 3, s_3_224, 0, 1, 0}, +{ 5, s_3_225, -1, 1, 0}, +{ 3, s_3_226, 0, 1, 0}, +{ 4, s_3_227, 0, 1, 0}, +{ 2, s_3_228, 0, 1, 0}, +{ 2, s_3_229, 0, 1, 0}, +{ 3, s_3_230, 0, 1, 0}, +{ 3, s_3_231, 0, 1, 0}, +{ 3, s_3_232, 0, 1, 0}, +{ 2, s_3_233, 0, 1, 0}, +{ 3, s_3_234, 0, 1, 0}, +{ 2, s_3_235, 0, 1, 0}, +{ 4, s_3_236, -1, 1, 0}, +{ 3, s_3_237, 0, 1, 0}, +{ 4, s_3_238, 0, 1, 0}, +{ 4, s_3_239, 0, 1, 0}, +{ 4, s_3_240, 0, 1, 0}, +{ 5, s_3_241, 0, 1, 0}, +{ 5, s_3_242, 0, 1, 0}, +{ 5, s_3_243, 0, 1, 0}, +{ 5, s_3_244, 0, 1, 0}, +{ 7, s_3_245, -1, 1, 0}, +{ 6, s_3_246, 0, 1, 0}, +{ 6, s_3_247, 0, 1, 0}, +{ 5, s_3_248, 0, 1, 0}, +{ 6, s_3_249, 0, 1, 0}, +{ 5, s_3_250, 0, 1, 0}, +{ 5, s_3_251, 0, 1, 0}, +{ 5, s_3_252, 0, 1, 0}, +{ 4, s_3_253, 0, 1, 0}, +{ 6, s_3_254, -1, 1, 0}, +{ 4, s_3_255, 0, 1, 0}, +{ 6, s_3_256, -1, 1, 0}, +{ 6, s_3_257, -2, 1, 0}, +{ 5, s_3_258, 0, 1, 0}, +{ 5, s_3_259, 0, 1, 0}, +{ 6, s_3_260, 0, 1, 0}, +{ 6, s_3_261, 0, 1, 0}, +{ 6, s_3_262, 0, 1, 0}, +{ 6, s_3_263, 0, 1, 0}, +{ 3, s_3_264, 0, 1, 0}, +{ 2, s_3_265, 0, 1, 0}, +{ 3, s_3_266, -1, 1, 0}, +{ 3, s_3_267, 0, 1, 0}, +{ 3, s_3_268, 0, 1, 0}, +{ 3, s_3_269, 0, 1, 0}, +{ 4, s_3_270, 0, 1, 0}, +{ 4, s_3_271, 0, 1, 0}, +{ 5, s_3_272, 0, 1, 0}, +{ 4, s_3_273, 0, 1, 0}, +{ 4, s_3_274, 0, 1, 0}, +{ 4, s_3_275, 0, 1, 0}, +{ 4, s_3_276, 0, 1, 0}, +{ 4, s_3_277, 0, 1, 0}, +{ 4, s_3_278, 0, 1, 0}, +{ 4, s_3_279, 0, 1, 0}, +{ 2, s_3_280, 0, 1, 0}, +{ 3, s_3_281, 0, 1, 0}, +{ 3, s_3_282, 0, 1, 0} +}; + +static const symbol s_4_0[1] = { 'a' }; +static const symbol s_4_1[1] = { 'e' }; +static const symbol s_4_2[1] = { 'i' }; +static const symbol s_4_3[3] = { 0xC3, 0xAF, 'n' }; +static const symbol s_4_4[1] = { 'o' }; +static const symbol s_4_5[2] = { 'i', 'r' }; +static const symbol s_4_6[1] = { 's' }; +static const symbol s_4_7[2] = { 'i', 's' }; +static const symbol s_4_8[2] = { 'o', 's' }; +static const symbol s_4_9[3] = { 0xC3, 0xAF, 's' }; +static const symbol s_4_10[2] = { 'i', 't' }; +static const symbol s_4_11[2] = { 'e', 'u' }; +static const symbol s_4_12[2] = { 'i', 'u' }; +static const symbol s_4_13[3] = { 'i', 'q', 'u' }; +static const symbol s_4_14[3] = { 'i', 't', 'z' }; +static const symbol s_4_15[2] = { 0xC3, 0xA0 }; +static const symbol s_4_16[2] = { 0xC3, 0xA1 }; +static const symbol s_4_17[2] = { 0xC3, 0xA9 }; +static const symbol s_4_18[2] = { 0xC3, 0xAC }; +static const symbol s_4_19[2] = { 0xC3, 0xAD }; +static const symbol s_4_20[2] = { 0xC3, 0xAF }; +static const symbol s_4_21[2] = { 0xC3, 0xB3 }; +static const struct among a_4[22] = { +{ 1, s_4_0, 0, 1, 0}, +{ 1, s_4_1, 0, 1, 0}, +{ 1, s_4_2, 0, 1, 0}, +{ 3, s_4_3, 0, 1, 0}, +{ 1, s_4_4, 0, 1, 0}, +{ 2, s_4_5, 0, 1, 0}, +{ 1, s_4_6, 0, 1, 0}, +{ 2, s_4_7, -1, 1, 0}, +{ 2, s_4_8, -2, 1, 0}, +{ 3, s_4_9, -3, 1, 0}, +{ 2, s_4_10, 0, 1, 0}, +{ 2, s_4_11, 0, 1, 0}, +{ 2, s_4_12, 0, 1, 0}, +{ 3, s_4_13, 0, 2, 0}, +{ 3, s_4_14, 0, 1, 0}, +{ 2, s_4_15, 0, 1, 0}, +{ 2, s_4_16, 0, 1, 0}, +{ 2, s_4_17, 0, 1, 0}, +{ 2, s_4_18, 0, 1, 0}, +{ 2, s_4_19, 0, 1, 0}, +{ 2, s_4_20, 0, 1, 0}, +{ 2, s_4_21, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 81, 6, 10 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { '.' }; +static const symbol s_6[] = { 'l', 'o', 'g' }; +static const symbol s_7[] = { 'i', 'c' }; +static const symbol s_8[] = { 'c' }; +static const symbol s_9[] = { 'i', 'c' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_cleaning(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 5 || !((344765187 >> (z->p[z->c + 1] & 0x1f)) & 1)) among_var = 7; else + among_var = find_among(z, a_0, 13); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1634850 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 39)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_2, 200); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_6); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_3, 283); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_4, 22); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int catalan_UTF_8_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + { + int ret = r_residual_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + { + int v_5 = z->c; + { + int ret = r_cleaning(z); + if (ret < 0) return ret; + } + z->c = v_5; + } + return 1; +} + +extern struct SN_env * catalan_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void catalan_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_catalan.h b/contrib/libs/snowball/src_c/stem_UTF_8_catalan.h new file mode 100644 index 000000000000..efd1052650cd --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_catalan.h @@ -0,0 +1,15 @@ +/* Generated from catalan.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_UTF_8_create_env(void); +extern void catalan_UTF_8_close_env(struct SN_env * z); + +extern int catalan_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_danish.c b/contrib/libs/snowball/src_c/stem_UTF_8_danish.c new file mode 100644 index 000000000000..5bdd8fa000c5 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_danish.c @@ -0,0 +1,342 @@ +/* Generated from danish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int danish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_undouble(struct SN_env * z); +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * danish_UTF_8_create_env(void); +extern void danish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'h', 'e', 'd' }; +static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' }; +static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' }; +static const symbol s_0_3[1] = { 'e' }; +static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' }; +static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' }; +static const symbol s_0_7[3] = { 'e', 'n', 'e' }; +static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' }; +static const symbol s_0_9[3] = { 'e', 'r', 'e' }; +static const symbol s_0_10[2] = { 'e', 'n' }; +static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' }; +static const symbol s_0_13[2] = { 'e', 'r' }; +static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' }; +static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' }; +static const symbol s_0_16[1] = { 's' }; +static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' }; +static const symbol s_0_18[2] = { 'e', 's' }; +static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' }; +static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_0_24[3] = { 'e', 'n', 's' }; +static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' }; +static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' }; +static const symbol s_0_27[3] = { 'e', 'r', 's' }; +static const symbol s_0_28[3] = { 'e', 't', 's' }; +static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' }; +static const symbol s_0_30[2] = { 'e', 't' }; +static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' }; +static const struct among a_0[32] = { +{ 3, s_0_0, 0, 1, 0}, +{ 5, s_0_1, -1, 1, 0}, +{ 4, s_0_2, 0, 1, 0}, +{ 1, s_0_3, 0, 1, 0}, +{ 5, s_0_4, -1, 1, 0}, +{ 4, s_0_5, -2, 1, 0}, +{ 6, s_0_6, -1, 1, 0}, +{ 3, s_0_7, -4, 1, 0}, +{ 4, s_0_8, -5, 1, 0}, +{ 3, s_0_9, -6, 1, 0}, +{ 2, s_0_10, 0, 1, 0}, +{ 5, s_0_11, -1, 1, 0}, +{ 4, s_0_12, -2, 1, 0}, +{ 2, s_0_13, 0, 1, 0}, +{ 5, s_0_14, -1, 1, 0}, +{ 4, s_0_15, -2, 1, 0}, +{ 1, s_0_16, 0, 2, 0}, +{ 4, s_0_17, -1, 1, 0}, +{ 2, s_0_18, -2, 1, 0}, +{ 5, s_0_19, -1, 1, 0}, +{ 7, s_0_20, -1, 1, 0}, +{ 4, s_0_21, -3, 1, 0}, +{ 5, s_0_22, -4, 1, 0}, +{ 4, s_0_23, -5, 1, 0}, +{ 3, s_0_24, -8, 1, 0}, +{ 6, s_0_25, -1, 1, 0}, +{ 5, s_0_26, -2, 1, 0}, +{ 3, s_0_27, -11, 1, 0}, +{ 3, s_0_28, -12, 1, 0}, +{ 5, s_0_29, -1, 1, 0}, +{ 2, s_0_30, 0, 1, 0}, +{ 4, s_0_31, -1, 1, 0} +}; + +static const symbol s_1_0[2] = { 'g', 'd' }; +static const symbol s_1_1[2] = { 'd', 't' }; +static const symbol s_1_2[2] = { 'g', 't' }; +static const symbol s_1_3[2] = { 'k', 't' }; +static const struct among a_1[4] = { +{ 2, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'g' }; +static const symbol s_2_1[3] = { 'l', 'i', 'g' }; +static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_2_3[3] = { 'e', 'l', 's' }; +static const symbol s_2_4[5] = { 'l', 0xC3, 0xB8, 's', 't' }; +static const struct among a_2[5] = { +{ 2, s_2_0, 0, 1, 0}, +{ 3, s_2_1, -1, 1, 0}, +{ 4, s_2_2, -1, 1, 0}, +{ 3, s_2_3, 0, 1, 0}, +{ 5, s_2_4, 0, 2, 0} +}; + +static const unsigned char g_c[] = { 119, 223, 119, 1 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; + +static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }; + +static const symbol s_0[] = { 's', 't' }; +static const symbol s_1[] = { 'i', 'g' }; +static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping_U(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_0, 32); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b_U(z, g_s_ending, 97, 229, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { + int v_1 = z->l - z->c; + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = v_2; return 0; } + if (!find_among_b(z, a_1, 4)) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + z->c = z->l - v_1; + } + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_0))) goto lab0; + z->bra = z->c; + if (!(eq_s_b(z, 2, s_1))) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_2; return 0; } + among_var = find_among_b(z, a_2, 5); + if (!among_var) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (in_grouping_b_U(z, g_c, 98, 122, 0)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + z->lb = v_1; + } + if (!(eq_v_b(z, z->S[0]))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int danish_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_undouble(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * danish_UTF_8_create_env(void) { return SN_create_env(1, 2); } + +extern void danish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_danish.h b/contrib/libs/snowball/src_c/stem_UTF_8_danish.h new file mode 100644 index 000000000000..641145257c38 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_danish.h @@ -0,0 +1,15 @@ +/* Generated from danish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_UTF_8_create_env(void); +extern void danish_UTF_8_close_env(struct SN_env * z); + +extern int danish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_dutch.c b/contrib/libs/snowball/src_c/stem_UTF_8_dutch.c new file mode 100644 index 000000000000..60deaaf30e34 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_dutch.c @@ -0,0 +1,2039 @@ +/* Generated from dutch.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int dutch_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_measure(struct SN_env * z); +static int r_Lose_infix(struct SN_env * z); +static int r_Lose_prefix(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_6(struct SN_env * z); +static int r_Step_7(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1(struct SN_env * z); +static int r_lengthen_V(struct SN_env * z); +static int r_VX(struct SN_env * z); +static int r_V(struct SN_env * z); +static int r_C(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * dutch_UTF_8_create_env(void); +extern void dutch_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 'a' }; +static const symbol s_0_1[1] = { 'e' }; +static const symbol s_0_2[1] = { 'o' }; +static const symbol s_0_3[1] = { 'u' }; +static const symbol s_0_4[2] = { 0xC3, 0xA0 }; +static const symbol s_0_5[2] = { 0xC3, 0xA1 }; +static const symbol s_0_6[2] = { 0xC3, 0xA2 }; +static const symbol s_0_7[2] = { 0xC3, 0xA4 }; +static const symbol s_0_8[2] = { 0xC3, 0xA8 }; +static const symbol s_0_9[2] = { 0xC3, 0xA9 }; +static const symbol s_0_10[2] = { 0xC3, 0xAA }; +static const symbol s_0_11[3] = { 'e', 0xC3, 0xAB }; +static const symbol s_0_12[3] = { 'i', 0xC3, 0xAB }; +static const symbol s_0_13[2] = { 0xC3, 0xB2 }; +static const symbol s_0_14[2] = { 0xC3, 0xB3 }; +static const symbol s_0_15[2] = { 0xC3, 0xB4 }; +static const symbol s_0_16[2] = { 0xC3, 0xB6 }; +static const symbol s_0_17[2] = { 0xC3, 0xB9 }; +static const symbol s_0_18[2] = { 0xC3, 0xBA }; +static const symbol s_0_19[2] = { 0xC3, 0xBB }; +static const symbol s_0_20[2] = { 0xC3, 0xBC }; +static const struct among a_0[21] = { +{ 1, s_0_0, 0, 1, 0}, +{ 1, s_0_1, 0, 2, 0}, +{ 1, s_0_2, 0, 1, 0}, +{ 1, s_0_3, 0, 1, 0}, +{ 2, s_0_4, 0, 1, 0}, +{ 2, s_0_5, 0, 1, 0}, +{ 2, s_0_6, 0, 1, 0}, +{ 2, s_0_7, 0, 1, 0}, +{ 2, s_0_8, 0, 2, 0}, +{ 2, s_0_9, 0, 2, 0}, +{ 2, s_0_10, 0, 2, 0}, +{ 3, s_0_11, 0, 3, 0}, +{ 3, s_0_12, 0, 4, 0}, +{ 2, s_0_13, 0, 1, 0}, +{ 2, s_0_14, 0, 1, 0}, +{ 2, s_0_15, 0, 1, 0}, +{ 2, s_0_16, 0, 1, 0}, +{ 2, s_0_17, 0, 1, 0}, +{ 2, s_0_18, 0, 1, 0}, +{ 2, s_0_19, 0, 1, 0}, +{ 2, s_0_20, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'n', 'd', 'e' }; +static const symbol s_1_1[2] = { 'e', 'n' }; +static const symbol s_1_2[1] = { 's' }; +static const symbol s_1_3[2] = { '\'', 's' }; +static const symbol s_1_4[2] = { 'e', 's' }; +static const symbol s_1_5[3] = { 'i', 'e', 's' }; +static const symbol s_1_6[3] = { 'a', 'u', 's' }; +static const symbol s_1_7[3] = { 0xC3, 0xA9, 's' }; +static const struct among a_1[8] = { +{ 3, s_1_0, 0, 8, 0}, +{ 2, s_1_1, 0, 7, 0}, +{ 1, s_1_2, 0, 2, 0}, +{ 2, s_1_3, -1, 1, 0}, +{ 2, s_1_4, -2, 4, 0}, +{ 3, s_1_5, -1, 3, 0}, +{ 3, s_1_6, -4, 6, 0}, +{ 3, s_1_7, -5, 5, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'e' }; +static const symbol s_2_1[2] = { 'g', 'e' }; +static const symbol s_2_2[5] = { 'i', 's', 'c', 'h', 'e' }; +static const symbol s_2_3[2] = { 'j', 'e' }; +static const symbol s_2_4[5] = { 'l', 'i', 'j', 'k', 'e' }; +static const symbol s_2_5[2] = { 'l', 'e' }; +static const symbol s_2_6[3] = { 'e', 'n', 'e' }; +static const symbol s_2_7[2] = { 'r', 'e' }; +static const symbol s_2_8[2] = { 's', 'e' }; +static const symbol s_2_9[2] = { 't', 'e' }; +static const symbol s_2_10[4] = { 'i', 'e', 'v', 'e' }; +static const struct among a_2[11] = { +{ 2, s_2_0, 0, 5, 0}, +{ 2, s_2_1, 0, 2, 0}, +{ 5, s_2_2, 0, 4, 0}, +{ 2, s_2_3, 0, 1, 0}, +{ 5, s_2_4, 0, 3, 0}, +{ 2, s_2_5, 0, 9, 0}, +{ 3, s_2_6, 0, 10, 0}, +{ 2, s_2_7, 0, 8, 0}, +{ 2, s_2_8, 0, 7, 0}, +{ 2, s_2_9, 0, 6, 0}, +{ 4, s_2_10, 0, 11, 0} +}; + +static const symbol s_3_0[4] = { 'h', 'e', 'i', 'd' }; +static const symbol s_3_1[3] = { 'f', 'i', 'e' }; +static const symbol s_3_2[3] = { 'g', 'i', 'e' }; +static const symbol s_3_3[4] = { 'a', 't', 'i', 'e' }; +static const symbol s_3_4[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_3_5[3] = { 'i', 'n', 'g' }; +static const symbol s_3_6[4] = { 'a', 'r', 'i', 'j' }; +static const symbol s_3_7[4] = { 'e', 'r', 'i', 'j' }; +static const symbol s_3_8[3] = { 's', 'e', 'l' }; +static const symbol s_3_9[4] = { 'r', 'd', 'e', 'r' }; +static const symbol s_3_10[4] = { 's', 't', 'e', 'r' }; +static const symbol s_3_11[5] = { 'i', 't', 'e', 'i', 't' }; +static const symbol s_3_12[3] = { 'd', 's', 't' }; +static const symbol s_3_13[3] = { 't', 's', 't' }; +static const struct among a_3[14] = { +{ 4, s_3_0, 0, 3, 0}, +{ 3, s_3_1, 0, 7, 0}, +{ 3, s_3_2, 0, 8, 0}, +{ 4, s_3_3, 0, 1, 0}, +{ 4, s_3_4, 0, 5, 0}, +{ 3, s_3_5, 0, 5, 0}, +{ 4, s_3_6, 0, 6, 0}, +{ 4, s_3_7, 0, 5, 0}, +{ 3, s_3_8, 0, 3, 0}, +{ 4, s_3_9, 0, 4, 0}, +{ 4, s_3_10, 0, 3, 0}, +{ 5, s_3_11, 0, 2, 0}, +{ 3, s_3_12, 0, 10, 0}, +{ 3, s_3_13, 0, 9, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[5] = { 'a', 't', 'i', 'e', 'f' }; +static const symbol s_4_2[4] = { 'e', 'r', 'i', 'g' }; +static const symbol s_4_3[6] = { 'a', 'c', 'h', 't', 'i', 'g' }; +static const symbol s_4_4[6] = { 'i', 'o', 'n', 'e', 'e', 'l' }; +static const symbol s_4_5[4] = { 'b', 'a', 'a', 'r' }; +static const symbol s_4_6[4] = { 'l', 'a', 'a', 'r' }; +static const symbol s_4_7[4] = { 'n', 'a', 'a', 'r' }; +static const symbol s_4_8[4] = { 'r', 'a', 'a', 'r' }; +static const symbol s_4_9[6] = { 'e', 'r', 'i', 'g', 'e', 'r' }; +static const symbol s_4_10[8] = { 'a', 'c', 'h', 't', 'i', 'g', 'e', 'r' }; +static const symbol s_4_11[6] = { 'l', 'i', 'j', 'k', 'e', 'r' }; +static const symbol s_4_12[4] = { 't', 'a', 'n', 't' }; +static const symbol s_4_13[6] = { 'e', 'r', 'i', 'g', 's', 't' }; +static const symbol s_4_14[8] = { 'a', 'c', 'h', 't', 'i', 'g', 's', 't' }; +static const symbol s_4_15[6] = { 'l', 'i', 'j', 'k', 's', 't' }; +static const struct among a_4[16] = { +{ 3, s_4_0, 0, 9, 0}, +{ 5, s_4_1, 0, 2, 0}, +{ 4, s_4_2, 0, 9, 0}, +{ 6, s_4_3, 0, 3, 0}, +{ 6, s_4_4, 0, 1, 0}, +{ 4, s_4_5, 0, 3, 0}, +{ 4, s_4_6, 0, 5, 0}, +{ 4, s_4_7, 0, 4, 0}, +{ 4, s_4_8, 0, 6, 0}, +{ 6, s_4_9, 0, 9, 0}, +{ 8, s_4_10, 0, 3, 0}, +{ 6, s_4_11, 0, 8, 0}, +{ 4, s_4_12, 0, 7, 0}, +{ 6, s_4_13, 0, 9, 0}, +{ 8, s_4_14, 0, 3, 0}, +{ 6, s_4_15, 0, 8, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'g' }; +static const symbol s_5_1[4] = { 'i', 'g', 'e', 'r' }; +static const symbol s_5_2[4] = { 'i', 'g', 's', 't' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[2] = { 'f', 't' }; +static const symbol s_6_1[2] = { 'k', 't' }; +static const symbol s_6_2[2] = { 'p', 't' }; +static const struct among a_6[3] = { +{ 2, s_6_0, 0, 2, 0}, +{ 2, s_6_1, 0, 1, 0}, +{ 2, s_6_2, 0, 3, 0} +}; + +static const symbol s_7_0[2] = { 'b', 'b' }; +static const symbol s_7_1[2] = { 'c', 'c' }; +static const symbol s_7_2[2] = { 'd', 'd' }; +static const symbol s_7_3[2] = { 'f', 'f' }; +static const symbol s_7_4[2] = { 'g', 'g' }; +static const symbol s_7_5[2] = { 'h', 'h' }; +static const symbol s_7_6[2] = { 'j', 'j' }; +static const symbol s_7_7[2] = { 'k', 'k' }; +static const symbol s_7_8[2] = { 'l', 'l' }; +static const symbol s_7_9[2] = { 'm', 'm' }; +static const symbol s_7_10[2] = { 'n', 'n' }; +static const symbol s_7_11[2] = { 'p', 'p' }; +static const symbol s_7_12[2] = { 'q', 'q' }; +static const symbol s_7_13[2] = { 'r', 'r' }; +static const symbol s_7_14[2] = { 's', 's' }; +static const symbol s_7_15[2] = { 't', 't' }; +static const symbol s_7_16[1] = { 'v' }; +static const symbol s_7_17[2] = { 'v', 'v' }; +static const symbol s_7_18[2] = { 'w', 'w' }; +static const symbol s_7_19[2] = { 'x', 'x' }; +static const symbol s_7_20[1] = { 'z' }; +static const symbol s_7_21[2] = { 'z', 'z' }; +static const struct among a_7[22] = { +{ 2, s_7_0, 0, 1, 0}, +{ 2, s_7_1, 0, 2, 0}, +{ 2, s_7_2, 0, 3, 0}, +{ 2, s_7_3, 0, 4, 0}, +{ 2, s_7_4, 0, 5, 0}, +{ 2, s_7_5, 0, 6, 0}, +{ 2, s_7_6, 0, 7, 0}, +{ 2, s_7_7, 0, 8, 0}, +{ 2, s_7_8, 0, 9, 0}, +{ 2, s_7_9, 0, 10, 0}, +{ 2, s_7_10, 0, 11, 0}, +{ 2, s_7_11, 0, 12, 0}, +{ 2, s_7_12, 0, 13, 0}, +{ 2, s_7_13, 0, 14, 0}, +{ 2, s_7_14, 0, 15, 0}, +{ 2, s_7_15, 0, 16, 0}, +{ 1, s_7_16, 0, 4, 0}, +{ 2, s_7_17, -1, 17, 0}, +{ 2, s_7_18, 0, 18, 0}, +{ 2, s_7_19, 0, 19, 0}, +{ 1, s_7_20, 0, 15, 0}, +{ 2, s_7_21, -1, 20, 0} +}; + +static const symbol s_8_0[1] = { 'd' }; +static const symbol s_8_1[1] = { 't' }; +static const struct among a_8[2] = { +{ 1, s_8_0, 0, 1, 0}, +{ 1, s_8_1, 0, 2, 0} +}; + +static const symbol s_9_1[3] = { 'e', 'f', 't' }; +static const symbol s_9_2[3] = { 'v', 'a', 'a' }; +static const symbol s_9_3[3] = { 'v', 'a', 'l' }; +static const symbol s_9_4[4] = { 'v', 'a', 'l', 'i' }; +static const symbol s_9_5[4] = { 'v', 'a', 'r', 'e' }; +static const struct among a_9[6] = { +{ 0, 0, 0, -1, 0}, +{ 3, s_9_1, -1, 1, 0}, +{ 3, s_9_2, -2, 1, 0}, +{ 3, s_9_3, -3, 1, 0}, +{ 4, s_9_4, -1, -1, 0}, +{ 4, s_9_5, -5, 1, 0} +}; + +static const symbol s_10_0[2] = { 0xC3, 0xAB }; +static const symbol s_10_1[2] = { 0xC3, 0xAF }; +static const struct among a_10[2] = { +{ 2, s_10_0, 0, 1, 0}, +{ 2, s_10_1, 0, 2, 0} +}; + +static const symbol s_11_0[2] = { 0xC3, 0xAB }; +static const symbol s_11_1[2] = { 0xC3, 0xAF }; +static const struct among a_11[2] = { +{ 2, s_11_0, 0, 1, 0}, +{ 2, s_11_1, 0, 2, 0} +}; + +static const unsigned char g_E[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120 }; + +static const unsigned char g_AIOU[] = { 1, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 11, 120, 46, 15 }; + +static const unsigned char g_AEIOU[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const unsigned char g_v_WX[] = { 17, 65, 208, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 139, 127, 46, 15 }; + +static const symbol s_0[] = { 'i', 'j' }; +static const symbol s_1[] = { 'i', 'j' }; +static const symbol s_2[] = { 'i', 'j' }; +static const symbol s_3[] = { 'e', 0xC3, 0xAB, 'e' }; +static const symbol s_4[] = { 'i', 'e', 'e' }; +static const symbol s_5[] = { 'i', 'e' }; +static const symbol s_6[] = { 'a', 'r' }; +static const symbol s_7[] = { 'e', 'r' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 0xC3, 0xA9 }; +static const symbol s_10[] = { 'a', 'u' }; +static const symbol s_11[] = { 'h', 'e', 'd' }; +static const symbol s_12[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_13[] = { 'n', 'd' }; +static const symbol s_14[] = { 'n', 'd' }; +static const symbol s_15[] = { '\'', 't' }; +static const symbol s_16[] = { 'e', 't' }; +static const symbol s_17[] = { 'r', 'n', 't' }; +static const symbol s_18[] = { 'r', 'n' }; +static const symbol s_19[] = { 'i', 'n', 'k' }; +static const symbol s_20[] = { 'i', 'n', 'g' }; +static const symbol s_21[] = { 'm', 'p' }; +static const symbol s_22[] = { 'm' }; +static const symbol s_23[] = { 'g' }; +static const symbol s_24[] = { 'l', 'i', 'j', 'k' }; +static const symbol s_25[] = { 'i', 's', 'c', 'h' }; +static const symbol s_26[] = { 't' }; +static const symbol s_27[] = { 's' }; +static const symbol s_28[] = { 'r' }; +static const symbol s_29[] = { 'l' }; +static const symbol s_30[] = { 'e', 'n' }; +static const symbol s_31[] = { 'i', 'e', 'f' }; +static const symbol s_32[] = { 'e', 'e', 'r' }; +static const symbol s_33[] = { 'r' }; +static const symbol s_34[] = { 'i', 'l', 'd' }; +static const symbol s_35[] = { 'e', 'r' }; +static const symbol s_36[] = { 'a', 'a', 'r' }; +static const symbol s_37[] = { 'f' }; +static const symbol s_38[] = { 'g' }; +static const symbol s_39[] = { 't' }; +static const symbol s_40[] = { 'd' }; +static const symbol s_41[] = { 'i', 'e' }; +static const symbol s_42[] = { 'e', 'e', 'r' }; +static const symbol s_43[] = { 'n' }; +static const symbol s_44[] = { 'l' }; +static const symbol s_45[] = { 'r' }; +static const symbol s_46[] = { 't', 'e', 'e', 'r' }; +static const symbol s_47[] = { 'l', 'i', 'j', 'k' }; +static const symbol s_48[] = { 'i', 'n', 'n' }; +static const symbol s_49[] = { 'k' }; +static const symbol s_50[] = { 'f' }; +static const symbol s_51[] = { 'p' }; +static const symbol s_52[] = { 'b' }; +static const symbol s_53[] = { 'c' }; +static const symbol s_54[] = { 'd' }; +static const symbol s_55[] = { 'f' }; +static const symbol s_56[] = { 'g' }; +static const symbol s_57[] = { 'h' }; +static const symbol s_58[] = { 'j' }; +static const symbol s_59[] = { 'k' }; +static const symbol s_60[] = { 'l' }; +static const symbol s_61[] = { 'm' }; +static const symbol s_62[] = { 'n' }; +static const symbol s_63[] = { 'p' }; +static const symbol s_64[] = { 'q' }; +static const symbol s_65[] = { 'r' }; +static const symbol s_66[] = { 's' }; +static const symbol s_67[] = { 't' }; +static const symbol s_68[] = { 'v' }; +static const symbol s_69[] = { 'w' }; +static const symbol s_70[] = { 'x' }; +static const symbol s_71[] = { 'z' }; +static const symbol s_72[] = { 'i', 'n' }; +static const symbol s_73[] = { 'n' }; +static const symbol s_74[] = { 'e', 'n' }; +static const symbol s_75[] = { 'g', 'e' }; +static const symbol s_76[] = { 'i', 'j' }; +static const symbol s_77[] = { 'i', 'j' }; +static const symbol s_78[] = { 'e' }; +static const symbol s_79[] = { 'i' }; +static const symbol s_80[] = { 'g', 'e' }; +static const symbol s_81[] = { 'i', 'j' }; +static const symbol s_82[] = { 'i', 'j' }; +static const symbol s_83[] = { 'e' }; +static const symbol s_84[] = { 'i' }; +static const symbol s_85[] = { 'i', 'j' }; +static const symbol s_86[] = { 'i', 'j' }; + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_V(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_v, 97, 252, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_0))) return 0; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_VX(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_v, 97, 252, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_1))) return 0; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_C(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_2))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + if (out_grouping_b_U(z, g_v, 97, 252, 0)) return 0; + z->c = z->l - v_1; + } + return 1; +} + +static int r_lengthen_V(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_v_WX, 97, 252, 0)) goto lab0; + z->ket = z->c; + among_var = find_among_b(z, a_0, 21); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (out_grouping_b_U(z, g_AEIOU, 97, 252, 0)) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + if (z->c > z->lb) goto lab0; + } + lab1: + z->c = z->l - v_2; + } + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + { + int saved_c = z->c; + int ret = insert_v(z, z->c, z->c, z->S[0]); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 2: + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + if (out_grouping_b_U(z, g_AEIOU, 97, 252, 0)) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_5; + if (z->c > z->lb) goto lab0; + } + lab3: + { + int v_6 = z->l - z->c; + { + int v_7 = z->l - z->c; + if (in_grouping_b_U(z, g_AIOU, 97, 252, 0)) goto lab7; + goto lab6; + lab7: + z->c = z->l - v_7; + if (in_grouping_b_U(z, g_E, 101, 235, 0)) goto lab5; + if (z->c > z->lb) goto lab5; + } + lab6: + goto lab0; + lab5: + z->c = z->l - v_6; + } + { + int v_8 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab8; + z->c = ret; + } + if (in_grouping_b_U(z, g_AIOU, 97, 252, 0)) goto lab8; + if (out_grouping_b_U(z, g_AEIOU, 97, 252, 0)) goto lab8; + goto lab0; + lab8: + z->c = z->l - v_8; + } + z->c = z->l - v_4; + } + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + { + int saved_c = z->c; + int ret = insert_v(z, z->c, z->c, z->S[0]); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_3); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 3, s_4); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_Step_1(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 8); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 't') goto lab0; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 4: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 2, s_6))) goto lab2; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_7))) goto lab3; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab1; + lab3: + z->c = z->l - v_2; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + } + lab1: + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_V(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + break; + case 7: + { + int v_5 = z->l - z->c; + if (!(eq_s_b(z, 3, s_11))) goto lab5; + { + int ret = r_R1(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_from_s(z, 4, s_12); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_5; + if (!(eq_s_b(z, 2, s_13))) goto lab6; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab6: + z->c = z->l - v_5; + if (z->c <= z->lb || z->p[z->c - 1] != 'd') goto lab7; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab7: + z->c = z->l - v_5; + { + int v_6 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab10; + z->c--; + goto lab9; + lab10: + z->c = z->l - v_6; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab8; + z->c--; + } + lab9: + { + int ret = r_V(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab8: + z->c = z->l - v_5; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } + lab4: + break; + case 8: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 101) return 0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 2, s_15))) goto lab1; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_16))) goto lab2; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab2: + z->c = z->l - v_1; + if (!(eq_s_b(z, 3, s_17))) goto lab3; + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + goto lab0; + lab3: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') goto lab4; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + { + int ret = r_VX(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab4: + z->c = z->l - v_1; + if (!(eq_s_b(z, 3, s_19))) goto lab5; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_20); + if (ret < 0) return ret; + } + goto lab0; + lab5: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_21))) goto lab6; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_22); + if (ret < 0) return ret; + } + goto lab0; + lab6: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != '\'') goto lab7; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab7: + z->c = z->l - v_1; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_23); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_24); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_25); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_26); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_27); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_28); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_29); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 2, s_30); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 11: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1316016 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 14); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_32); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_33); + if (ret < 0) return ret; + } + break; + case 5: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 3, s_34))) goto lab1; + { + int ret = slice_from_s(z, 2, s_35); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } + lab0: + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_36); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_37); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = insert_s(z, z->c, z->c, 1, s_38); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_39); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_40); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1315024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_4, 16); + if (!among_var) goto lab1; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_41); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_42); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_43); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_44); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_V(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_45); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_46); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_47); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = r_R1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = r_C(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret < 0) return ret; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1310848 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_5, 3)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 3, s_48))) goto lab2; + if (z->c > z->lb) goto lab2; + return 0; + lab2: + z->c = z->l - v_2; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_lengthen_V(z); + if (ret <= 0) return ret; + } + } +lab0: + return 1; +} + +static int r_Step_7(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) return 0; + among_var = find_among_b(z, a_6, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_49); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_50); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_51); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_6(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((98532828 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 22); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_52); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_53); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_54); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_55); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_56); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_57); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_58); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 1, s_59); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_60); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_61); + if (ret < 0) return ret; + } + break; + case 11: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab0; + z->c--; + if (z->c > z->lb) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = slice_from_s(z, 1, s_62); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 1, s_63); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 1, s_64); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 1, s_65); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 1, s_66); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 1, s_67); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 1, s_68); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 1, s_69); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 1, s_70); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 1, s_71); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) return 0; + among_var = find_among_b(z, a_8, 2); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_C(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') goto lab0; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_72))) goto lab2; + if (z->c > z->lb) goto lab2; + { + int ret = slice_from_s(z, 1, s_73); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab1: + break; + case 2: + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'h') goto lab3; + z->c--; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + return 0; + lab3: + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_74))) goto lab4; + if (z->c > z->lb) goto lab4; + return 0; + lab4: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Lose_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (!(eq_s(z, 2, s_75))) return 0; + z->ket = z->c; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_76))) goto lab2; + goto lab1; + lab2: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab0; + } + lab1: + break; + lab0: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) return 0; + z->c = ret; + } + } + while (1) { + int v_5 = z->c; + { + int v_6 = z->c; + if (!(eq_s(z, 2, s_77))) goto lab5; + goto lab4; + lab5: + z->c = v_6; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab3; + } + lab4: + continue; + lab3: + z->c = v_5; + break; + } + if (z->c < z->l) goto lab6; + return 0; + lab6: + z->c = v_2; + } + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((1314818 >> (z->p[z->c + 2] & 0x1f)) & 1)) among_var = -1; else + among_var = find_among(z, a_9, 6); + switch (among_var) { + case 1: + return 0; + break; + } + z->I[2] = 1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_7 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 171 && z->p[z->c + 1] != 175)) goto lab7; + among_var = find_among(z, a_10, 2); + if (!among_var) goto lab7; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_78); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_79); + if (ret < 0) return ret; + } + break; + } + lab7: + z->c = v_7; + } + return 1; +} + +static int r_Lose_infix(struct SN_env * z) { + int among_var; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) return 0; + z->c = ret; + } + while (1) { + z->bra = z->c; + if (!(eq_s(z, 2, s_80))) goto lab0; + z->ket = z->c; + break; + lab0: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) return 0; + z->c = ret; + } + } + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_81))) goto lab3; + goto lab2; + lab3: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab1; + } + lab2: + break; + lab1: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) return 0; + z->c = ret; + } + } + while (1) { + int v_5 = z->c; + { + int v_6 = z->c; + if (!(eq_s(z, 2, s_82))) goto lab6; + goto lab5; + lab6: + z->c = v_6; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab4; + } + lab5: + continue; + lab4: + z->c = v_5; + break; + } + if (z->c < z->l) goto lab7; + return 0; + lab7: + z->c = v_2; + } + z->I[2] = 1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_7 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 171 && z->p[z->c + 1] != 175)) goto lab8; + among_var = find_among(z, a_11, 2); + if (!among_var) goto lab8; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_83); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_84); + if (ret < 0) return ret; + } + break; + } + lab8: + z->c = v_7; + } + return 1; +} + +static int r_measure(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + while (1) { + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab1; + continue; + lab1: + break; + } + { + int v_2 = 1; + while (1) { + int v_3 = z->c; + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_85))) goto lab4; + goto lab3; + lab4: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab2; + } + lab3: + v_2--; + continue; + lab2: + z->c = v_3; + break; + } + if (v_2 > 0) goto lab0; + } + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab0; + z->I[1] = z->c; + while (1) { + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab5; + continue; + lab5: + break; + } + { + int v_5 = 1; + while (1) { + int v_6 = z->c; + { + int v_7 = z->c; + if (!(eq_s(z, 2, s_86))) goto lab8; + goto lab7; + lab8: + z->c = v_7; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab6; + } + lab7: + v_5--; + continue; + lab6: + z->c = v_6; + break; + } + if (v_5 > 0) goto lab0; + } + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab0; + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +extern int dutch_UTF_8_stem(struct SN_env * z) { + z->I[3] = 0; + { + int ret = r_measure(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_Step_1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab1: + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab2: + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab3: + z->c = z->l - v_4; + } + z->c = z->lb; + z->I[2] = 0; + { + int v_5 = z->c; + { + int v_6 = z->c; + { + int ret = r_Lose_prefix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + z->c = v_6; + { + int ret = r_measure(z); + if (ret < 0) return ret; + } + } + lab4: + z->c = v_5; + } + z->lb = z->c; z->c = z->l; + { + int v_7 = z->l - z->c; + if (!(z->I[2])) goto lab5; + z->I[3] = 1; + { + int ret = r_Step_1c(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_7; + } + z->c = z->lb; + z->I[2] = 0; + { + int v_8 = z->c; + { + int v_9 = z->c; + { + int ret = r_Lose_infix(z); + if (ret == 0) goto lab6; + if (ret < 0) return ret; + } + z->c = v_9; + { + int ret = r_measure(z); + if (ret < 0) return ret; + } + } + lab6: + z->c = v_8; + } + z->lb = z->c; z->c = z->l; + { + int v_10 = z->l - z->c; + if (!(z->I[2])) goto lab7; + z->I[3] = 1; + { + int ret = r_Step_1c(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + lab7: + z->c = z->l - v_10; + } + z->c = z->lb; + z->lb = z->c; z->c = z->l; + { + int v_11 = z->l - z->c; + { + int ret = r_Step_7(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + z->I[3] = 1; + lab8: + z->c = z->l - v_11; + } + { + int v_12 = z->l - z->c; + if (!(z->I[3])) goto lab9; + { + int ret = r_Step_6(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + lab9: + z->c = z->l - v_12; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * dutch_UTF_8_create_env(void) { return SN_create_env(1, 4); } + +extern void dutch_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_dutch.h b/contrib/libs/snowball/src_c/stem_UTF_8_dutch.h new file mode 100644 index 000000000000..16927ced6f47 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_dutch.h @@ -0,0 +1,15 @@ +/* Generated from dutch.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_UTF_8_create_env(void); +extern void dutch_UTF_8_close_env(struct SN_env * z); + +extern int dutch_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.c b/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.c new file mode 100644 index 000000000000..17230c0f4f5a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.c @@ -0,0 +1,676 @@ +/* Generated from dutch_porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int dutch_porter_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_en_ending(struct SN_env * z); +static int r_e_ending(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * dutch_porter_UTF_8_create_env(void); +extern void dutch_porter_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 0xC3, 0xA1 }; +static const symbol s_0_2[2] = { 0xC3, 0xA4 }; +static const symbol s_0_3[2] = { 0xC3, 0xA9 }; +static const symbol s_0_4[2] = { 0xC3, 0xAB }; +static const symbol s_0_5[2] = { 0xC3, 0xAD }; +static const symbol s_0_6[2] = { 0xC3, 0xAF }; +static const symbol s_0_7[2] = { 0xC3, 0xB3 }; +static const symbol s_0_8[2] = { 0xC3, 0xB6 }; +static const symbol s_0_9[2] = { 0xC3, 0xBA }; +static const symbol s_0_10[2] = { 0xC3, 0xBC }; +static const struct among a_0[11] = { +{ 0, 0, 0, 6, 0}, +{ 2, s_0_1, -1, 1, 0}, +{ 2, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, 2, 0}, +{ 2, s_0_4, -4, 2, 0}, +{ 2, s_0_5, -5, 3, 0}, +{ 2, s_0_6, -6, 3, 0}, +{ 2, s_0_7, -7, 4, 0}, +{ 2, s_0_8, -8, 4, 0}, +{ 2, s_0_9, -9, 5, 0}, +{ 2, s_0_10, -10, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'Y' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_1_1, -1, 2, 0}, +{ 1, s_1_2, -2, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'd' }; +static const symbol s_2_1[2] = { 'k', 'k' }; +static const symbol s_2_2[2] = { 't', 't' }; +static const struct among a_2[3] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0} +}; + +static const symbol s_3_0[3] = { 'e', 'n', 'e' }; +static const symbol s_3_1[2] = { 's', 'e' }; +static const symbol s_3_2[2] = { 'e', 'n' }; +static const symbol s_3_3[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_3_4[1] = { 's' }; +static const struct among a_3[5] = { +{ 3, s_3_0, 0, 2, 0}, +{ 2, s_3_1, 0, 3, 0}, +{ 2, s_3_2, 0, 2, 0}, +{ 5, s_3_3, -1, 1, 0}, +{ 1, s_3_4, 0, 3, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[2] = { 'i', 'g' }; +static const symbol s_4_2[3] = { 'i', 'n', 'g' }; +static const symbol s_4_3[4] = { 'l', 'i', 'j', 'k' }; +static const symbol s_4_4[4] = { 'b', 'a', 'a', 'r' }; +static const symbol s_4_5[3] = { 'b', 'a', 'r' }; +static const struct among a_4[6] = { +{ 3, s_4_0, 0, 1, 0}, +{ 2, s_4_1, 0, 2, 0}, +{ 3, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 3, 0}, +{ 4, s_4_4, 0, 4, 0}, +{ 3, s_4_5, 0, 5, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'o', 'o' }; +static const symbol s_5_3[2] = { 'u', 'u' }; +static const struct among a_5[4] = { +{ 2, s_5_0, 0, -1, 0}, +{ 2, s_5_1, 0, -1, 0}, +{ 2, s_5_2, 0, -1, 0}, +{ 2, s_5_3, 0, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_I[] = { 1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_j[] = { 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { 'Y' }; +static const symbol s_6[] = { 'I' }; +static const symbol s_7[] = { 'Y' }; +static const symbol s_8[] = { 'y' }; +static const symbol s_9[] = { 'i' }; +static const symbol s_10[] = { 'g', 'e', 'm' }; +static const symbol s_11[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_12[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_13[] = { 'e', 'n' }; +static const symbol s_14[] = { 'i', 'g' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 5 || !((340306450 >> (z->p[z->c + 1] & 0x1f)) & 1)) among_var = 6; else + among_var = find_among(z, a_0, 11); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int v_3 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_3; goto lab1; } + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + lab1: + ; + } + while (1) { + int v_4 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 232, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + { + int v_5 = z->c; + z->bra = z->c; + { + int v_6 = z->c; + if (z->c == z->l || z->p[z->c] != 'i') goto lab5; + z->c++; + z->ket = z->c; + { + int v_7 = z->c; + if (in_grouping_U(z, g_v, 97, 232, 0)) goto lab6; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + lab6: + z->c = v_7; + } + goto lab4; + lab5: + z->c = v_6; + if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_5; goto lab3; } + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + } + lab4: + lab3: + ; + } + continue; + lab2: + z->c = v_4; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping_U(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[2] = z->c; + if (z->I[2] >= z->I[0]) goto lab0; + z->I[2] = z->I[0]; +lab0: + { + int ret = out_grouping_U(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 89)) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_undouble(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1050640 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_2, 3)) return 0; + z->c = z->l - v_1; + } + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_e_ending(struct SN_env * z) { + z->I[3] = 0; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[3] = 1; + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_en_ending(struct SN_env * z) { + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - v_1; + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 3, s_10))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_3, 5); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_en_ending(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + if (out_grouping_b_U(z, g_v_j, 97, 232, 0)) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_e_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 4, s_12))) goto lab1; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') goto lab2; + z->c--; + goto lab1; + lab2: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_13))) goto lab1; + z->bra = z->c; + { + int ret = r_en_ending(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + lab1: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((264336 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among_b(z, a_4, 6); + if (!among_var) goto lab3; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_6 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_14))) goto lab5; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int v_7 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab6; + z->c--; + goto lab5; + lab6: + z->c = z->l - v_7; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_6; + { + int ret = r_undouble(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + } + lab4: + break; + case 2: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab7; + z->c--; + goto lab3; + lab7: + z->c = z->l - v_8; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_e_ending(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + if (!(z->I[3])) goto lab3; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab3: + z->c = z->l - v_5; + } + { + int v_9 = z->l - z->c; + if (out_grouping_b_U(z, g_v_I, 73, 232, 0)) goto lab8; + { + int v_10 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2129954 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab8; + if (!find_among_b(z, a_5, 4)) goto lab8; + if (out_grouping_b_U(z, g_v, 97, 232, 0)) goto lab8; + z->c = z->l - v_10; + } + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab8; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab8: + z->c = z->l - v_9; + } + return 1; +} + +extern int dutch_porter_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->lb; + { + int v_3 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_3; + } + return 1; +} + +extern struct SN_env * dutch_porter_UTF_8_create_env(void) { return SN_create_env(0, 4); } + +extern void dutch_porter_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.h b/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.h new file mode 100644 index 000000000000..9941b6a2211d --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_dutch_porter.h @@ -0,0 +1,15 @@ +/* Generated from dutch_porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_porter_UTF_8_create_env(void); +extern void dutch_porter_UTF_8_close_env(struct SN_env * z); + +extern int dutch_porter_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_english.c b/contrib/libs/snowball/src_c/stem_UTF_8_english.c new file mode 100644 index 000000000000..3271613175bb --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_english.c @@ -0,0 +1,1173 @@ +/* Generated from english.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int english_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_exception1(struct SN_env * z); +static int r_Step_5(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * english_UTF_8_create_env(void); +extern void english_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[5] = { 'a', 'r', 's', 'e', 'n' }; +static const symbol s_0_1[6] = { 'c', 'o', 'm', 'm', 'u', 'n' }; +static const symbol s_0_2[5] = { 'e', 'm', 'e', 'r', 'g' }; +static const symbol s_0_3[5] = { 'g', 'e', 'n', 'e', 'r' }; +static const symbol s_0_4[5] = { 'l', 'a', 't', 'e', 'r' }; +static const symbol s_0_5[5] = { 'o', 'r', 'g', 'a', 'n' }; +static const symbol s_0_6[4] = { 'p', 'a', 's', 't' }; +static const symbol s_0_7[7] = { 'u', 'n', 'i', 'v', 'e', 'r', 's' }; +static const struct among a_0[8] = { +{ 5, s_0_0, 0, -1, 0}, +{ 6, s_0_1, 0, -1, 0}, +{ 5, s_0_2, 0, -1, 0}, +{ 5, s_0_3, 0, -1, 0}, +{ 5, s_0_4, 0, -1, 0}, +{ 5, s_0_5, 0, -1, 0}, +{ 4, s_0_6, 0, -1, 0}, +{ 7, s_0_7, 0, -1, 0} +}; + +static const symbol s_1_0[1] = { '\'' }; +static const symbol s_1_1[3] = { '\'', 's', '\'' }; +static const symbol s_1_2[2] = { '\'', 's' }; +static const struct among a_1[3] = { +{ 1, s_1_0, 0, 1, 0}, +{ 3, s_1_1, -1, 1, 0}, +{ 2, s_1_2, 0, 1, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'e', 'd' }; +static const symbol s_2_1[1] = { 's' }; +static const symbol s_2_2[3] = { 'i', 'e', 's' }; +static const symbol s_2_3[4] = { 's', 's', 'e', 's' }; +static const symbol s_2_4[2] = { 's', 's' }; +static const symbol s_2_5[2] = { 'u', 's' }; +static const struct among a_2[6] = { +{ 3, s_2_0, 0, 2, 0}, +{ 1, s_2_1, 0, 3, 0}, +{ 3, s_2_2, -1, 2, 0}, +{ 4, s_2_3, -2, 1, 0}, +{ 2, s_2_4, -3, -1, 0}, +{ 2, s_2_5, -4, -1, 0} +}; + +static const symbol s_3_0[4] = { 's', 'u', 'c', 'c' }; +static const symbol s_3_1[4] = { 'p', 'r', 'o', 'c' }; +static const symbol s_3_2[3] = { 'e', 'x', 'c' }; +static const struct among a_3[3] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 3, s_3_2, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 'e', 'v', 'e', 'n' }; +static const symbol s_4_1[4] = { 'c', 'a', 'n', 'n' }; +static const symbol s_4_2[3] = { 'i', 'n', 'n' }; +static const symbol s_4_3[4] = { 'e', 'a', 'r', 'r' }; +static const symbol s_4_4[4] = { 'h', 'e', 'r', 'r' }; +static const symbol s_4_5[3] = { 'o', 'u', 't' }; +static const symbol s_4_6[1] = { 'y' }; +static const struct among a_4[7] = { +{ 4, s_4_0, 0, 2, 0}, +{ 4, s_4_1, 0, 2, 0}, +{ 3, s_4_2, 0, 2, 0}, +{ 4, s_4_3, 0, 2, 0}, +{ 4, s_4_4, 0, 2, 0}, +{ 3, s_4_5, 0, 2, 0}, +{ 1, s_4_6, 0, 1, 0} +}; + +static const symbol s_5_1[2] = { 'e', 'd' }; +static const symbol s_5_2[3] = { 'e', 'e', 'd' }; +static const symbol s_5_3[3] = { 'i', 'n', 'g' }; +static const symbol s_5_4[4] = { 'e', 'd', 'l', 'y' }; +static const symbol s_5_5[5] = { 'e', 'e', 'd', 'l', 'y' }; +static const symbol s_5_6[5] = { 'i', 'n', 'g', 'l', 'y' }; +static const struct among a_5[7] = { +{ 0, 0, 0, -1, 0}, +{ 2, s_5_1, -1, 2, 0}, +{ 3, s_5_2, -1, 1, 0}, +{ 3, s_5_3, -3, 3, 0}, +{ 4, s_5_4, -4, 2, 0}, +{ 5, s_5_5, -1, 1, 0}, +{ 5, s_5_6, -6, 2, 0} +}; + +static const symbol s_6_1[2] = { 'b', 'b' }; +static const symbol s_6_2[2] = { 'd', 'd' }; +static const symbol s_6_3[2] = { 'f', 'f' }; +static const symbol s_6_4[2] = { 'g', 'g' }; +static const symbol s_6_5[2] = { 'b', 'l' }; +static const symbol s_6_6[2] = { 'm', 'm' }; +static const symbol s_6_7[2] = { 'n', 'n' }; +static const symbol s_6_8[2] = { 'p', 'p' }; +static const symbol s_6_9[2] = { 'r', 'r' }; +static const symbol s_6_10[2] = { 'a', 't' }; +static const symbol s_6_11[2] = { 't', 't' }; +static const symbol s_6_12[2] = { 'i', 'z' }; +static const struct among a_6[13] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_6_1, -1, 2, 0}, +{ 2, s_6_2, -2, 2, 0}, +{ 2, s_6_3, -3, 2, 0}, +{ 2, s_6_4, -4, 2, 0}, +{ 2, s_6_5, -5, 1, 0}, +{ 2, s_6_6, -6, 2, 0}, +{ 2, s_6_7, -7, 2, 0}, +{ 2, s_6_8, -8, 2, 0}, +{ 2, s_6_9, -9, 2, 0}, +{ 2, s_6_10, -10, 1, 0}, +{ 2, s_6_11, -11, 2, 0}, +{ 2, s_6_12, -12, 1, 0} +}; + +static const symbol s_7_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_7_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_7_2[3] = { 'o', 'g', 'i' }; +static const symbol s_7_3[2] = { 'l', 'i' }; +static const symbol s_7_4[3] = { 'b', 'l', 'i' }; +static const symbol s_7_5[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_7_6[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_7_7[5] = { 'f', 'u', 'l', 'l', 'i' }; +static const symbol s_7_8[6] = { 'l', 'e', 's', 's', 'l', 'i' }; +static const symbol s_7_9[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_7_10[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_7_11[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_7_12[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_7_13[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_7_14[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_7_15[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_7_16[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_7_17[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_7_18[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_7_19[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_7_20[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_7_21[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_7_22[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_7_23[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; +static const symbol s_7_24[5] = { 'o', 'g', 'i', 's', 't' }; +static const struct among a_7[25] = { +{ 4, s_7_0, 0, 3, 0}, +{ 4, s_7_1, 0, 2, 0}, +{ 3, s_7_2, 0, 14, 0}, +{ 2, s_7_3, 0, 16, 0}, +{ 3, s_7_4, -1, 12, 0}, +{ 4, s_7_5, -1, 4, 0}, +{ 4, s_7_6, -3, 8, 0}, +{ 5, s_7_7, -4, 9, 0}, +{ 6, s_7_8, -5, 15, 0}, +{ 5, s_7_9, -6, 10, 0}, +{ 5, s_7_10, -7, 5, 0}, +{ 5, s_7_11, 0, 8, 0}, +{ 6, s_7_12, 0, 12, 0}, +{ 5, s_7_13, 0, 11, 0}, +{ 6, s_7_14, 0, 1, 0}, +{ 7, s_7_15, -1, 7, 0}, +{ 5, s_7_16, 0, 8, 0}, +{ 5, s_7_17, 0, 7, 0}, +{ 7, s_7_18, -1, 6, 0}, +{ 4, s_7_19, 0, 6, 0}, +{ 4, s_7_20, 0, 7, 0}, +{ 7, s_7_21, 0, 11, 0}, +{ 7, s_7_22, 0, 9, 0}, +{ 7, s_7_23, 0, 10, 0}, +{ 5, s_7_24, 0, 13, 0} +}; + +static const symbol s_8_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_8_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_8_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_8_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_8_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_8_5[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_8_6[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_8_7[3] = { 'f', 'u', 'l' }; +static const symbol s_8_8[4] = { 'n', 'e', 's', 's' }; +static const struct among a_8[9] = { +{ 5, s_8_0, 0, 4, 0}, +{ 5, s_8_1, 0, 6, 0}, +{ 5, s_8_2, 0, 3, 0}, +{ 5, s_8_3, 0, 4, 0}, +{ 4, s_8_4, 0, 4, 0}, +{ 6, s_8_5, 0, 1, 0}, +{ 7, s_8_6, -1, 2, 0}, +{ 3, s_8_7, 0, 5, 0}, +{ 4, s_8_8, 0, 5, 0} +}; + +static const symbol s_9_0[2] = { 'i', 'c' }; +static const symbol s_9_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_9_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_9_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_9_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_9_5[3] = { 'a', 't', 'e' }; +static const symbol s_9_6[3] = { 'i', 'v', 'e' }; +static const symbol s_9_7[3] = { 'i', 'z', 'e' }; +static const symbol s_9_8[3] = { 'i', 't', 'i' }; +static const symbol s_9_9[2] = { 'a', 'l' }; +static const symbol s_9_10[3] = { 'i', 's', 'm' }; +static const symbol s_9_11[3] = { 'i', 'o', 'n' }; +static const symbol s_9_12[2] = { 'e', 'r' }; +static const symbol s_9_13[3] = { 'o', 'u', 's' }; +static const symbol s_9_14[3] = { 'a', 'n', 't' }; +static const symbol s_9_15[3] = { 'e', 'n', 't' }; +static const symbol s_9_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_9_17[5] = { 'e', 'm', 'e', 'n', 't' }; +static const struct among a_9[18] = { +{ 2, s_9_0, 0, 1, 0}, +{ 4, s_9_1, 0, 1, 0}, +{ 4, s_9_2, 0, 1, 0}, +{ 4, s_9_3, 0, 1, 0}, +{ 4, s_9_4, 0, 1, 0}, +{ 3, s_9_5, 0, 1, 0}, +{ 3, s_9_6, 0, 1, 0}, +{ 3, s_9_7, 0, 1, 0}, +{ 3, s_9_8, 0, 1, 0}, +{ 2, s_9_9, 0, 1, 0}, +{ 3, s_9_10, 0, 1, 0}, +{ 3, s_9_11, 0, 2, 0}, +{ 2, s_9_12, 0, 1, 0}, +{ 3, s_9_13, 0, 1, 0}, +{ 3, s_9_14, 0, 1, 0}, +{ 3, s_9_15, 0, 1, 0}, +{ 4, s_9_16, -1, 1, 0}, +{ 5, s_9_17, -1, 1, 0} +}; + +static const symbol s_10_0[1] = { 'e' }; +static const symbol s_10_1[1] = { 'l' }; +static const struct among a_10[2] = { +{ 1, s_10_0, 0, 1, 0}, +{ 1, s_10_1, 0, 2, 0} +}; + +static const symbol s_11_0[5] = { 'a', 'n', 'd', 'e', 's' }; +static const symbol s_11_1[5] = { 'a', 't', 'l', 'a', 's' }; +static const symbol s_11_2[4] = { 'b', 'i', 'a', 's' }; +static const symbol s_11_3[6] = { 'c', 'o', 's', 'm', 'o', 's' }; +static const symbol s_11_4[5] = { 'e', 'a', 'r', 'l', 'y' }; +static const symbol s_11_5[6] = { 'g', 'e', 'n', 't', 'l', 'y' }; +static const symbol s_11_6[4] = { 'h', 'o', 'w', 'e' }; +static const symbol s_11_7[4] = { 'i', 'd', 'l', 'y' }; +static const symbol s_11_8[4] = { 'n', 'e', 'w', 's' }; +static const symbol s_11_9[4] = { 'o', 'n', 'l', 'y' }; +static const symbol s_11_10[6] = { 's', 'i', 'n', 'g', 'l', 'y' }; +static const symbol s_11_11[5] = { 's', 'k', 'i', 'e', 's' }; +static const symbol s_11_12[3] = { 's', 'k', 'y' }; +static const symbol s_11_13[4] = { 'u', 'g', 'l', 'y' }; +static const struct among a_11[14] = { +{ 5, s_11_0, 0, -1, 0}, +{ 5, s_11_1, 0, -1, 0}, +{ 4, s_11_2, 0, -1, 0}, +{ 6, s_11_3, 0, -1, 0}, +{ 5, s_11_4, 0, 5, 0}, +{ 6, s_11_5, 0, 3, 0}, +{ 4, s_11_6, 0, -1, 0}, +{ 4, s_11_7, 0, 2, 0}, +{ 4, s_11_8, 0, -1, 0}, +{ 4, s_11_9, 0, 6, 0}, +{ 6, s_11_10, 0, 7, 0}, +{ 5, s_11_11, 0, 1, 0}, +{ 3, s_11_12, 0, -1, 0}, +{ 4, s_11_13, 0, 4, 0} +}; + +static const unsigned char g_aeo[] = { 17, 64 }; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const unsigned char g_valid_LI[] = { 55, 141, 2 }; + +static const symbol s_0[] = { 'Y' }; +static const symbol s_1[] = { 'Y' }; +static const symbol s_2[] = { 'p', 'a', 's', 't' }; +static const symbol s_3[] = { 's', 's' }; +static const symbol s_4[] = { 'i' }; +static const symbol s_5[] = { 'i', 'e' }; +static const symbol s_6[] = { 'e', 'e' }; +static const symbol s_7[] = { 'i', 'e' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 'e' }; +static const symbol s_10[] = { 'i' }; +static const symbol s_11[] = { 't', 'i', 'o', 'n' }; +static const symbol s_12[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_13[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_14[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_15[] = { 'e', 'n', 't' }; +static const symbol s_16[] = { 'i', 'z', 'e' }; +static const symbol s_17[] = { 'a', 't', 'e' }; +static const symbol s_18[] = { 'a', 'l' }; +static const symbol s_19[] = { 'f', 'u', 'l' }; +static const symbol s_20[] = { 'o', 'u', 's' }; +static const symbol s_21[] = { 'i', 'v', 'e' }; +static const symbol s_22[] = { 'b', 'l', 'e' }; +static const symbol s_23[] = { 'o', 'g' }; +static const symbol s_24[] = { 'o', 'g' }; +static const symbol s_25[] = { 'l', 'e', 's', 's' }; +static const symbol s_26[] = { 't', 'i', 'o', 'n' }; +static const symbol s_27[] = { 'a', 't', 'e' }; +static const symbol s_28[] = { 'a', 'l' }; +static const symbol s_29[] = { 'i', 'c' }; +static const symbol s_30[] = { 's', 'k', 'y' }; +static const symbol s_31[] = { 'i', 'd', 'l' }; +static const symbol s_32[] = { 'g', 'e', 'n', 't', 'l' }; +static const symbol s_33[] = { 'u', 'g', 'l', 'i' }; +static const symbol s_34[] = { 'e', 'a', 'r', 'l', 'i' }; +static const symbol s_35[] = { 'o', 'n', 'l', 'i' }; +static const symbol s_36[] = { 's', 'i', 'n', 'g', 'l' }; +static const symbol s_37[] = { 'y' }; + +static int r_prelude(struct SN_env * z) { + z->I[2] = 0; + { + int v_1 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != '\'') goto lab0; + z->c++; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab1; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + z->I[2] = 1; + lab1: + z->c = v_2; + } + { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + while (1) { + int v_5 = z->c; + if (in_grouping_U(z, g_v, 97, 121, 0)) goto lab4; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab4; + z->c++; + z->ket = z->c; + z->c = v_5; + break; + lab4: + z->c = v_5; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab3; + z->c = ret; + } + } + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + z->I[2] = 1; + continue; + lab3: + z->c = v_4; + break; + } + z->c = v_3; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (z->c + 3 >= z->l || z->p[z->c + 3] >> 5 != 3 || !((5513250 >> (z->p[z->c + 3] & 0x1f)) & 1)) goto lab2; + if (!find_among(z, a_0, 8)) goto lab2; + goto lab1; + lab2: + z->c = v_2; + { + int ret = out_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_shortv(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_v_WXY, 89, 121, 0)) goto lab1; + if (in_grouping_b_U(z, g_v, 97, 121, 0)) goto lab1; + if (out_grouping_b_U(z, g_v, 97, 121, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (out_grouping_b_U(z, g_v, 97, 121, 0)) goto lab2; + if (in_grouping_b_U(z, g_v, 97, 121, 0)) goto lab2; + if (z->c > z->lb) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_1; + if (!(eq_s_b(z, 4, s_2))) return 0; + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 39 && z->p[z->c - 1] != 115)) { z->c = z->l - v_1; goto lab0; } + if (!find_among_b(z, a_1, 3)) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 115)) return 0; + among_var = find_among_b(z, a_2, 6); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 2); + if (ret < 0) goto lab2; + z->c = ret; + } + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + } + lab1: + break; + case 3: + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + { + int ret = out_grouping_b_U(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33554576 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = -1; else + among_var = find_among_b(z, a_5, 7); + z->bra = z->c; + { + int v_1 = z->l - z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 99) goto lab4; + if (!find_among_b(z, a_3, 3)) goto lab4; + if (z->c > z->lb) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_3; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_6); + if (ret < 0) return ret; + } + } + lab3: + lab2: + z->c = z->l - v_2; + } + break; + case 2: + goto lab1; + break; + case 3: + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((34881536 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_4, 7); + if (!among_var) goto lab1; + switch (among_var) { + case 1: + { + int v_4 = z->l - z->c; + if (out_grouping_b_U(z, g_v, 97, 121, 0)) goto lab1; + if (z->c > z->lb) goto lab1; + z->c = z->l - v_4; + } + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 2: + if (z->c > z->lb) goto lab1; + break; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_5 = z->l - z->c; + { + int ret = out_grouping_b_U(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - v_5; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + z->bra = z->c; + { + int v_6 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_6, 13); + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + return 0; + break; + case 2: + { + int v_7 = z->l - z->c; + if (in_grouping_b_U(z, g_aeo, 97, 111, 0)) goto lab5; + if (z->c > z->lb) goto lab5; + return 0; + lab5: + z->c = z->l - v_7; + } + break; + case 3: + if (z->c != z->I[1]) return 0; + { + int v_8 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_8; + } + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + return 0; + break; + } + z->c = z->l - v_6; + } + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') return 0; + z->c--; + } +lab0: + z->bra = z->c; + if (out_grouping_b_U(z, g_v, 97, 121, 0)) return 0; + if (z->c > z->lb) goto lab2; + return 0; +lab2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1864192 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 25); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_12); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_14); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_15); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 3, s_19); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 3, s_20); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 3, s_22); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 2, s_23); + if (ret < 0) return ret; + } + break; + case 14: + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_from_s(z, 2, s_24); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 4, s_25); + if (ret < 0) return ret; + } + break; + case 16: + if (in_grouping_b_U(z, g_valid_LI, 99, 116, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_8, 9); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_26); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_27); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_28); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_29); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1864232 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_9, 18); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 101 && z->p[z->c - 1] != 108)) return 0; + among_var = find_among_b(z, a_10, 2); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; + lab1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - v_1; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_exception1(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((42750482 >> (z->p[z->c + 2] & 0x1f)) & 1)) return 0; + among_var = find_among(z, a_11, 14); + if (!among_var) return 0; + z->ket = z->c; + if (z->c < z->l) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_30); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 5, s_32); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_33); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_34); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 4, s_35); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 5, s_36); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + if (!(z->I[2])) return 0; + while (1) { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'Y') goto lab1; + z->c++; + z->ket = z->c; + z->c = v_2; + break; + lab1: + z->c = v_2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + { + int ret = slice_from_s(z, 1, s_37); + if (ret < 0) return ret; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +extern int english_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_exception1(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = v_1; + { + int v_2 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) goto lab3; + z->c = ret; + } + goto lab2; + lab3: + z->c = v_2; + } + goto lab0; + lab2: + z->c = v_1; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int ret = r_Step_1a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_Step_1b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_Step_1c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_Step_5(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + z->c = z->lb; + { + int v_10 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_10; + } + } +lab0: + return 1; +} + +extern struct SN_env * english_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void english_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_english.h b/contrib/libs/snowball/src_c/stem_UTF_8_english.h new file mode 100644 index 000000000000..10ae0c7a859b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_english.h @@ -0,0 +1,15 @@ +/* Generated from english.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_UTF_8_create_env(void); +extern void english_UTF_8_close_env(struct SN_env * z); + +extern int english_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.c b/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.c new file mode 100644 index 000000000000..39ef26e4f62c --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.c @@ -0,0 +1,829 @@ +/* Generated from esperanto.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int esperanto_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_uninflected(struct SN_env * z); +static int r_ujn_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_pronoun(struct SN_env * z); +static int r_not_after_letter(struct SN_env * z); +static int r_merged_numeral(struct SN_env * z); +static int r_long_word(struct SN_env * z); +static int r_initial_apostrophe(struct SN_env * z); +static int r_final_apostrophe(struct SN_env * z); +static int r_correlative(struct SN_env * z); +static int r_canonical_form(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * esperanto_UTF_8_create_env(void); +extern void esperanto_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { '-' }; +static const symbol s_0_2[2] = { 'c', 'x' }; +static const symbol s_0_3[2] = { 'g', 'x' }; +static const symbol s_0_4[2] = { 'h', 'x' }; +static const symbol s_0_5[2] = { 'j', 'x' }; +static const symbol s_0_6[1] = { 'q' }; +static const symbol s_0_7[2] = { 's', 'x' }; +static const symbol s_0_8[2] = { 'u', 'x' }; +static const symbol s_0_9[1] = { 'w' }; +static const symbol s_0_10[1] = { 'x' }; +static const symbol s_0_11[1] = { 'y' }; +static const symbol s_0_12[2] = { 0xC3, 0xA1 }; +static const symbol s_0_13[2] = { 0xC3, 0xA9 }; +static const symbol s_0_14[2] = { 0xC3, 0xAD }; +static const symbol s_0_15[2] = { 0xC3, 0xB3 }; +static const symbol s_0_16[2] = { 0xC3, 0xBA }; +static const struct among a_0[17] = { +{ 0, 0, 0, 14, 0}, +{ 1, s_0_1, -1, 13, 0}, +{ 2, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, 2, 0}, +{ 2, s_0_4, -4, 3, 0}, +{ 2, s_0_5, -5, 4, 0}, +{ 1, s_0_6, -6, 12, 0}, +{ 2, s_0_7, -7, 5, 0}, +{ 2, s_0_8, -8, 6, 0}, +{ 1, s_0_9, -9, 12, 0}, +{ 1, s_0_10, -10, 12, 0}, +{ 1, s_0_11, -11, 12, 0}, +{ 2, s_0_12, -12, 7, 0}, +{ 2, s_0_13, -13, 8, 0}, +{ 2, s_0_14, -14, 9, 0}, +{ 2, s_0_15, -15, 10, 0}, +{ 2, s_0_16, -16, 11, 0} +}; + +static const symbol s_1_0[2] = { 'a', 's' }; +static const symbol s_1_1[1] = { 'i' }; +static const symbol s_1_2[2] = { 'i', 's' }; +static const symbol s_1_3[2] = { 'o', 's' }; +static const symbol s_1_4[1] = { 'u' }; +static const symbol s_1_5[2] = { 'u', 's' }; +static const struct among a_1[6] = { +{ 2, s_1_0, 0, -1, 0}, +{ 1, s_1_1, 0, -1, 0}, +{ 2, s_1_2, -1, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 1, s_1_4, 0, -1, 0}, +{ 2, s_1_5, -1, -1, 0} +}; + +static const symbol s_2_0[2] = { 'c', 'i' }; +static const symbol s_2_1[2] = { 'g', 'i' }; +static const symbol s_2_2[2] = { 'h', 'i' }; +static const symbol s_2_3[2] = { 'l', 'i' }; +static const symbol s_2_4[3] = { 'i', 'l', 'i' }; +static const symbol s_2_5[4] = { 0xC5, 0x9D, 'l', 'i' }; +static const symbol s_2_6[2] = { 'm', 'i' }; +static const symbol s_2_7[2] = { 'n', 'i' }; +static const symbol s_2_8[3] = { 'o', 'n', 'i' }; +static const symbol s_2_9[2] = { 'r', 'i' }; +static const symbol s_2_10[2] = { 's', 'i' }; +static const symbol s_2_11[2] = { 'v', 'i' }; +static const symbol s_2_12[3] = { 'i', 'v', 'i' }; +static const symbol s_2_13[3] = { 0xC4, 0x9D, 'i' }; +static const symbol s_2_14[3] = { 0xC5, 0x9D, 'i' }; +static const symbol s_2_15[4] = { 'i', 0xC5, 0x9D, 'i' }; +static const symbol s_2_16[6] = { 'm', 'a', 'l', 0xC5, 0x9D, 'i' }; +static const struct among a_2[17] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, -1, 0}, +{ 3, s_2_4, -1, -1, 0}, +{ 4, s_2_5, -2, -1, 0}, +{ 2, s_2_6, 0, -1, 0}, +{ 2, s_2_7, 0, -1, 0}, +{ 3, s_2_8, -1, -1, 0}, +{ 2, s_2_9, 0, -1, 0}, +{ 2, s_2_10, 0, -1, 0}, +{ 2, s_2_11, 0, -1, 0}, +{ 3, s_2_12, -1, -1, 0}, +{ 3, s_2_13, 0, -1, 0}, +{ 3, s_2_14, 0, -1, 0}, +{ 4, s_2_15, -1, -1, 0}, +{ 6, s_2_16, -2, -1, 0} +}; + +static const symbol s_3_0[3] = { 'a', 'm', 'b' }; +static const symbol s_3_1[4] = { 'b', 'a', 'l', 'd' }; +static const symbol s_3_2[7] = { 'm', 'a', 'l', 'b', 'a', 'l', 'd' }; +static const symbol s_3_3[4] = { 'm', 'o', 'r', 'g' }; +static const symbol s_3_4[8] = { 'p', 'o', 's', 't', 'm', 'o', 'r', 'g' }; +static const symbol s_3_5[3] = { 'a', 'd', 'i' }; +static const symbol s_3_6[4] = { 'h', 'o', 'd', 'i' }; +static const symbol s_3_7[3] = { 'a', 'n', 'k' }; +static const symbol s_3_8[5] = { 0xC4, 0x89, 'i', 'r', 'k' }; +static const symbol s_3_9[8] = { 't', 'u', 't', 0xC4, 0x89, 'i', 'r', 'k' }; +static const symbol s_3_10[5] = { 'p', 'r', 'e', 's', 'k' }; +static const symbol s_3_11[5] = { 'a', 'l', 'm', 'e', 'n' }; +static const symbol s_3_12[4] = { 'a', 'p', 'e', 'n' }; +static const symbol s_3_13[4] = { 'h', 'i', 'e', 'r' }; +static const symbol s_3_14[10] = { 'a', 'n', 't', 'a', 0xC5, 0xAD, 'h', 'i', 'e', 'r' }; +static const symbol s_3_15[5] = { 'm', 'a', 'l', 'g', 'r' }; +static const symbol s_3_16[5] = { 'a', 'n', 'k', 'o', 'r' }; +static const symbol s_3_17[5] = { 'k', 'o', 'n', 't', 'r' }; +static const symbol s_3_18[6] = { 'a', 'n', 's', 't', 'a', 't' }; +static const symbol s_3_19[4] = { 'k', 'v', 'a', 'z' }; +static const struct among a_3[20] = { +{ 3, s_3_0, 0, -1, 0}, +{ 4, s_3_1, 0, -1, 0}, +{ 7, s_3_2, -1, -1, 0}, +{ 4, s_3_3, 0, -1, 0}, +{ 8, s_3_4, -1, -1, 0}, +{ 3, s_3_5, 0, -1, 0}, +{ 4, s_3_6, 0, -1, 0}, +{ 3, s_3_7, 0, -1, 0}, +{ 5, s_3_8, 0, -1, 0}, +{ 8, s_3_9, -1, -1, 0}, +{ 5, s_3_10, 0, -1, 0}, +{ 5, s_3_11, 0, -1, 0}, +{ 4, s_3_12, 0, -1, 0}, +{ 4, s_3_13, 0, -1, 0}, +{ 10, s_3_14, -1, -1, 0}, +{ 5, s_3_15, 0, -1, 0}, +{ 5, s_3_16, 0, -1, 0}, +{ 5, s_3_17, 0, -1, 0}, +{ 6, s_3_18, 0, -1, 0}, +{ 4, s_3_19, 0, -1, 0} +}; + +static const symbol s_4_0[4] = { 'a', 'l', 'i', 'u' }; +static const symbol s_4_1[3] = { 'u', 'n', 'u' }; +static const struct among a_4[2] = { +{ 4, s_4_0, 0, -1, 0}, +{ 3, s_4_1, 0, -1, 0} +}; + +static const symbol s_5_0[3] = { 'a', 'h', 'a' }; +static const symbol s_5_1[4] = { 'h', 'a', 'h', 'a' }; +static const symbol s_5_2[8] = { 'h', 'a', 'l', 'e', 'l', 'u', 'j', 'a' }; +static const symbol s_5_3[4] = { 'h', 'o', 'l', 'a' }; +static const symbol s_5_4[6] = { 'h', 'o', 's', 'a', 'n', 'a' }; +static const symbol s_5_5[6] = { 'm', 'a', 'l', 't', 'r', 'a' }; +static const symbol s_5_6[4] = { 'h', 'u', 'r', 'a' }; +static const symbol s_5_7[6] = { 0xC4, 0xA5, 'a', 0xC4, 0xA5, 'a' }; +static const symbol s_5_8[4] = { 'e', 'k', 'd', 'e' }; +static const symbol s_5_9[4] = { 'e', 'l', 'd', 'e' }; +static const symbol s_5_10[5] = { 'd', 'i', 's', 'd', 'e' }; +static const symbol s_5_11[3] = { 'e', 'h', 'e' }; +static const symbol s_5_12[6] = { 'm', 'a', 'l', 't', 'r', 'e' }; +static const symbol s_5_13[9] = { 'd', 'i', 'r', 'l', 'i', 'd', 'i', 'd', 'i' }; +static const symbol s_5_14[6] = { 'm', 'a', 'l', 'p', 'l', 'i' }; +static const symbol s_5_15[6] = { 'm', 'a', 'l', 0xC4, 0x89, 'i' }; +static const symbol s_5_16[6] = { 'm', 'a', 'l', 'k', 'a', 'j' }; +static const symbol s_5_17[4] = { 'a', 'm', 'e', 'n' }; +static const symbol s_5_18[5] = { 't', 'a', 'm', 'e', 'n' }; +static const symbol s_5_19[3] = { 'o', 'h', 'o' }; +static const symbol s_5_20[6] = { 'm', 'a', 'l', 't', 'r', 'o' }; +static const symbol s_5_21[5] = { 'm', 'i', 'n', 'u', 's' }; +static const symbol s_5_22[3] = { 'u', 'h', 'u' }; +static const symbol s_5_23[3] = { 'm', 'u', 'u' }; +static const struct among a_5[24] = { +{ 3, s_5_0, 0, -1, 0}, +{ 4, s_5_1, -1, -1, 0}, +{ 8, s_5_2, 0, -1, 0}, +{ 4, s_5_3, 0, -1, 0}, +{ 6, s_5_4, 0, -1, 0}, +{ 6, s_5_5, 0, -1, 0}, +{ 4, s_5_6, 0, -1, 0}, +{ 6, s_5_7, 0, -1, 0}, +{ 4, s_5_8, 0, -1, 0}, +{ 4, s_5_9, 0, -1, 0}, +{ 5, s_5_10, 0, -1, 0}, +{ 3, s_5_11, 0, -1, 0}, +{ 6, s_5_12, 0, -1, 0}, +{ 9, s_5_13, 0, -1, 0}, +{ 6, s_5_14, 0, -1, 0}, +{ 6, s_5_15, 0, -1, 0}, +{ 6, s_5_16, 0, -1, 0}, +{ 4, s_5_17, 0, -1, 0}, +{ 5, s_5_18, -1, -1, 0}, +{ 3, s_5_19, 0, -1, 0}, +{ 6, s_5_20, 0, -1, 0}, +{ 5, s_5_21, 0, -1, 0}, +{ 3, s_5_22, 0, -1, 0}, +{ 3, s_5_23, 0, -1, 0} +}; + +static const symbol s_6_0[3] = { 't', 'r', 'i' }; +static const symbol s_6_1[2] = { 'd', 'u' }; +static const symbol s_6_2[3] = { 'u', 'n', 'u' }; +static const struct among a_6[3] = { +{ 3, s_6_0, 0, -1, 0}, +{ 2, s_6_1, 0, -1, 0}, +{ 3, s_6_2, 0, -1, 0} +}; + +static const symbol s_7_0[3] = { 'd', 'e', 'k' }; +static const symbol s_7_1[4] = { 'c', 'e', 'n', 't' }; +static const struct among a_7[2] = { +{ 3, s_7_0, 0, -1, 0}, +{ 4, s_7_1, 0, -1, 0} +}; + +static const symbol s_8_0[1] = { 'k' }; +static const symbol s_8_1[4] = { 'k', 'e', 'l', 'k' }; +static const symbol s_8_2[3] = { 'n', 'e', 'n' }; +static const symbol s_8_3[1] = { 't' }; +static const symbol s_8_4[4] = { 'm', 'u', 'l', 't' }; +static const symbol s_8_5[4] = { 's', 'a', 'm', 't' }; +static const symbol s_8_6[2] = { 0xC4, 0x89 }; +static const struct among a_8[7] = { +{ 1, s_8_0, 0, -1, 0}, +{ 4, s_8_1, -1, -1, 0}, +{ 3, s_8_2, 0, -1, 0}, +{ 1, s_8_3, 0, -1, 0}, +{ 4, s_8_4, -1, -1, 0}, +{ 4, s_8_5, -2, -1, 0}, +{ 2, s_8_6, 0, -1, 0} +}; + +static const symbol s_9_0[1] = { 'a' }; +static const symbol s_9_1[1] = { 'e' }; +static const symbol s_9_2[1] = { 'i' }; +static const symbol s_9_3[1] = { 'j' }; +static const symbol s_9_4[2] = { 'a', 'j' }; +static const symbol s_9_5[2] = { 'o', 'j' }; +static const symbol s_9_6[1] = { 'n' }; +static const symbol s_9_7[2] = { 'a', 'n' }; +static const symbol s_9_8[2] = { 'e', 'n' }; +static const symbol s_9_9[2] = { 'j', 'n' }; +static const symbol s_9_10[3] = { 'a', 'j', 'n' }; +static const symbol s_9_11[3] = { 'o', 'j', 'n' }; +static const symbol s_9_12[2] = { 'o', 'n' }; +static const symbol s_9_13[1] = { 'o' }; +static const symbol s_9_14[2] = { 'a', 's' }; +static const symbol s_9_15[2] = { 'i', 's' }; +static const symbol s_9_16[2] = { 'o', 's' }; +static const symbol s_9_17[2] = { 'u', 's' }; +static const symbol s_9_18[1] = { 'u' }; +static const struct among a_9[19] = { +{ 1, s_9_0, 0, -1, 0}, +{ 1, s_9_1, 0, -1, 0}, +{ 1, s_9_2, 0, -1, 0}, +{ 1, s_9_3, 0, -1, r_not_after_letter}, +{ 2, s_9_4, -1, -1, 0}, +{ 2, s_9_5, -2, -1, 0}, +{ 1, s_9_6, 0, -1, r_not_after_letter}, +{ 2, s_9_7, -1, -1, 0}, +{ 2, s_9_8, -2, -1, 0}, +{ 2, s_9_9, -3, -1, r_not_after_letter}, +{ 3, s_9_10, -1, -1, 0}, +{ 3, s_9_11, -2, -1, 0}, +{ 2, s_9_12, -6, -1, 0}, +{ 1, s_9_13, 0, -1, 0}, +{ 2, s_9_14, 0, -1, 0}, +{ 2, s_9_15, 0, -1, 0}, +{ 2, s_9_16, 0, -1, 0}, +{ 2, s_9_17, 0, -1, 0}, +{ 1, s_9_18, 0, -1, 0} +}; + +static const unsigned char g_vowel[] = { 17, 65, 16 }; + +static const unsigned char g_aou[] = { 1, 64, 16 }; + +static const unsigned char g_digit[] = { 255, 3 }; + +static const symbol s_0[] = { 0xC4, 0x89 }; +static const symbol s_1[] = { 0xC4, 0x9D }; +static const symbol s_2[] = { 0xC4, 0xA5 }; +static const symbol s_3[] = { 0xC4, 0xB5 }; +static const symbol s_4[] = { 0xC5, 0x9D }; +static const symbol s_5[] = { 0xC5, 0xAD }; +static const symbol s_6[] = { 'a' }; +static const symbol s_7[] = { 'e' }; +static const symbol s_8[] = { 'i' }; +static const symbol s_9[] = { 'o' }; +static const symbol s_10[] = { 'u' }; +static const symbol s_11[] = { 's', 't' }; +static const symbol s_12[] = { 'e' }; +static const symbol s_13[] = { 'a' }; +static const symbol s_14[] = { 'u', 'n' }; +static const symbol s_15[] = { 'u' }; +static const symbol s_16[] = { 'a', 0xC5, 0xAD }; +static const symbol s_17[] = { 'o' }; + +static int r_canonical_form(struct SN_env * z) { + int among_var; + z->I[0] = 0; + while (1) { + int v_1 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 17); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + z->I[0] = 1; + break; + case 8: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + z->I[0] = 1; + break; + case 9: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + z->I[0] = 1; + break; + case 10: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + z->I[0] = 1; + break; + case 11: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + z->I[0] = 1; + break; + case 12: + z->I[0] = 1; + break; + case 13: + z->I[0] = 0; + break; + case 14: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + if (!(z->I[0])) goto lab1; + return 0; +lab1: + return 1; +} + +static int r_initial_apostrophe(struct SN_env * z) { + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != '\'') return 0; + z->c++; + z->ket = z->c; + if (!(eq_s(z, 2, s_11))) return 0; + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 3 || !((2130434 >> (z->p[z->c + 0] & 0x1f)) & 1)) return 0; + if (!find_among(z, a_1, 6)) return 0; + if (z->c < z->l) return 0; + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + return 1; +} + +static int r_pronoun(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_1; goto lab0; } + z->c--; + lab0: + ; + } + z->bra = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 105) return 0; + if (!find_among_b(z, a_2, 17)) return 0; + { + int v_2 = z->l - z->c; + if (z->c > z->lb) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0; + z->c--; + } +lab1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_final_apostrophe(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != '\'') return 0; + z->c--; + z->bra = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'l') goto lab1; + z->c--; + if (z->c > z->lb) goto lab1; + { + int ret = slice_from_s(z, 1, s_13); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_14))) goto lab2; + if (z->c > z->lb) goto lab2; + { + int ret = slice_from_s(z, 1, s_15); + if (ret < 0) return ret; + } + goto lab0; + lab2: + z->c = z->l - v_1; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68438676 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3; + if (!find_among_b(z, a_3, 20)) goto lab3; + { + int v_2 = z->l - z->c; + if (z->c > z->lb) goto lab5; + goto lab4; + lab5: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab3; + z->c--; + } + lab4: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + goto lab0; + lab3: + z->c = z->l - v_1; + { + int ret = slice_from_s(z, 1, s_17); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_ujn_suffix(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_1; goto lab0; } + z->c--; + lab0: + ; + } + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') { z->c = z->l - v_2; goto lab1; } + z->c--; + lab1: + ; + } + z->bra = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 117) return 0; + if (!find_among_b(z, a_4, 2)) return 0; + { + int v_3 = z->l - z->c; + if (z->c > z->lb) goto lab3; + goto lab2; + lab3: + z->c = z->l - v_3; + if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0; + z->c--; + } +lab2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_uninflected(struct SN_env * z) { + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2672162 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_5, 24)) return 0; + { + int v_1 = z->l - z->c; + if (z->c > z->lb) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0; + z->c--; + } +lab0: + return 1; +} + +static int r_merged_numeral(struct SN_env * z) { + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 117)) return 0; + if (!find_among_b(z, a_6, 3)) return 0; + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 107 && z->p[z->c - 1] != 116)) return 0; + if (!find_among_b(z, a_7, 2)) return 0; + return 1; +} + +static int r_correlative(struct SN_env * z) { + z->ket = z->c; + z->bra = z->c; + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_3; goto lab2; } + z->c--; + lab2: + ; + } + z->bra = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_2; + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_4; goto lab3; } + z->c--; + lab3: + ; + } + { + int v_5 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') { z->c = z->l - v_5; goto lab4; } + z->c--; + lab4: + ; + } + z->bra = z->c; + if (in_grouping_b_U(z, g_aou, 97, 117, 0)) return 0; + } + lab0: + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + { + int v_6 = z->l - z->c; + if (!find_among_b(z, a_8, 7)) { z->c = z->l - v_6; goto lab5; } + lab5: + ; + } + { + int v_7 = z->l - z->c; + if (z->c > z->lb) goto lab7; + goto lab6; + lab7: + z->c = z->l - v_7; + if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0; + z->c--; + } + lab6: + z->c = z->l - v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_long_word(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int i; for (i = 2; i > 0; i--) { + { + int ret = out_grouping_b_U(z, g_vowel, 97, 117, 1); + if (ret < 0) goto lab1; + z->c -= ret; + } + } + } + goto lab0; + lab1: + z->c = z->l - v_1; + while (1) { + if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab3; + z->c--; + break; + lab3: + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + } + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + goto lab0; + lab2: + z->c = z->l - v_1; + { + int ret = out_grouping_b_U(z, g_digit, 48, 57, 1); + if (ret < 0) return 0; + z->c -= ret; + } + } +lab0: + return 1; +} + +static int r_not_after_letter(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (in_grouping_b_U(z, g_digit, 48, 57, 0)) return 0; + } +lab0: + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2672162 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_9, 19)) return 0; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != '-') { z->c = z->l - v_1; goto lab0; } + z->c--; + lab0: + ; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int esperanto_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_canonical_form(z); + if (ret <= 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_initial_apostrophe(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int ret = r_pronoun(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_final_apostrophe(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_correlative(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + return 0; + lab1: + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_uninflected(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_merged_numeral(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + return 0; + lab3: + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_ujn_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + return 0; + lab4: + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_long_word(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_9; + } + { + int ret = r_standard_suffix(z); + if (ret <= 0) return ret; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * esperanto_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void esperanto_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.h b/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.h new file mode 100644 index 000000000000..97c20508968c --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_esperanto.h @@ -0,0 +1,15 @@ +/* Generated from esperanto.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * esperanto_UTF_8_create_env(void); +extern void esperanto_UTF_8_close_env(struct SN_env * z); + +extern int esperanto_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_estonian.c b/contrib/libs/snowball/src_c/stem_UTF_8_estonian.c new file mode 100644 index 000000000000..08f8597551dd --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_estonian.c @@ -0,0 +1,1481 @@ +/* Generated from estonian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int estonian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_nu(struct SN_env * z); +static int r_verb(struct SN_env * z); +static int r_verb_exceptions(struct SN_env * z); +static int r_substantive(struct SN_env * z); +static int r_degrees(struct SN_env * z); +static int r_i_plural(struct SN_env * z); +static int r_undouble_kpt(struct SN_env * z); +static int r_plural_three_first_cases(struct SN_env * z); +static int r_emphasis(struct SN_env * z); +static int r_case_ending(struct SN_env * z); +static int r_special_noun_endings(struct SN_env * z); +static int r_LONGV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * estonian_UTF_8_create_env(void); +extern void estonian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'g', 'i' }; +static const symbol s_0_1[2] = { 'k', 'i' }; +static const struct among a_0[2] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 2, 0} +}; + +static const symbol s_1_0[2] = { 'd', 'a' }; +static const symbol s_1_1[4] = { 'm', 'a', 't', 'a' }; +static const symbol s_1_2[1] = { 'b' }; +static const symbol s_1_3[4] = { 'k', 's', 'i', 'd' }; +static const symbol s_1_4[6] = { 'n', 'u', 'k', 's', 'i', 'd' }; +static const symbol s_1_5[2] = { 'm', 'e' }; +static const symbol s_1_6[4] = { 's', 'i', 'm', 'e' }; +static const symbol s_1_7[5] = { 'k', 's', 'i', 'm', 'e' }; +static const symbol s_1_8[7] = { 'n', 'u', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_1_9[4] = { 'a', 'k', 's', 'e' }; +static const symbol s_1_10[5] = { 'd', 'a', 'k', 's', 'e' }; +static const symbol s_1_11[5] = { 't', 'a', 'k', 's', 'e' }; +static const symbol s_1_12[4] = { 's', 'i', 't', 'e' }; +static const symbol s_1_13[5] = { 'k', 's', 'i', 't', 'e' }; +static const symbol s_1_14[7] = { 'n', 'u', 'k', 's', 'i', 't', 'e' }; +static const symbol s_1_15[1] = { 'n' }; +static const symbol s_1_16[3] = { 's', 'i', 'n' }; +static const symbol s_1_17[4] = { 'k', 's', 'i', 'n' }; +static const symbol s_1_18[6] = { 'n', 'u', 'k', 's', 'i', 'n' }; +static const symbol s_1_19[4] = { 'd', 'a', 'k', 's' }; +static const symbol s_1_20[4] = { 't', 'a', 'k', 's' }; +static const struct among a_1[21] = { +{ 2, s_1_0, 0, 3, 0}, +{ 4, s_1_1, 0, 1, 0}, +{ 1, s_1_2, 0, 3, 0}, +{ 4, s_1_3, 0, 1, 0}, +{ 6, s_1_4, -1, 1, 0}, +{ 2, s_1_5, 0, 3, 0}, +{ 4, s_1_6, -1, 1, 0}, +{ 5, s_1_7, -1, 1, 0}, +{ 7, s_1_8, -1, 1, 0}, +{ 4, s_1_9, 0, 2, 0}, +{ 5, s_1_10, -1, 1, 0}, +{ 5, s_1_11, -2, 1, 0}, +{ 4, s_1_12, 0, 1, 0}, +{ 5, s_1_13, -1, 1, 0}, +{ 7, s_1_14, -1, 1, 0}, +{ 1, s_1_15, 0, 3, 0}, +{ 3, s_1_16, -1, 1, 0}, +{ 4, s_1_17, -1, 1, 0}, +{ 6, s_1_18, -1, 1, 0}, +{ 4, s_1_19, 0, 1, 0}, +{ 4, s_1_20, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'a', 'a' }; +static const symbol s_2_1[2] = { 'e', 'e' }; +static const symbol s_2_2[2] = { 'i', 'i' }; +static const symbol s_2_3[2] = { 'o', 'o' }; +static const symbol s_2_4[2] = { 'u', 'u' }; +static const symbol s_2_5[4] = { 0xC3, 0xA4, 0xC3, 0xA4 }; +static const symbol s_2_6[4] = { 0xC3, 0xB5, 0xC3, 0xB5 }; +static const symbol s_2_7[4] = { 0xC3, 0xB6, 0xC3, 0xB6 }; +static const symbol s_2_8[4] = { 0xC3, 0xBC, 0xC3, 0xBC }; +static const struct among a_2[9] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, -1, 0}, +{ 2, s_2_4, 0, -1, 0}, +{ 4, s_2_5, 0, -1, 0}, +{ 4, s_2_6, 0, -1, 0}, +{ 4, s_2_7, 0, -1, 0}, +{ 4, s_2_8, 0, -1, 0} +}; + +static const symbol s_3_0[1] = { 'i' }; +static const struct among a_3[1] = { +{ 1, s_3_0, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 'l', 'a', 'n', 'e' }; +static const symbol s_4_1[4] = { 'l', 'i', 'n', 'e' }; +static const symbol s_4_2[4] = { 'm', 'i', 'n', 'e' }; +static const symbol s_4_3[5] = { 'l', 'a', 's', 's', 'e' }; +static const symbol s_4_4[5] = { 'l', 'i', 's', 's', 'e' }; +static const symbol s_4_5[5] = { 'm', 'i', 's', 's', 'e' }; +static const symbol s_4_6[4] = { 'l', 'a', 's', 'i' }; +static const symbol s_4_7[4] = { 'l', 'i', 's', 'i' }; +static const symbol s_4_8[4] = { 'm', 'i', 's', 'i' }; +static const symbol s_4_9[4] = { 'l', 'a', 's', 't' }; +static const symbol s_4_10[4] = { 'l', 'i', 's', 't' }; +static const symbol s_4_11[4] = { 'm', 'i', 's', 't' }; +static const struct among a_4[12] = { +{ 4, s_4_0, 0, 1, 0}, +{ 4, s_4_1, 0, 3, 0}, +{ 4, s_4_2, 0, 2, 0}, +{ 5, s_4_3, 0, 1, 0}, +{ 5, s_4_4, 0, 3, 0}, +{ 5, s_4_5, 0, 2, 0}, +{ 4, s_4_6, 0, 1, 0}, +{ 4, s_4_7, 0, 3, 0}, +{ 4, s_4_8, 0, 2, 0}, +{ 4, s_4_9, 0, 1, 0}, +{ 4, s_4_10, 0, 3, 0}, +{ 4, s_4_11, 0, 2, 0} +}; + +static const symbol s_5_0[2] = { 'g', 'a' }; +static const symbol s_5_1[2] = { 't', 'a' }; +static const symbol s_5_2[2] = { 'l', 'e' }; +static const symbol s_5_3[3] = { 's', 's', 'e' }; +static const symbol s_5_4[1] = { 'l' }; +static const symbol s_5_5[1] = { 's' }; +static const symbol s_5_6[2] = { 'k', 's' }; +static const symbol s_5_7[1] = { 't' }; +static const symbol s_5_8[2] = { 'l', 't' }; +static const symbol s_5_9[2] = { 's', 't' }; +static const struct among a_5[10] = { +{ 2, s_5_0, 0, 1, 0}, +{ 2, s_5_1, 0, 1, 0}, +{ 2, s_5_2, 0, 1, 0}, +{ 3, s_5_3, 0, 1, 0}, +{ 1, s_5_4, 0, 1, 0}, +{ 1, s_5_5, 0, 1, 0}, +{ 2, s_5_6, -1, 1, 0}, +{ 1, s_5_7, 0, 2, 0}, +{ 2, s_5_8, -1, 1, 0}, +{ 2, s_5_9, -2, 1, 0} +}; + +static const symbol s_6_1[3] = { 'l', 'a', 's' }; +static const symbol s_6_2[3] = { 'l', 'i', 's' }; +static const symbol s_6_3[3] = { 'm', 'i', 's' }; +static const symbol s_6_4[1] = { 't' }; +static const struct among a_6[5] = { +{ 0, 0, 0, 2, 0}, +{ 3, s_6_1, -1, 1, 0}, +{ 3, s_6_2, -2, 1, 0}, +{ 3, s_6_3, -3, 1, 0}, +{ 1, s_6_4, -4, -1, 0} +}; + +static const symbol s_7_0[1] = { 'd' }; +static const symbol s_7_1[3] = { 's', 'i', 'd' }; +static const symbol s_7_2[2] = { 'd', 'e' }; +static const symbol s_7_3[6] = { 'i', 'k', 'k', 'u', 'd', 'e' }; +static const symbol s_7_4[3] = { 'i', 'k', 'e' }; +static const symbol s_7_5[4] = { 'i', 'k', 'k', 'e' }; +static const symbol s_7_6[2] = { 't', 'e' }; +static const struct among a_7[7] = { +{ 1, s_7_0, 0, 4, 0}, +{ 3, s_7_1, -1, 2, 0}, +{ 2, s_7_2, 0, 4, 0}, +{ 6, s_7_3, -1, 1, 0}, +{ 3, s_7_4, 0, 1, 0}, +{ 4, s_7_5, 0, 1, 0}, +{ 2, s_7_6, 0, 3, 0} +}; + +static const symbol s_8_0[2] = { 'v', 'a' }; +static const symbol s_8_1[2] = { 'd', 'u' }; +static const symbol s_8_2[2] = { 'n', 'u' }; +static const symbol s_8_3[2] = { 't', 'u' }; +static const struct among a_8[4] = { +{ 2, s_8_0, 0, -1, 0}, +{ 2, s_8_1, 0, -1, 0}, +{ 2, s_8_2, 0, -1, 0}, +{ 2, s_8_3, 0, -1, 0} +}; + +static const symbol s_9_0[2] = { 'k', 'k' }; +static const symbol s_9_1[2] = { 'p', 'p' }; +static const symbol s_9_2[2] = { 't', 't' }; +static const struct among a_9[3] = { +{ 2, s_9_0, 0, 1, 0}, +{ 2, s_9_1, 0, 2, 0}, +{ 2, s_9_2, 0, 3, 0} +}; + +static const symbol s_10_0[2] = { 'm', 'a' }; +static const symbol s_10_1[3] = { 'm', 'a', 'i' }; +static const symbol s_10_2[1] = { 'm' }; +static const struct among a_10[3] = { +{ 2, s_10_0, 0, 2, 0}, +{ 3, s_10_1, 0, 1, 0}, +{ 1, s_10_2, 0, 1, 0} +}; + +static const symbol s_11_0[4] = { 'j', 'o', 'o', 'b' }; +static const symbol s_11_1[4] = { 'j', 'o', 'o', 'd' }; +static const symbol s_11_2[8] = { 'j', 'o', 'o', 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_3[5] = { 'j', 'o', 'o', 'm', 'a' }; +static const symbol s_11_4[7] = { 'j', 'o', 'o', 'm', 'a', 't', 'a' }; +static const symbol s_11_5[5] = { 'j', 'o', 'o', 'm', 'e' }; +static const symbol s_11_6[4] = { 'j', 'o', 'o', 'n' }; +static const symbol s_11_7[5] = { 'j', 'o', 'o', 't', 'e' }; +static const symbol s_11_8[6] = { 'j', 'o', 'o', 'v', 'a', 'd' }; +static const symbol s_11_9[4] = { 'j', 'u', 'u', 'a' }; +static const symbol s_11_10[7] = { 'j', 'u', 'u', 'a', 'k', 's', 'e' }; +static const symbol s_11_11[4] = { 'j', 0xC3, 0xA4, 'i' }; +static const symbol s_11_12[5] = { 'j', 0xC3, 0xA4, 'i', 'd' }; +static const symbol s_11_13[6] = { 'j', 0xC3, 0xA4, 'i', 'm', 'e' }; +static const symbol s_11_14[5] = { 'j', 0xC3, 0xA4, 'i', 'n' }; +static const symbol s_11_15[6] = { 'j', 0xC3, 0xA4, 'i', 't', 'e' }; +static const symbol s_11_16[6] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'b' }; +static const symbol s_11_17[6] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'd' }; +static const symbol s_11_18[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'd', 'a' }; +static const symbol s_11_19[10] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_20[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'd', 'i' }; +static const symbol s_11_21[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'k', 's' }; +static const symbol s_11_22[9] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'k', 's', 'i', 'd' }; +static const symbol s_11_23[10] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_24[9] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'k', 's', 'i', 'n' }; +static const symbol s_11_25[10] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_26[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'm', 'a' }; +static const symbol s_11_27[9] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'm', 'a', 't', 'a' }; +static const symbol s_11_28[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'm', 'e' }; +static const symbol s_11_29[6] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'n' }; +static const symbol s_11_30[7] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 't', 'e' }; +static const symbol s_11_31[8] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'v', 'a', 'd' }; +static const symbol s_11_32[4] = { 'j', 0xC3, 0xB5, 'i' }; +static const symbol s_11_33[5] = { 'j', 0xC3, 0xB5, 'i', 'd' }; +static const symbol s_11_34[6] = { 'j', 0xC3, 0xB5, 'i', 'm', 'e' }; +static const symbol s_11_35[5] = { 'j', 0xC3, 0xB5, 'i', 'n' }; +static const symbol s_11_36[6] = { 'j', 0xC3, 0xB5, 'i', 't', 'e' }; +static const symbol s_11_37[4] = { 'k', 'e', 'e', 'b' }; +static const symbol s_11_38[4] = { 'k', 'e', 'e', 'd' }; +static const symbol s_11_39[8] = { 'k', 'e', 'e', 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_40[5] = { 'k', 'e', 'e', 'k', 's' }; +static const symbol s_11_41[7] = { 'k', 'e', 'e', 'k', 's', 'i', 'd' }; +static const symbol s_11_42[8] = { 'k', 'e', 'e', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_43[7] = { 'k', 'e', 'e', 'k', 's', 'i', 'n' }; +static const symbol s_11_44[8] = { 'k', 'e', 'e', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_45[5] = { 'k', 'e', 'e', 'm', 'a' }; +static const symbol s_11_46[7] = { 'k', 'e', 'e', 'm', 'a', 't', 'a' }; +static const symbol s_11_47[5] = { 'k', 'e', 'e', 'm', 'e' }; +static const symbol s_11_48[4] = { 'k', 'e', 'e', 'n' }; +static const symbol s_11_49[4] = { 'k', 'e', 'e', 's' }; +static const symbol s_11_50[5] = { 'k', 'e', 'e', 't', 'a' }; +static const symbol s_11_51[5] = { 'k', 'e', 'e', 't', 'e' }; +static const symbol s_11_52[6] = { 'k', 'e', 'e', 'v', 'a', 'd' }; +static const symbol s_11_53[5] = { 'k', 0xC3, 0xA4, 'i', 'a' }; +static const symbol s_11_54[8] = { 'k', 0xC3, 0xA4, 'i', 'a', 'k', 's', 'e' }; +static const symbol s_11_55[5] = { 'k', 0xC3, 0xA4, 'i', 'b' }; +static const symbol s_11_56[5] = { 'k', 0xC3, 0xA4, 'i', 'd' }; +static const symbol s_11_57[6] = { 'k', 0xC3, 0xA4, 'i', 'd', 'i' }; +static const symbol s_11_58[6] = { 'k', 0xC3, 0xA4, 'i', 'k', 's' }; +static const symbol s_11_59[8] = { 'k', 0xC3, 0xA4, 'i', 'k', 's', 'i', 'd' }; +static const symbol s_11_60[9] = { 'k', 0xC3, 0xA4, 'i', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_61[8] = { 'k', 0xC3, 0xA4, 'i', 'k', 's', 'i', 'n' }; +static const symbol s_11_62[9] = { 'k', 0xC3, 0xA4, 'i', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_63[6] = { 'k', 0xC3, 0xA4, 'i', 'm', 'a' }; +static const symbol s_11_64[8] = { 'k', 0xC3, 0xA4, 'i', 'm', 'a', 't', 'a' }; +static const symbol s_11_65[6] = { 'k', 0xC3, 0xA4, 'i', 'm', 'e' }; +static const symbol s_11_66[5] = { 'k', 0xC3, 0xA4, 'i', 'n' }; +static const symbol s_11_67[5] = { 'k', 0xC3, 0xA4, 'i', 's' }; +static const symbol s_11_68[6] = { 'k', 0xC3, 0xA4, 'i', 't', 'e' }; +static const symbol s_11_69[7] = { 'k', 0xC3, 0xA4, 'i', 'v', 'a', 'd' }; +static const symbol s_11_70[4] = { 'l', 'a', 'o', 'b' }; +static const symbol s_11_71[4] = { 'l', 'a', 'o', 'd' }; +static const symbol s_11_72[5] = { 'l', 'a', 'o', 'k', 's' }; +static const symbol s_11_73[7] = { 'l', 'a', 'o', 'k', 's', 'i', 'd' }; +static const symbol s_11_74[8] = { 'l', 'a', 'o', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_75[7] = { 'l', 'a', 'o', 'k', 's', 'i', 'n' }; +static const symbol s_11_76[8] = { 'l', 'a', 'o', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_77[5] = { 'l', 'a', 'o', 'm', 'e' }; +static const symbol s_11_78[4] = { 'l', 'a', 'o', 'n' }; +static const symbol s_11_79[5] = { 'l', 'a', 'o', 't', 'e' }; +static const symbol s_11_80[6] = { 'l', 'a', 'o', 'v', 'a', 'd' }; +static const symbol s_11_81[4] = { 'l', 'o', 'e', 'b' }; +static const symbol s_11_82[4] = { 'l', 'o', 'e', 'd' }; +static const symbol s_11_83[5] = { 'l', 'o', 'e', 'k', 's' }; +static const symbol s_11_84[7] = { 'l', 'o', 'e', 'k', 's', 'i', 'd' }; +static const symbol s_11_85[8] = { 'l', 'o', 'e', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_86[7] = { 'l', 'o', 'e', 'k', 's', 'i', 'n' }; +static const symbol s_11_87[8] = { 'l', 'o', 'e', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_88[5] = { 'l', 'o', 'e', 'm', 'e' }; +static const symbol s_11_89[4] = { 'l', 'o', 'e', 'n' }; +static const symbol s_11_90[5] = { 'l', 'o', 'e', 't', 'e' }; +static const symbol s_11_91[6] = { 'l', 'o', 'e', 'v', 'a', 'd' }; +static const symbol s_11_92[4] = { 'l', 'o', 'o', 'b' }; +static const symbol s_11_93[4] = { 'l', 'o', 'o', 'd' }; +static const symbol s_11_94[5] = { 'l', 'o', 'o', 'd', 'i' }; +static const symbol s_11_95[5] = { 'l', 'o', 'o', 'k', 's' }; +static const symbol s_11_96[7] = { 'l', 'o', 'o', 'k', 's', 'i', 'd' }; +static const symbol s_11_97[8] = { 'l', 'o', 'o', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_98[7] = { 'l', 'o', 'o', 'k', 's', 'i', 'n' }; +static const symbol s_11_99[8] = { 'l', 'o', 'o', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_100[5] = { 'l', 'o', 'o', 'm', 'a' }; +static const symbol s_11_101[7] = { 'l', 'o', 'o', 'm', 'a', 't', 'a' }; +static const symbol s_11_102[5] = { 'l', 'o', 'o', 'm', 'e' }; +static const symbol s_11_103[4] = { 'l', 'o', 'o', 'n' }; +static const symbol s_11_104[5] = { 'l', 'o', 'o', 't', 'e' }; +static const symbol s_11_105[6] = { 'l', 'o', 'o', 'v', 'a', 'd' }; +static const symbol s_11_106[4] = { 'l', 'u', 'u', 'a' }; +static const symbol s_11_107[7] = { 'l', 'u', 'u', 'a', 'k', 's', 'e' }; +static const symbol s_11_108[4] = { 'l', 0xC3, 0xB5, 'i' }; +static const symbol s_11_109[5] = { 'l', 0xC3, 0xB5, 'i', 'd' }; +static const symbol s_11_110[6] = { 'l', 0xC3, 0xB5, 'i', 'm', 'e' }; +static const symbol s_11_111[5] = { 'l', 0xC3, 0xB5, 'i', 'n' }; +static const symbol s_11_112[6] = { 'l', 0xC3, 0xB5, 'i', 't', 'e' }; +static const symbol s_11_113[6] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'b' }; +static const symbol s_11_114[6] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'd' }; +static const symbol s_11_115[10] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_116[7] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'd', 'i' }; +static const symbol s_11_117[7] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's' }; +static const symbol s_11_118[9] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'd' }; +static const symbol s_11_119[10] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_120[9] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'n' }; +static const symbol s_11_121[10] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_122[7] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'a' }; +static const symbol s_11_123[9] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'a', 't', 'a' }; +static const symbol s_11_124[7] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'e' }; +static const symbol s_11_125[6] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'n' }; +static const symbol s_11_126[7] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 't', 'e' }; +static const symbol s_11_127[8] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6, 'v', 'a', 'd' }; +static const symbol s_11_128[6] = { 'l', 0xC3, 0xBC, 0xC3, 0xBC, 'a' }; +static const symbol s_11_129[9] = { 'l', 0xC3, 0xBC, 0xC3, 0xBC, 'a', 'k', 's', 'e' }; +static const symbol s_11_130[6] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'a' }; +static const symbol s_11_131[9] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'a', 'k', 's', 'e' }; +static const symbol s_11_132[6] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'b' }; +static const symbol s_11_133[6] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'd' }; +static const symbol s_11_134[7] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'd', 'i' }; +static const symbol s_11_135[7] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'k', 's' }; +static const symbol s_11_136[9] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'k', 's', 'i', 'd' }; +static const symbol s_11_137[10] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_138[9] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'k', 's', 'i', 'n' }; +static const symbol s_11_139[10] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_140[7] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'm', 'a' }; +static const symbol s_11_141[9] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'm', 'a', 't', 'a' }; +static const symbol s_11_142[7] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'm', 'e' }; +static const symbol s_11_143[6] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'n' }; +static const symbol s_11_144[6] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 's' }; +static const symbol s_11_145[7] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 't', 'e' }; +static const symbol s_11_146[8] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 'v', 'a', 'd' }; +static const symbol s_11_147[5] = { 'n', 0xC3, 0xA4, 'e', 'b' }; +static const symbol s_11_148[5] = { 'n', 0xC3, 0xA4, 'e', 'd' }; +static const symbol s_11_149[6] = { 'n', 0xC3, 0xA4, 'e', 'k', 's' }; +static const symbol s_11_150[8] = { 'n', 0xC3, 0xA4, 'e', 'k', 's', 'i', 'd' }; +static const symbol s_11_151[9] = { 'n', 0xC3, 0xA4, 'e', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_152[8] = { 'n', 0xC3, 0xA4, 'e', 'k', 's', 'i', 'n' }; +static const symbol s_11_153[9] = { 'n', 0xC3, 0xA4, 'e', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_154[6] = { 'n', 0xC3, 0xA4, 'e', 'm', 'e' }; +static const symbol s_11_155[5] = { 'n', 0xC3, 0xA4, 'e', 'n' }; +static const symbol s_11_156[6] = { 'n', 0xC3, 0xA4, 'e', 't', 'e' }; +static const symbol s_11_157[7] = { 'n', 0xC3, 0xA4, 'e', 'v', 'a', 'd' }; +static const symbol s_11_158[7] = { 'n', 0xC3, 0xA4, 'g', 'e', 'm', 'a' }; +static const symbol s_11_159[9] = { 'n', 0xC3, 0xA4, 'g', 'e', 'm', 'a', 't', 'a' }; +static const symbol s_11_160[5] = { 'n', 0xC3, 0xA4, 'h', 'a' }; +static const symbol s_11_161[8] = { 'n', 0xC3, 0xA4, 'h', 'a', 'k', 's', 'e' }; +static const symbol s_11_162[6] = { 'n', 0xC3, 0xA4, 'h', 't', 'i' }; +static const symbol s_11_163[5] = { 'p', 0xC3, 0xB5, 'e', 'b' }; +static const symbol s_11_164[5] = { 'p', 0xC3, 0xB5, 'e', 'd' }; +static const symbol s_11_165[6] = { 'p', 0xC3, 0xB5, 'e', 'k', 's' }; +static const symbol s_11_166[8] = { 'p', 0xC3, 0xB5, 'e', 'k', 's', 'i', 'd' }; +static const symbol s_11_167[9] = { 'p', 0xC3, 0xB5, 'e', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_168[8] = { 'p', 0xC3, 0xB5, 'e', 'k', 's', 'i', 'n' }; +static const symbol s_11_169[9] = { 'p', 0xC3, 0xB5, 'e', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_170[6] = { 'p', 0xC3, 0xB5, 'e', 'm', 'e' }; +static const symbol s_11_171[5] = { 'p', 0xC3, 0xB5, 'e', 'n' }; +static const symbol s_11_172[6] = { 'p', 0xC3, 0xB5, 'e', 't', 'e' }; +static const symbol s_11_173[7] = { 'p', 0xC3, 0xB5, 'e', 'v', 'a', 'd' }; +static const symbol s_11_174[4] = { 's', 'a', 'a', 'b' }; +static const symbol s_11_175[4] = { 's', 'a', 'a', 'd' }; +static const symbol s_11_176[5] = { 's', 'a', 'a', 'd', 'a' }; +static const symbol s_11_177[8] = { 's', 'a', 'a', 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_178[5] = { 's', 'a', 'a', 'd', 'i' }; +static const symbol s_11_179[5] = { 's', 'a', 'a', 'k', 's' }; +static const symbol s_11_180[7] = { 's', 'a', 'a', 'k', 's', 'i', 'd' }; +static const symbol s_11_181[8] = { 's', 'a', 'a', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_182[7] = { 's', 'a', 'a', 'k', 's', 'i', 'n' }; +static const symbol s_11_183[8] = { 's', 'a', 'a', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_184[5] = { 's', 'a', 'a', 'm', 'a' }; +static const symbol s_11_185[7] = { 's', 'a', 'a', 'm', 'a', 't', 'a' }; +static const symbol s_11_186[5] = { 's', 'a', 'a', 'm', 'e' }; +static const symbol s_11_187[4] = { 's', 'a', 'a', 'n' }; +static const symbol s_11_188[5] = { 's', 'a', 'a', 't', 'e' }; +static const symbol s_11_189[6] = { 's', 'a', 'a', 'v', 'a', 'd' }; +static const symbol s_11_190[3] = { 's', 'a', 'i' }; +static const symbol s_11_191[4] = { 's', 'a', 'i', 'd' }; +static const symbol s_11_192[5] = { 's', 'a', 'i', 'm', 'e' }; +static const symbol s_11_193[4] = { 's', 'a', 'i', 'n' }; +static const symbol s_11_194[5] = { 's', 'a', 'i', 't', 'e' }; +static const symbol s_11_195[4] = { 's', 0xC3, 0xB5, 'i' }; +static const symbol s_11_196[5] = { 's', 0xC3, 0xB5, 'i', 'd' }; +static const symbol s_11_197[6] = { 's', 0xC3, 0xB5, 'i', 'm', 'e' }; +static const symbol s_11_198[5] = { 's', 0xC3, 0xB5, 'i', 'n' }; +static const symbol s_11_199[6] = { 's', 0xC3, 0xB5, 'i', 't', 'e' }; +static const symbol s_11_200[6] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'b' }; +static const symbol s_11_201[6] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'd' }; +static const symbol s_11_202[10] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_203[7] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'd', 'i' }; +static const symbol s_11_204[7] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's' }; +static const symbol s_11_205[9] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'd' }; +static const symbol s_11_206[10] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_207[9] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 'n' }; +static const symbol s_11_208[10] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_209[7] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'a' }; +static const symbol s_11_210[9] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'a', 't', 'a' }; +static const symbol s_11_211[7] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'm', 'e' }; +static const symbol s_11_212[6] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'n' }; +static const symbol s_11_213[7] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 't', 'e' }; +static const symbol s_11_214[8] = { 's', 0xC3, 0xB6, 0xC3, 0xB6, 'v', 'a', 'd' }; +static const symbol s_11_215[6] = { 's', 0xC3, 0xBC, 0xC3, 0xBC, 'a' }; +static const symbol s_11_216[9] = { 's', 0xC3, 0xBC, 0xC3, 0xBC, 'a', 'k', 's', 'e' }; +static const symbol s_11_217[4] = { 't', 'e', 'e', 'b' }; +static const symbol s_11_218[4] = { 't', 'e', 'e', 'd' }; +static const symbol s_11_219[5] = { 't', 'e', 'e', 'k', 's' }; +static const symbol s_11_220[7] = { 't', 'e', 'e', 'k', 's', 'i', 'd' }; +static const symbol s_11_221[8] = { 't', 'e', 'e', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_222[7] = { 't', 'e', 'e', 'k', 's', 'i', 'n' }; +static const symbol s_11_223[8] = { 't', 'e', 'e', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_224[5] = { 't', 'e', 'e', 'm', 'e' }; +static const symbol s_11_225[4] = { 't', 'e', 'e', 'n' }; +static const symbol s_11_226[5] = { 't', 'e', 'e', 't', 'e' }; +static const symbol s_11_227[6] = { 't', 'e', 'e', 'v', 'a', 'd' }; +static const symbol s_11_228[6] = { 't', 'e', 'g', 'e', 'm', 'a' }; +static const symbol s_11_229[8] = { 't', 'e', 'g', 'e', 'm', 'a', 't', 'a' }; +static const symbol s_11_230[4] = { 't', 'e', 'h', 'a' }; +static const symbol s_11_231[7] = { 't', 'e', 'h', 'a', 'k', 's', 'e' }; +static const symbol s_11_232[5] = { 't', 'e', 'h', 't', 'i' }; +static const symbol s_11_233[4] = { 't', 'o', 'o', 'b' }; +static const symbol s_11_234[4] = { 't', 'o', 'o', 'd' }; +static const symbol s_11_235[5] = { 't', 'o', 'o', 'd', 'i' }; +static const symbol s_11_236[5] = { 't', 'o', 'o', 'k', 's' }; +static const symbol s_11_237[7] = { 't', 'o', 'o', 'k', 's', 'i', 'd' }; +static const symbol s_11_238[8] = { 't', 'o', 'o', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_239[7] = { 't', 'o', 'o', 'k', 's', 'i', 'n' }; +static const symbol s_11_240[8] = { 't', 'o', 'o', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_241[5] = { 't', 'o', 'o', 'm', 'a' }; +static const symbol s_11_242[7] = { 't', 'o', 'o', 'm', 'a', 't', 'a' }; +static const symbol s_11_243[5] = { 't', 'o', 'o', 'm', 'e' }; +static const symbol s_11_244[4] = { 't', 'o', 'o', 'n' }; +static const symbol s_11_245[5] = { 't', 'o', 'o', 't', 'e' }; +static const symbol s_11_246[6] = { 't', 'o', 'o', 'v', 'a', 'd' }; +static const symbol s_11_247[4] = { 't', 'u', 'u', 'a' }; +static const symbol s_11_248[7] = { 't', 'u', 'u', 'a', 'k', 's', 'e' }; +static const symbol s_11_249[4] = { 't', 0xC3, 0xB5, 'i' }; +static const symbol s_11_250[5] = { 't', 0xC3, 0xB5, 'i', 'd' }; +static const symbol s_11_251[6] = { 't', 0xC3, 0xB5, 'i', 'm', 'e' }; +static const symbol s_11_252[5] = { 't', 0xC3, 0xB5, 'i', 'n' }; +static const symbol s_11_253[6] = { 't', 0xC3, 0xB5, 'i', 't', 'e' }; +static const symbol s_11_254[4] = { 'v', 'i', 'i', 'a' }; +static const symbol s_11_255[7] = { 'v', 'i', 'i', 'a', 'k', 's', 'e' }; +static const symbol s_11_256[4] = { 'v', 'i', 'i', 'b' }; +static const symbol s_11_257[4] = { 'v', 'i', 'i', 'd' }; +static const symbol s_11_258[5] = { 'v', 'i', 'i', 'd', 'i' }; +static const symbol s_11_259[5] = { 'v', 'i', 'i', 'k', 's' }; +static const symbol s_11_260[7] = { 'v', 'i', 'i', 'k', 's', 'i', 'd' }; +static const symbol s_11_261[8] = { 'v', 'i', 'i', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_262[7] = { 'v', 'i', 'i', 'k', 's', 'i', 'n' }; +static const symbol s_11_263[8] = { 'v', 'i', 'i', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_264[5] = { 'v', 'i', 'i', 'm', 'a' }; +static const symbol s_11_265[7] = { 'v', 'i', 'i', 'm', 'a', 't', 'a' }; +static const symbol s_11_266[5] = { 'v', 'i', 'i', 'm', 'e' }; +static const symbol s_11_267[4] = { 'v', 'i', 'i', 'n' }; +static const symbol s_11_268[7] = { 'v', 'i', 'i', 's', 'i', 'm', 'e' }; +static const symbol s_11_269[6] = { 'v', 'i', 'i', 's', 'i', 'n' }; +static const symbol s_11_270[7] = { 'v', 'i', 'i', 's', 'i', 't', 'e' }; +static const symbol s_11_271[5] = { 'v', 'i', 'i', 't', 'e' }; +static const symbol s_11_272[6] = { 'v', 'i', 'i', 'v', 'a', 'd' }; +static const symbol s_11_273[5] = { 'v', 0xC3, 0xB5, 'i', 'b' }; +static const symbol s_11_274[5] = { 'v', 0xC3, 0xB5, 'i', 'd' }; +static const symbol s_11_275[6] = { 'v', 0xC3, 0xB5, 'i', 'd', 'a' }; +static const symbol s_11_276[9] = { 'v', 0xC3, 0xB5, 'i', 'd', 'a', 'k', 's', 'e' }; +static const symbol s_11_277[6] = { 'v', 0xC3, 0xB5, 'i', 'd', 'i' }; +static const symbol s_11_278[6] = { 'v', 0xC3, 0xB5, 'i', 'k', 's' }; +static const symbol s_11_279[8] = { 'v', 0xC3, 0xB5, 'i', 'k', 's', 'i', 'd' }; +static const symbol s_11_280[9] = { 'v', 0xC3, 0xB5, 'i', 'k', 's', 'i', 'm', 'e' }; +static const symbol s_11_281[8] = { 'v', 0xC3, 0xB5, 'i', 'k', 's', 'i', 'n' }; +static const symbol s_11_282[9] = { 'v', 0xC3, 0xB5, 'i', 'k', 's', 'i', 't', 'e' }; +static const symbol s_11_283[6] = { 'v', 0xC3, 0xB5, 'i', 'm', 'a' }; +static const symbol s_11_284[8] = { 'v', 0xC3, 0xB5, 'i', 'm', 'a', 't', 'a' }; +static const symbol s_11_285[6] = { 'v', 0xC3, 0xB5, 'i', 'm', 'e' }; +static const symbol s_11_286[5] = { 'v', 0xC3, 0xB5, 'i', 'n' }; +static const symbol s_11_287[5] = { 'v', 0xC3, 0xB5, 'i', 's' }; +static const symbol s_11_288[6] = { 'v', 0xC3, 0xB5, 'i', 't', 'e' }; +static const symbol s_11_289[7] = { 'v', 0xC3, 0xB5, 'i', 'v', 'a', 'd' }; +static const struct among a_11[290] = { +{ 4, s_11_0, 0, 1, 0}, +{ 4, s_11_1, 0, 1, 0}, +{ 8, s_11_2, -1, 1, 0}, +{ 5, s_11_3, 0, 1, 0}, +{ 7, s_11_4, -1, 1, 0}, +{ 5, s_11_5, 0, 1, 0}, +{ 4, s_11_6, 0, 1, 0}, +{ 5, s_11_7, 0, 1, 0}, +{ 6, s_11_8, 0, 1, 0}, +{ 4, s_11_9, 0, 1, 0}, +{ 7, s_11_10, -1, 1, 0}, +{ 4, s_11_11, 0, 12, 0}, +{ 5, s_11_12, -1, 12, 0}, +{ 6, s_11_13, -2, 12, 0}, +{ 5, s_11_14, -3, 12, 0}, +{ 6, s_11_15, -4, 12, 0}, +{ 6, s_11_16, 0, 12, 0}, +{ 6, s_11_17, 0, 12, 0}, +{ 7, s_11_18, -1, 12, 0}, +{ 10, s_11_19, -1, 12, 0}, +{ 7, s_11_20, -3, 12, 0}, +{ 7, s_11_21, 0, 12, 0}, +{ 9, s_11_22, -1, 12, 0}, +{ 10, s_11_23, -2, 12, 0}, +{ 9, s_11_24, -3, 12, 0}, +{ 10, s_11_25, -4, 12, 0}, +{ 7, s_11_26, 0, 12, 0}, +{ 9, s_11_27, -1, 12, 0}, +{ 7, s_11_28, 0, 12, 0}, +{ 6, s_11_29, 0, 12, 0}, +{ 7, s_11_30, 0, 12, 0}, +{ 8, s_11_31, 0, 12, 0}, +{ 4, s_11_32, 0, 1, 0}, +{ 5, s_11_33, -1, 1, 0}, +{ 6, s_11_34, -2, 1, 0}, +{ 5, s_11_35, -3, 1, 0}, +{ 6, s_11_36, -4, 1, 0}, +{ 4, s_11_37, 0, 4, 0}, +{ 4, s_11_38, 0, 4, 0}, +{ 8, s_11_39, -1, 4, 0}, +{ 5, s_11_40, 0, 4, 0}, +{ 7, s_11_41, -1, 4, 0}, +{ 8, s_11_42, -2, 4, 0}, +{ 7, s_11_43, -3, 4, 0}, +{ 8, s_11_44, -4, 4, 0}, +{ 5, s_11_45, 0, 4, 0}, +{ 7, s_11_46, -1, 4, 0}, +{ 5, s_11_47, 0, 4, 0}, +{ 4, s_11_48, 0, 4, 0}, +{ 4, s_11_49, 0, 4, 0}, +{ 5, s_11_50, 0, 4, 0}, +{ 5, s_11_51, 0, 4, 0}, +{ 6, s_11_52, 0, 4, 0}, +{ 5, s_11_53, 0, 8, 0}, +{ 8, s_11_54, -1, 8, 0}, +{ 5, s_11_55, 0, 8, 0}, +{ 5, s_11_56, 0, 8, 0}, +{ 6, s_11_57, -1, 8, 0}, +{ 6, s_11_58, 0, 8, 0}, +{ 8, s_11_59, -1, 8, 0}, +{ 9, s_11_60, -2, 8, 0}, +{ 8, s_11_61, -3, 8, 0}, +{ 9, s_11_62, -4, 8, 0}, +{ 6, s_11_63, 0, 8, 0}, +{ 8, s_11_64, -1, 8, 0}, +{ 6, s_11_65, 0, 8, 0}, +{ 5, s_11_66, 0, 8, 0}, +{ 5, s_11_67, 0, 8, 0}, +{ 6, s_11_68, 0, 8, 0}, +{ 7, s_11_69, 0, 8, 0}, +{ 4, s_11_70, 0, 16, 0}, +{ 4, s_11_71, 0, 16, 0}, +{ 5, s_11_72, 0, 16, 0}, +{ 7, s_11_73, -1, 16, 0}, +{ 8, s_11_74, -2, 16, 0}, +{ 7, s_11_75, -3, 16, 0}, +{ 8, s_11_76, -4, 16, 0}, +{ 5, s_11_77, 0, 16, 0}, +{ 4, s_11_78, 0, 16, 0}, +{ 5, s_11_79, 0, 16, 0}, +{ 6, s_11_80, 0, 16, 0}, +{ 4, s_11_81, 0, 14, 0}, +{ 4, s_11_82, 0, 14, 0}, +{ 5, s_11_83, 0, 14, 0}, +{ 7, s_11_84, -1, 14, 0}, +{ 8, s_11_85, -2, 14, 0}, +{ 7, s_11_86, -3, 14, 0}, +{ 8, s_11_87, -4, 14, 0}, +{ 5, s_11_88, 0, 14, 0}, +{ 4, s_11_89, 0, 14, 0}, +{ 5, s_11_90, 0, 14, 0}, +{ 6, s_11_91, 0, 14, 0}, +{ 4, s_11_92, 0, 7, 0}, +{ 4, s_11_93, 0, 7, 0}, +{ 5, s_11_94, -1, 7, 0}, +{ 5, s_11_95, 0, 7, 0}, +{ 7, s_11_96, -1, 7, 0}, +{ 8, s_11_97, -2, 7, 0}, +{ 7, s_11_98, -3, 7, 0}, +{ 8, s_11_99, -4, 7, 0}, +{ 5, s_11_100, 0, 7, 0}, +{ 7, s_11_101, -1, 7, 0}, +{ 5, s_11_102, 0, 7, 0}, +{ 4, s_11_103, 0, 7, 0}, +{ 5, s_11_104, 0, 7, 0}, +{ 6, s_11_105, 0, 7, 0}, +{ 4, s_11_106, 0, 7, 0}, +{ 7, s_11_107, -1, 7, 0}, +{ 4, s_11_108, 0, 6, 0}, +{ 5, s_11_109, -1, 6, 0}, +{ 6, s_11_110, -2, 6, 0}, +{ 5, s_11_111, -3, 6, 0}, +{ 6, s_11_112, -4, 6, 0}, +{ 6, s_11_113, 0, 5, 0}, +{ 6, s_11_114, 0, 5, 0}, +{ 10, s_11_115, -1, 5, 0}, +{ 7, s_11_116, -2, 5, 0}, +{ 7, s_11_117, 0, 5, 0}, +{ 9, s_11_118, -1, 5, 0}, +{ 10, s_11_119, -2, 5, 0}, +{ 9, s_11_120, -3, 5, 0}, +{ 10, s_11_121, -4, 5, 0}, +{ 7, s_11_122, 0, 5, 0}, +{ 9, s_11_123, -1, 5, 0}, +{ 7, s_11_124, 0, 5, 0}, +{ 6, s_11_125, 0, 5, 0}, +{ 7, s_11_126, 0, 5, 0}, +{ 8, s_11_127, 0, 5, 0}, +{ 6, s_11_128, 0, 5, 0}, +{ 9, s_11_129, -1, 5, 0}, +{ 6, s_11_130, 0, 13, 0}, +{ 9, s_11_131, -1, 13, 0}, +{ 6, s_11_132, 0, 13, 0}, +{ 6, s_11_133, 0, 13, 0}, +{ 7, s_11_134, -1, 13, 0}, +{ 7, s_11_135, 0, 13, 0}, +{ 9, s_11_136, -1, 13, 0}, +{ 10, s_11_137, -2, 13, 0}, +{ 9, s_11_138, -3, 13, 0}, +{ 10, s_11_139, -4, 13, 0}, +{ 7, s_11_140, 0, 13, 0}, +{ 9, s_11_141, -1, 13, 0}, +{ 7, s_11_142, 0, 13, 0}, +{ 6, s_11_143, 0, 13, 0}, +{ 6, s_11_144, 0, 13, 0}, +{ 7, s_11_145, 0, 13, 0}, +{ 8, s_11_146, 0, 13, 0}, +{ 5, s_11_147, 0, 18, 0}, +{ 5, s_11_148, 0, 18, 0}, +{ 6, s_11_149, 0, 18, 0}, +{ 8, s_11_150, -1, 18, 0}, +{ 9, s_11_151, -2, 18, 0}, +{ 8, s_11_152, -3, 18, 0}, +{ 9, s_11_153, -4, 18, 0}, +{ 6, s_11_154, 0, 18, 0}, +{ 5, s_11_155, 0, 18, 0}, +{ 6, s_11_156, 0, 18, 0}, +{ 7, s_11_157, 0, 18, 0}, +{ 7, s_11_158, 0, 18, 0}, +{ 9, s_11_159, -1, 18, 0}, +{ 5, s_11_160, 0, 18, 0}, +{ 8, s_11_161, -1, 18, 0}, +{ 6, s_11_162, 0, 18, 0}, +{ 5, s_11_163, 0, 15, 0}, +{ 5, s_11_164, 0, 15, 0}, +{ 6, s_11_165, 0, 15, 0}, +{ 8, s_11_166, -1, 15, 0}, +{ 9, s_11_167, -2, 15, 0}, +{ 8, s_11_168, -3, 15, 0}, +{ 9, s_11_169, -4, 15, 0}, +{ 6, s_11_170, 0, 15, 0}, +{ 5, s_11_171, 0, 15, 0}, +{ 6, s_11_172, 0, 15, 0}, +{ 7, s_11_173, 0, 15, 0}, +{ 4, s_11_174, 0, 2, 0}, +{ 4, s_11_175, 0, 2, 0}, +{ 5, s_11_176, -1, 2, 0}, +{ 8, s_11_177, -1, 2, 0}, +{ 5, s_11_178, -3, 2, 0}, +{ 5, s_11_179, 0, 2, 0}, +{ 7, s_11_180, -1, 2, 0}, +{ 8, s_11_181, -2, 2, 0}, +{ 7, s_11_182, -3, 2, 0}, +{ 8, s_11_183, -4, 2, 0}, +{ 5, s_11_184, 0, 2, 0}, +{ 7, s_11_185, -1, 2, 0}, +{ 5, s_11_186, 0, 2, 0}, +{ 4, s_11_187, 0, 2, 0}, +{ 5, s_11_188, 0, 2, 0}, +{ 6, s_11_189, 0, 2, 0}, +{ 3, s_11_190, 0, 2, 0}, +{ 4, s_11_191, -1, 2, 0}, +{ 5, s_11_192, -2, 2, 0}, +{ 4, s_11_193, -3, 2, 0}, +{ 5, s_11_194, -4, 2, 0}, +{ 4, s_11_195, 0, 9, 0}, +{ 5, s_11_196, -1, 9, 0}, +{ 6, s_11_197, -2, 9, 0}, +{ 5, s_11_198, -3, 9, 0}, +{ 6, s_11_199, -4, 9, 0}, +{ 6, s_11_200, 0, 9, 0}, +{ 6, s_11_201, 0, 9, 0}, +{ 10, s_11_202, -1, 9, 0}, +{ 7, s_11_203, -2, 9, 0}, +{ 7, s_11_204, 0, 9, 0}, +{ 9, s_11_205, -1, 9, 0}, +{ 10, s_11_206, -2, 9, 0}, +{ 9, s_11_207, -3, 9, 0}, +{ 10, s_11_208, -4, 9, 0}, +{ 7, s_11_209, 0, 9, 0}, +{ 9, s_11_210, -1, 9, 0}, +{ 7, s_11_211, 0, 9, 0}, +{ 6, s_11_212, 0, 9, 0}, +{ 7, s_11_213, 0, 9, 0}, +{ 8, s_11_214, 0, 9, 0}, +{ 6, s_11_215, 0, 9, 0}, +{ 9, s_11_216, -1, 9, 0}, +{ 4, s_11_217, 0, 17, 0}, +{ 4, s_11_218, 0, 17, 0}, +{ 5, s_11_219, 0, 17, 0}, +{ 7, s_11_220, -1, 17, 0}, +{ 8, s_11_221, -2, 17, 0}, +{ 7, s_11_222, -3, 17, 0}, +{ 8, s_11_223, -4, 17, 0}, +{ 5, s_11_224, 0, 17, 0}, +{ 4, s_11_225, 0, 17, 0}, +{ 5, s_11_226, 0, 17, 0}, +{ 6, s_11_227, 0, 17, 0}, +{ 6, s_11_228, 0, 17, 0}, +{ 8, s_11_229, -1, 17, 0}, +{ 4, s_11_230, 0, 17, 0}, +{ 7, s_11_231, -1, 17, 0}, +{ 5, s_11_232, 0, 17, 0}, +{ 4, s_11_233, 0, 10, 0}, +{ 4, s_11_234, 0, 10, 0}, +{ 5, s_11_235, -1, 10, 0}, +{ 5, s_11_236, 0, 10, 0}, +{ 7, s_11_237, -1, 10, 0}, +{ 8, s_11_238, -2, 10, 0}, +{ 7, s_11_239, -3, 10, 0}, +{ 8, s_11_240, -4, 10, 0}, +{ 5, s_11_241, 0, 10, 0}, +{ 7, s_11_242, -1, 10, 0}, +{ 5, s_11_243, 0, 10, 0}, +{ 4, s_11_244, 0, 10, 0}, +{ 5, s_11_245, 0, 10, 0}, +{ 6, s_11_246, 0, 10, 0}, +{ 4, s_11_247, 0, 10, 0}, +{ 7, s_11_248, -1, 10, 0}, +{ 4, s_11_249, 0, 10, 0}, +{ 5, s_11_250, -1, 10, 0}, +{ 6, s_11_251, -2, 10, 0}, +{ 5, s_11_252, -3, 10, 0}, +{ 6, s_11_253, -4, 10, 0}, +{ 4, s_11_254, 0, 3, 0}, +{ 7, s_11_255, -1, 3, 0}, +{ 4, s_11_256, 0, 3, 0}, +{ 4, s_11_257, 0, 3, 0}, +{ 5, s_11_258, -1, 3, 0}, +{ 5, s_11_259, 0, 3, 0}, +{ 7, s_11_260, -1, 3, 0}, +{ 8, s_11_261, -2, 3, 0}, +{ 7, s_11_262, -3, 3, 0}, +{ 8, s_11_263, -4, 3, 0}, +{ 5, s_11_264, 0, 3, 0}, +{ 7, s_11_265, -1, 3, 0}, +{ 5, s_11_266, 0, 3, 0}, +{ 4, s_11_267, 0, 3, 0}, +{ 7, s_11_268, 0, 3, 0}, +{ 6, s_11_269, 0, 3, 0}, +{ 7, s_11_270, 0, 3, 0}, +{ 5, s_11_271, 0, 3, 0}, +{ 6, s_11_272, 0, 3, 0}, +{ 5, s_11_273, 0, 11, 0}, +{ 5, s_11_274, 0, 11, 0}, +{ 6, s_11_275, -1, 11, 0}, +{ 9, s_11_276, -1, 11, 0}, +{ 6, s_11_277, -3, 11, 0}, +{ 6, s_11_278, 0, 11, 0}, +{ 8, s_11_279, -1, 11, 0}, +{ 9, s_11_280, -2, 11, 0}, +{ 8, s_11_281, -3, 11, 0}, +{ 9, s_11_282, -4, 11, 0}, +{ 6, s_11_283, 0, 11, 0}, +{ 8, s_11_284, -1, 11, 0}, +{ 6, s_11_285, 0, 11, 0}, +{ 5, s_11_286, 0, 11, 0}, +{ 5, s_11_287, 0, 11, 0}, +{ 6, s_11_288, 0, 11, 0}, +{ 7, s_11_289, 0, 11, 0} +}; + +static const unsigned char g_V1[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 48, 8 }; + +static const unsigned char g_RV[] = { 17, 65, 16 }; + +static const unsigned char g_KI[] = { 117, 66, 6, 1, 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, 128, 0, 0, 0, 16 }; + +static const unsigned char g_GI[] = { 21, 123, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 48, 8 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'l', 'a', 's', 'e' }; +static const symbol s_2[] = { 'm', 'i', 's', 'e' }; +static const symbol s_3[] = { 'l', 'i', 's', 'e' }; +static const symbol s_4[] = { 'i', 'k', 'u' }; +static const symbol s_5[] = { 'e' }; +static const symbol s_6[] = { 't' }; +static const symbol s_7[] = { 'k' }; +static const symbol s_8[] = { 'p' }; +static const symbol s_9[] = { 't' }; +static const symbol s_10[] = { 'j', 'o', 'o' }; +static const symbol s_11[] = { 's', 'a', 'a' }; +static const symbol s_12[] = { 'v', 'i', 'i', 'm', 'a' }; +static const symbol s_13[] = { 'k', 'e', 'e', 's', 'i' }; +static const symbol s_14[] = { 'l', 0xC3, 0xB6, 0xC3, 0xB6 }; +static const symbol s_15[] = { 'l', 0xC3, 0xB5, 'i' }; +static const symbol s_16[] = { 'l', 'o', 'o' }; +static const symbol s_17[] = { 'k', 0xC3, 0xA4, 'i', 's', 'i' }; +static const symbol s_18[] = { 's', 0xC3, 0xB6, 0xC3, 0xB6 }; +static const symbol s_19[] = { 't', 'o', 'o' }; +static const symbol s_20[] = { 'v', 0xC3, 0xB5, 'i', 's', 'i' }; +static const symbol s_21[] = { 'j', 0xC3, 0xA4, 0xC3, 0xA4, 'm', 'a' }; +static const symbol s_22[] = { 'm', 0xC3, 0xBC, 0xC3, 0xBC, 's', 'i' }; +static const symbol s_23[] = { 'l', 'u', 'g', 'e' }; +static const symbol s_24[] = { 'p', 0xC3, 0xB5, 'd', 'e' }; +static const symbol s_25[] = { 'l', 'a', 'd', 'u' }; +static const symbol s_26[] = { 't', 'e', 'g', 'i' }; +static const symbol s_27[] = { 'n', 0xC3, 0xA4, 'g', 'i' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { + int ret = out_grouping_U(z, g_V1, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_V1, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; + return 1; +} + +static int r_emphasis(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 105) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_0, 2); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 4); + if (ret < 0) return 0; + z->c = ret; + } + z->c = z->l - v_2; + } + switch (among_var) { + case 1: + { + int v_3 = z->l - z->c; + if (in_grouping_b_U(z, g_GI, 97, 252, 0)) return 0; + z->c = z->l - v_3; + { + int v_4 = z->l - z->c; + { + int ret = r_LONGV(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_4; + } + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b_U(z, g_KI, 98, 382, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540726 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_1, 21); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 3: + if (in_grouping_b_U(z, g_V1, 97, 252, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_LONGV(struct SN_env * z) { + if (!find_among_b(z, a_2, 9)) return 0; + return 1; +} + +static int r_i_plural(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 105) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_3, 1)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + if (in_grouping_b_U(z, g_RV, 97, 117, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_special_noun_endings(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1049120 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_4, 12); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_1); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_2); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_case_ending(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1576994 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_5, 10); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_RV, 97, 117, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + { + int ret = r_LONGV(z); + if (ret <= 0) return ret; + } + } + lab0: + break; + case 2: + { + int v_3 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 4); + if (ret < 0) return 0; + z->c = ret; + } + z->c = z->l - v_3; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_plural_three_first_cases(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 101)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_7, 7); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_4); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; + { + int ret = r_LONGV(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 4); + if (ret < 0) goto lab2; + z->c = ret; + } + z->c = z->l - v_4; + } + if (z->c <= z->lb || (z->p[z->c - 1] != 115 && z->p[z->c - 1] != 116)) among_var = 2; else + among_var = find_among_b(z, a_6, 5); + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + } + lab1: + break; + case 4: + { + int v_5 = z->l - z->c; + if (in_grouping_b_U(z, g_RV, 97, 117, 0)) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_5; + { + int ret = r_LONGV(z); + if (ret <= 0) return ret; + } + } + lab3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_nu(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 117)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_8, 4)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_undouble_kpt(struct SN_env * z) { + int among_var; + if (in_grouping_b_U(z, g_V1, 97, 252, 0)) return 0; + if (z->I[0] > z->c) return 0; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1116160 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_9, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_degrees(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((8706 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_10, 3); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + if (in_grouping_b_U(z, g_RV, 97, 117, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_substantive(struct SN_env * z) { + { + int v_1 = z->l - z->c; + { + int ret = r_special_noun_endings(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_case_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_plural_three_first_cases(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_degrees(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_i_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_nu(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + return 1; +} + +static int r_verb_exceptions(struct SN_env * z) { + int among_var; + z->bra = z->c; + among_var = find_among(z, a_11, 290); + if (!among_var) return 0; + z->ket = z->c; + if (z->c < z->l) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_10); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_11); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 5, s_12); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 5, s_13); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_14); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 4, s_15); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 6, s_17); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 5, s_18); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 3, s_19); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 6, s_20); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 7, s_21); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 7, s_22); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 4, s_23); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 5, s_24); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 4, s_25); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 4, s_26); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 5, s_27); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int estonian_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_verb_exceptions(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int ret = r_emphasis(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + { + int ret = r_verb(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = z->l - v_5; + { + int ret = r_substantive(z); + if (ret < 0) return ret; + } + } + lab2: + z->c = z->l - v_4; + } + { + int v_6 = z->l - z->c; + { + int ret = r_undouble_kpt(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * estonian_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void estonian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_estonian.h b/contrib/libs/snowball/src_c/stem_UTF_8_estonian.h new file mode 100644 index 000000000000..a000b1b047bd --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_estonian.h @@ -0,0 +1,15 @@ +/* Generated from estonian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * estonian_UTF_8_create_env(void); +extern void estonian_UTF_8_close_env(struct SN_env * z); + +extern int estonian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_finnish.c b/contrib/libs/snowball/src_c/stem_UTF_8_finnish.c new file mode 100644 index 000000000000..079bc27a8afc --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_finnish.c @@ -0,0 +1,767 @@ +/* Generated from finnish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int finnish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_tidy(struct SN_env * z); +static int r_other_endings(struct SN_env * z); +static int r_t_plural(struct SN_env * z); +static int r_i_plural(struct SN_env * z); +static int r_case_ending(struct SN_env * z); +static int r_VI(struct SN_env * z); +static int r_LONG(struct SN_env * z); +static int r_possessive(struct SN_env * z); +static int r_particle_etc(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * finnish_UTF_8_create_env(void); +extern void finnish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'p', 'a' }; +static const symbol s_0_1[3] = { 's', 't', 'i' }; +static const symbol s_0_2[4] = { 'k', 'a', 'a', 'n' }; +static const symbol s_0_3[3] = { 'h', 'a', 'n' }; +static const symbol s_0_4[3] = { 'k', 'i', 'n' }; +static const symbol s_0_5[4] = { 'h', 0xC3, 0xA4, 'n' }; +static const symbol s_0_6[6] = { 'k', 0xC3, 0xA4, 0xC3, 0xA4, 'n' }; +static const symbol s_0_7[2] = { 'k', 'o' }; +static const symbol s_0_8[3] = { 'p', 0xC3, 0xA4 }; +static const symbol s_0_9[3] = { 'k', 0xC3, 0xB6 }; +static const struct among a_0[10] = { +{ 2, s_0_0, 0, 1, 0}, +{ 3, s_0_1, 0, 2, 0}, +{ 4, s_0_2, 0, 1, 0}, +{ 3, s_0_3, 0, 1, 0}, +{ 3, s_0_4, 0, 1, 0}, +{ 4, s_0_5, 0, 1, 0}, +{ 6, s_0_6, 0, 1, 0}, +{ 2, s_0_7, 0, 1, 0}, +{ 3, s_0_8, 0, 1, 0}, +{ 3, s_0_9, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'l', 'l', 'a' }; +static const symbol s_1_1[2] = { 'n', 'a' }; +static const symbol s_1_2[3] = { 's', 's', 'a' }; +static const symbol s_1_3[2] = { 't', 'a' }; +static const symbol s_1_4[3] = { 'l', 't', 'a' }; +static const symbol s_1_5[3] = { 's', 't', 'a' }; +static const struct among a_1[6] = { +{ 3, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 3, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 3, s_1_4, -1, -1, 0}, +{ 3, s_1_5, -2, -1, 0} +}; + +static const symbol s_2_0[4] = { 'l', 'l', 0xC3, 0xA4 }; +static const symbol s_2_1[3] = { 'n', 0xC3, 0xA4 }; +static const symbol s_2_2[4] = { 's', 's', 0xC3, 0xA4 }; +static const symbol s_2_3[3] = { 't', 0xC3, 0xA4 }; +static const symbol s_2_4[4] = { 'l', 't', 0xC3, 0xA4 }; +static const symbol s_2_5[4] = { 's', 't', 0xC3, 0xA4 }; +static const struct among a_2[6] = { +{ 4, s_2_0, 0, -1, 0}, +{ 3, s_2_1, 0, -1, 0}, +{ 4, s_2_2, 0, -1, 0}, +{ 3, s_2_3, 0, -1, 0}, +{ 4, s_2_4, -1, -1, 0}, +{ 4, s_2_5, -2, -1, 0} +}; + +static const symbol s_3_0[3] = { 'l', 'l', 'e' }; +static const symbol s_3_1[3] = { 'i', 'n', 'e' }; +static const struct among a_3[2] = { +{ 3, s_3_0, 0, -1, 0}, +{ 3, s_3_1, 0, -1, 0} +}; + +static const symbol s_4_0[3] = { 'n', 's', 'a' }; +static const symbol s_4_1[3] = { 'm', 'm', 'e' }; +static const symbol s_4_2[3] = { 'n', 'n', 'e' }; +static const symbol s_4_3[2] = { 'n', 'i' }; +static const symbol s_4_4[2] = { 's', 'i' }; +static const symbol s_4_5[2] = { 'a', 'n' }; +static const symbol s_4_6[2] = { 'e', 'n' }; +static const symbol s_4_7[3] = { 0xC3, 0xA4, 'n' }; +static const symbol s_4_8[4] = { 'n', 's', 0xC3, 0xA4 }; +static const struct among a_4[9] = { +{ 3, s_4_0, 0, 3, 0}, +{ 3, s_4_1, 0, 3, 0}, +{ 3, s_4_2, 0, 3, 0}, +{ 2, s_4_3, 0, 2, 0}, +{ 2, s_4_4, 0, 1, 0}, +{ 2, s_4_5, 0, 4, 0}, +{ 2, s_4_6, 0, 6, 0}, +{ 3, s_4_7, 0, 5, 0}, +{ 4, s_4_8, 0, 3, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'i', 'i' }; +static const symbol s_5_3[2] = { 'o', 'o' }; +static const symbol s_5_4[2] = { 'u', 'u' }; +static const symbol s_5_5[4] = { 0xC3, 0xA4, 0xC3, 0xA4 }; +static const symbol s_5_6[4] = { 0xC3, 0xB6, 0xC3, 0xB6 }; +static const struct among a_5[7] = { +{ 2, s_5_0, 0, -1, 0}, +{ 2, s_5_1, 0, -1, 0}, +{ 2, s_5_2, 0, -1, 0}, +{ 2, s_5_3, 0, -1, 0}, +{ 2, s_5_4, 0, -1, 0}, +{ 4, s_5_5, 0, -1, 0}, +{ 4, s_5_6, 0, -1, 0} +}; + +static const symbol s_6_0[1] = { 'a' }; +static const symbol s_6_1[3] = { 'l', 'l', 'a' }; +static const symbol s_6_2[2] = { 'n', 'a' }; +static const symbol s_6_3[3] = { 's', 's', 'a' }; +static const symbol s_6_4[2] = { 't', 'a' }; +static const symbol s_6_5[3] = { 'l', 't', 'a' }; +static const symbol s_6_6[3] = { 's', 't', 'a' }; +static const symbol s_6_7[3] = { 't', 't', 'a' }; +static const symbol s_6_8[3] = { 'l', 'l', 'e' }; +static const symbol s_6_9[3] = { 'i', 'n', 'e' }; +static const symbol s_6_10[3] = { 'k', 's', 'i' }; +static const symbol s_6_11[1] = { 'n' }; +static const symbol s_6_12[3] = { 'h', 'a', 'n' }; +static const symbol s_6_13[3] = { 'd', 'e', 'n' }; +static const symbol s_6_14[4] = { 's', 'e', 'e', 'n' }; +static const symbol s_6_15[3] = { 'h', 'e', 'n' }; +static const symbol s_6_16[4] = { 't', 't', 'e', 'n' }; +static const symbol s_6_17[3] = { 'h', 'i', 'n' }; +static const symbol s_6_18[4] = { 's', 'i', 'i', 'n' }; +static const symbol s_6_19[3] = { 'h', 'o', 'n' }; +static const symbol s_6_20[4] = { 'h', 0xC3, 0xA4, 'n' }; +static const symbol s_6_21[4] = { 'h', 0xC3, 0xB6, 'n' }; +static const symbol s_6_22[2] = { 0xC3, 0xA4 }; +static const symbol s_6_23[4] = { 'l', 'l', 0xC3, 0xA4 }; +static const symbol s_6_24[3] = { 'n', 0xC3, 0xA4 }; +static const symbol s_6_25[4] = { 's', 's', 0xC3, 0xA4 }; +static const symbol s_6_26[3] = { 't', 0xC3, 0xA4 }; +static const symbol s_6_27[4] = { 'l', 't', 0xC3, 0xA4 }; +static const symbol s_6_28[4] = { 's', 't', 0xC3, 0xA4 }; +static const symbol s_6_29[4] = { 't', 't', 0xC3, 0xA4 }; +static const struct among a_6[30] = { +{ 1, s_6_0, 0, 8, 0}, +{ 3, s_6_1, -1, -1, 0}, +{ 2, s_6_2, -2, -1, 0}, +{ 3, s_6_3, -3, -1, 0}, +{ 2, s_6_4, -4, -1, 0}, +{ 3, s_6_5, -1, -1, 0}, +{ 3, s_6_6, -2, -1, 0}, +{ 3, s_6_7, -3, 2, 0}, +{ 3, s_6_8, 0, -1, 0}, +{ 3, s_6_9, 0, -1, 0}, +{ 3, s_6_10, 0, -1, 0}, +{ 1, s_6_11, 0, 7, 0}, +{ 3, s_6_12, -1, 1, 0}, +{ 3, s_6_13, -2, -1, r_VI}, +{ 4, s_6_14, -3, -1, r_LONG}, +{ 3, s_6_15, -4, 2, 0}, +{ 4, s_6_16, -5, -1, r_VI}, +{ 3, s_6_17, -6, 3, 0}, +{ 4, s_6_18, -7, -1, r_VI}, +{ 3, s_6_19, -8, 4, 0}, +{ 4, s_6_20, -9, 5, 0}, +{ 4, s_6_21, -10, 6, 0}, +{ 2, s_6_22, 0, 8, 0}, +{ 4, s_6_23, -1, -1, 0}, +{ 3, s_6_24, -2, -1, 0}, +{ 4, s_6_25, -3, -1, 0}, +{ 3, s_6_26, -4, -1, 0}, +{ 4, s_6_27, -1, -1, 0}, +{ 4, s_6_28, -2, -1, 0}, +{ 4, s_6_29, -3, 2, 0} +}; + +static const symbol s_7_0[3] = { 'e', 'j', 'a' }; +static const symbol s_7_1[3] = { 'm', 'm', 'a' }; +static const symbol s_7_2[4] = { 'i', 'm', 'm', 'a' }; +static const symbol s_7_3[3] = { 'm', 'p', 'a' }; +static const symbol s_7_4[4] = { 'i', 'm', 'p', 'a' }; +static const symbol s_7_5[3] = { 'm', 'm', 'i' }; +static const symbol s_7_6[4] = { 'i', 'm', 'm', 'i' }; +static const symbol s_7_7[3] = { 'm', 'p', 'i' }; +static const symbol s_7_8[4] = { 'i', 'm', 'p', 'i' }; +static const symbol s_7_9[4] = { 'e', 'j', 0xC3, 0xA4 }; +static const symbol s_7_10[4] = { 'm', 'm', 0xC3, 0xA4 }; +static const symbol s_7_11[5] = { 'i', 'm', 'm', 0xC3, 0xA4 }; +static const symbol s_7_12[4] = { 'm', 'p', 0xC3, 0xA4 }; +static const symbol s_7_13[5] = { 'i', 'm', 'p', 0xC3, 0xA4 }; +static const struct among a_7[14] = { +{ 3, s_7_0, 0, -1, 0}, +{ 3, s_7_1, 0, 1, 0}, +{ 4, s_7_2, -1, -1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 4, s_7_4, -1, -1, 0}, +{ 3, s_7_5, 0, 1, 0}, +{ 4, s_7_6, -1, -1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 4, s_7_8, -1, -1, 0}, +{ 4, s_7_9, 0, -1, 0}, +{ 4, s_7_10, 0, 1, 0}, +{ 5, s_7_11, -1, -1, 0}, +{ 4, s_7_12, 0, 1, 0}, +{ 5, s_7_13, -1, -1, 0} +}; + +static const symbol s_8_0[1] = { 'i' }; +static const symbol s_8_1[1] = { 'j' }; +static const struct among a_8[2] = { +{ 1, s_8_0, 0, -1, 0}, +{ 1, s_8_1, 0, -1, 0} +}; + +static const symbol s_9_0[3] = { 'm', 'm', 'a' }; +static const symbol s_9_1[4] = { 'i', 'm', 'm', 'a' }; +static const struct among a_9[2] = { +{ 3, s_9_0, 0, 1, 0}, +{ 4, s_9_1, -1, -1, 0} +}; + +static const unsigned char g_AEI[] = { 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 }; + +static const unsigned char g_C[] = { 119, 223, 119, 1 }; + +static const unsigned char g_V1[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_V2[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_particle_end[] = { 17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const symbol s_0[] = { 'k', 's', 'e' }; +static const symbol s_1[] = { 'k', 's', 'i' }; +static const symbol s_2[] = { 0xC3, 0xA4 }; +static const symbol s_3[] = { 0xC3, 0xB6 }; +static const symbol s_4[] = { 'i', 'e' }; +static const symbol s_5[] = { 'p', 'o' }; +static const symbol s_6[] = { 'p', 'o' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int ret = out_grouping_U(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; + return 1; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_particle_etc(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_0, 10); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + if (in_grouping_b_U(z, g_particle_end, 97, 246, 0)) return 0; + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_possessive(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_4, 9); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'k') goto lab0; + z->c--; + return 0; + lab0: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 3, s_0))) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 97) return 0; + if (!find_among_b(z, a_1, 6)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 164) return 0; + if (!find_among_b(z, a_2, 6)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 6: + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 101) return 0; + if (!find_among_b(z, a_3, 2)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_LONG(struct SN_env * z) { + if (!find_among_b(z, a_5, 7)) return 0; + return 1; +} + +static int r_VI(struct SN_env * z) { + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + if (in_grouping_b_U(z, g_V2, 97, 246, 0)) return 0; + return 1; +} + +static int r_case_ending(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + among_var = find_among_b(z, a_6, 30); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + if (z->c <= z->lb || z->p[z->c - 1] != 'a') return 0; + z->c--; + break; + case 2: + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + break; + case 3: + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + break; + case 4: + if (z->c <= z->lb || z->p[z->c - 1] != 'o') return 0; + z->c--; + break; + case 5: + if (!(eq_s_b(z, 2, s_2))) return 0; + break; + case 6: + if (!(eq_s_b(z, 2, s_3))) return 0; + break; + case 7: + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int ret = r_LONG(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_4; + if (!(eq_s_b(z, 2, s_4))) { z->c = z->l - v_2; goto lab0; } + } + lab1: + z->c = z->l - v_3; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) { z->c = z->l - v_2; goto lab0; } + z->c = ret; + } + } + z->bra = z->c; + lab0: + ; + } + break; + case 8: + if (in_grouping_b_U(z, g_V1, 97, 246, 0)) return 0; + if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0; + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[2] = 1; + return 1; +} + +static int r_other_endings(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + among_var = find_among_b(z, a_7, 14); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_5))) goto lab0; + return 0; + lab0: + z->c = z->l - v_2; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_i_plural(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 106)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_8, 2)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_t_plural(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_1; return 0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_V1, 97, 246, 0)) { z->lb = v_1; return 0; } + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + + { + int v_3; + if (z->c < z->I[0]) return 0; + v_3 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 97) { z->lb = v_3; return 0; } + among_var = find_among_b(z, a_9, 2); + if (!among_var) { z->lb = v_3; return 0; } + z->bra = z->c; + z->lb = v_3; + } + switch (among_var) { + case 1: + { + int v_4 = z->l - z->c; + if (!(eq_s_b(z, 2, s_6))) goto lab0; + return 0; + lab0: + z->c = z->l - v_4; + } + break; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_tidy(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_LONG(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + z->c = z->l - v_3; + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (in_grouping_b_U(z, g_AEI, 97, 228, 0)) goto lab1; + z->bra = z->c; + if (in_grouping_b_U(z, g_C, 98, 122, 0)) goto lab1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab2; + z->c--; + z->bra = z->c; + { + int v_6 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab4; + z->c--; + goto lab3; + lab4: + z->c = z->l - v_6; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab2; + z->c--; + } + lab3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + z->c = z->l - v_5; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab5; + z->c--; + z->bra = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab5; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_7; + } + z->lb = v_1; + } + if (in_grouping_b_U(z, g_V1, 97, 246, 1) < 0) return 0; + z->ket = z->c; + if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0; + z->bra = z->c; + z->S[0] = slice_to(z, z->S[0]); + if (z->S[0] == 0) return -1; + if (!(eq_v_b(z, z->S[0]))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int finnish_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->I[2] = 0; + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_particle_etc(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_possessive(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_case_ending(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_other_endings(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + if (!(z->I[2])) goto lab1; + { + int v_6 = z->l - z->c; + { + int ret = r_i_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + goto lab0; +lab1: + { + int v_7 = z->l - z->c; + { + int ret = r_t_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } +lab0: + { + int v_8 = z->l - z->c; + { + int ret = r_tidy(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * finnish_UTF_8_create_env(void) { return SN_create_env(1, 3); } + +extern void finnish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_finnish.h b/contrib/libs/snowball/src_c/stem_UTF_8_finnish.h new file mode 100644 index 000000000000..d6c4921bfad0 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_finnish.h @@ -0,0 +1,15 @@ +/* Generated from finnish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_UTF_8_create_env(void); +extern void finnish_UTF_8_close_env(struct SN_env * z); + +extern int finnish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_french.c b/contrib/libs/snowball/src_c/stem_UTF_8_french.c new file mode 100644 index 000000000000..d33615d04370 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_french.c @@ -0,0 +1,1473 @@ +/* Generated from french.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int french_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_un_accent(struct SN_env * z); +static int r_un_double(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_i_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +static int r_elisions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * french_UTF_8_create_env(void); +extern void french_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'c', 'o', 'l' }; +static const symbol s_0_1[2] = { 'n', 'i' }; +static const symbol s_0_2[3] = { 'p', 'a', 'r' }; +static const symbol s_0_3[3] = { 't', 'a', 'p' }; +static const struct among a_0[4] = { +{ 3, s_0_0, 0, -1, 0}, +{ 2, s_0_1, 0, 1, 0}, +{ 3, s_0_2, 0, -1, 0}, +{ 3, s_0_3, 0, -1, 0} +}; + +static const symbol s_1_1[1] = { 'H' }; +static const symbol s_1_2[2] = { 'H', 'e' }; +static const symbol s_1_3[2] = { 'H', 'i' }; +static const symbol s_1_4[1] = { 'I' }; +static const symbol s_1_5[1] = { 'U' }; +static const symbol s_1_6[1] = { 'Y' }; +static const struct among a_1[7] = { +{ 0, 0, 0, 7, 0}, +{ 1, s_1_1, -1, 6, 0}, +{ 2, s_1_2, -1, 4, 0}, +{ 2, s_1_3, -2, 5, 0}, +{ 1, s_1_4, -4, 1, 0}, +{ 1, s_1_5, -5, 2, 0}, +{ 1, s_1_6, -6, 3, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'q', 'U' }; +static const symbol s_2_1[3] = { 'a', 'b', 'l' }; +static const symbol s_2_2[4] = { 'I', 0xC3, 0xA8, 'r' }; +static const symbol s_2_3[4] = { 'i', 0xC3, 0xA8, 'r' }; +static const symbol s_2_4[3] = { 'e', 'u', 's' }; +static const symbol s_2_5[2] = { 'i', 'v' }; +static const struct among a_2[6] = { +{ 3, s_2_0, 0, 3, 0}, +{ 3, s_2_1, 0, 3, 0}, +{ 4, s_2_2, 0, 4, 0}, +{ 4, s_2_3, 0, 4, 0}, +{ 3, s_2_4, 0, 2, 0}, +{ 2, s_2_5, 0, 1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'c' }; +static const symbol s_3_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_3_2[2] = { 'i', 'v' }; +static const struct among a_3[3] = { +{ 2, s_3_0, 0, 2, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 2, s_3_2, 0, 3, 0} +}; + +static const symbol s_4_0[4] = { 'i', 'q', 'U', 'e' }; +static const symbol s_4_1[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_4_2[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_4_3[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_4_4[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_4_5[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_4_6[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_4_7[4] = { 'e', 'u', 's', 'e' }; +static const symbol s_4_8[4] = { 'i', 's', 't', 'e' }; +static const symbol s_4_9[3] = { 'i', 'v', 'e' }; +static const symbol s_4_10[2] = { 'i', 'f' }; +static const symbol s_4_11[5] = { 'u', 's', 'i', 'o', 'n' }; +static const symbol s_4_12[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_4_13[5] = { 'u', 't', 'i', 'o', 'n' }; +static const symbol s_4_14[5] = { 'a', 't', 'e', 'u', 'r' }; +static const symbol s_4_15[5] = { 'i', 'q', 'U', 'e', 's' }; +static const symbol s_4_16[7] = { 'a', 't', 'r', 'i', 'c', 'e', 's' }; +static const symbol s_4_17[5] = { 'a', 'n', 'c', 'e', 's' }; +static const symbol s_4_18[5] = { 'e', 'n', 'c', 'e', 's' }; +static const symbol s_4_19[6] = { 'l', 'o', 'g', 'i', 'e', 's' }; +static const symbol s_4_20[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_4_21[5] = { 'i', 's', 'm', 'e', 's' }; +static const symbol s_4_22[5] = { 'e', 'u', 's', 'e', 's' }; +static const symbol s_4_23[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_4_24[4] = { 'i', 'v', 'e', 's' }; +static const symbol s_4_25[3] = { 'i', 'f', 's' }; +static const symbol s_4_26[6] = { 'u', 's', 'i', 'o', 'n', 's' }; +static const symbol s_4_27[6] = { 'a', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_28[6] = { 'u', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_29[6] = { 'a', 't', 'e', 'u', 'r', 's' }; +static const symbol s_4_30[5] = { 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_31[6] = { 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_32[9] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_33[5] = { 'i', 't', 0xC3, 0xA9, 's' }; +static const symbol s_4_34[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_4_35[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_36[8] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_37[6] = { 'a', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_38[6] = { 'e', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_39[3] = { 'a', 'u', 'x' }; +static const symbol s_4_40[4] = { 'e', 'a', 'u', 'x' }; +static const symbol s_4_41[3] = { 'e', 'u', 'x' }; +static const symbol s_4_42[3] = { 'o', 'u', 'x' }; +static const symbol s_4_43[4] = { 'i', 't', 0xC3, 0xA9 }; +static const struct among a_4[44] = { +{ 4, s_4_0, 0, 1, 0}, +{ 6, s_4_1, 0, 2, 0}, +{ 4, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 5, 0}, +{ 5, s_4_4, 0, 3, 0}, +{ 4, s_4_5, 0, 1, 0}, +{ 4, s_4_6, 0, 1, 0}, +{ 4, s_4_7, 0, 12, 0}, +{ 4, s_4_8, 0, 1, 0}, +{ 3, s_4_9, 0, 8, 0}, +{ 2, s_4_10, 0, 8, 0}, +{ 5, s_4_11, 0, 4, 0}, +{ 5, s_4_12, 0, 2, 0}, +{ 5, s_4_13, 0, 4, 0}, +{ 5, s_4_14, 0, 2, 0}, +{ 5, s_4_15, 0, 1, 0}, +{ 7, s_4_16, 0, 2, 0}, +{ 5, s_4_17, 0, 1, 0}, +{ 5, s_4_18, 0, 5, 0}, +{ 6, s_4_19, 0, 3, 0}, +{ 5, s_4_20, 0, 1, 0}, +{ 5, s_4_21, 0, 1, 0}, +{ 5, s_4_22, 0, 12, 0}, +{ 5, s_4_23, 0, 1, 0}, +{ 4, s_4_24, 0, 8, 0}, +{ 3, s_4_25, 0, 8, 0}, +{ 6, s_4_26, 0, 4, 0}, +{ 6, s_4_27, 0, 2, 0}, +{ 6, s_4_28, 0, 4, 0}, +{ 6, s_4_29, 0, 2, 0}, +{ 5, s_4_30, 0, 16, 0}, +{ 6, s_4_31, -1, 6, 0}, +{ 9, s_4_32, -1, 13, 0}, +{ 5, s_4_33, 0, 7, 0}, +{ 4, s_4_34, 0, 16, 0}, +{ 5, s_4_35, -1, 6, 0}, +{ 8, s_4_36, -1, 13, 0}, +{ 6, s_4_37, -3, 14, 0}, +{ 6, s_4_38, -4, 15, 0}, +{ 3, s_4_39, 0, 10, 0}, +{ 4, s_4_40, -1, 9, 0}, +{ 3, s_4_41, 0, 1, 0}, +{ 3, s_4_42, 0, 11, 0}, +{ 4, s_4_43, 0, 7, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'r', 'a' }; +static const symbol s_5_1[2] = { 'i', 'e' }; +static const symbol s_5_2[4] = { 'i', 's', 's', 'e' }; +static const symbol s_5_3[7] = { 'i', 's', 's', 'a', 'n', 't', 'e' }; +static const symbol s_5_4[1] = { 'i' }; +static const symbol s_5_5[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_5_6[2] = { 'i', 'r' }; +static const symbol s_5_7[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_8[3] = { 'i', 'e', 's' }; +static const symbol s_5_9[5] = { 0xC3, 0xAE, 'm', 'e', 's' }; +static const symbol s_5_10[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_5_11[8] = { 'i', 's', 's', 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_12[5] = { 0xC3, 0xAE, 't', 'e', 's' }; +static const symbol s_5_13[2] = { 'i', 's' }; +static const symbol s_5_14[5] = { 'i', 'r', 'a', 'i', 's' }; +static const symbol s_5_15[6] = { 'i', 's', 's', 'a', 'i', 's' }; +static const symbol s_5_16[6] = { 'i', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_5_17[7] = { 'i', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_5_18[5] = { 'i', 'r', 'o', 'n', 's' }; +static const symbol s_5_19[6] = { 'i', 's', 's', 'o', 'n', 's' }; +static const symbol s_5_20[7] = { 'i', 's', 's', 'a', 'n', 't', 's' }; +static const symbol s_5_21[2] = { 'i', 't' }; +static const symbol s_5_22[5] = { 'i', 'r', 'a', 'i', 't' }; +static const symbol s_5_23[6] = { 'i', 's', 's', 'a', 'i', 't' }; +static const symbol s_5_24[6] = { 'i', 's', 's', 'a', 'n', 't' }; +static const symbol s_5_25[7] = { 'i', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_26[8] = { 'i', 's', 's', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_27[5] = { 'i', 'r', 'e', 'n', 't' }; +static const symbol s_5_28[6] = { 'i', 's', 's', 'e', 'n', 't' }; +static const symbol s_5_29[5] = { 'i', 'r', 'o', 'n', 't' }; +static const symbol s_5_30[3] = { 0xC3, 0xAE, 't' }; +static const symbol s_5_31[5] = { 'i', 'r', 'i', 'e', 'z' }; +static const symbol s_5_32[6] = { 'i', 's', 's', 'i', 'e', 'z' }; +static const symbol s_5_33[4] = { 'i', 'r', 'e', 'z' }; +static const symbol s_5_34[5] = { 'i', 's', 's', 'e', 'z' }; +static const struct among a_5[35] = { +{ 3, s_5_0, 0, 1, 0}, +{ 2, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0}, +{ 7, s_5_3, 0, 1, 0}, +{ 1, s_5_4, 0, 1, 0}, +{ 4, s_5_5, -1, 1, 0}, +{ 2, s_5_6, 0, 1, 0}, +{ 4, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 1, 0}, +{ 5, s_5_9, 0, 1, 0}, +{ 5, s_5_10, 0, 1, 0}, +{ 8, s_5_11, 0, 1, 0}, +{ 5, s_5_12, 0, 1, 0}, +{ 2, s_5_13, 0, 1, 0}, +{ 5, s_5_14, -1, 1, 0}, +{ 6, s_5_15, -2, 1, 0}, +{ 6, s_5_16, 0, 1, 0}, +{ 7, s_5_17, 0, 1, 0}, +{ 5, s_5_18, 0, 1, 0}, +{ 6, s_5_19, 0, 1, 0}, +{ 7, s_5_20, 0, 1, 0}, +{ 2, s_5_21, 0, 1, 0}, +{ 5, s_5_22, -1, 1, 0}, +{ 6, s_5_23, -2, 1, 0}, +{ 6, s_5_24, 0, 1, 0}, +{ 7, s_5_25, 0, 1, 0}, +{ 8, s_5_26, 0, 1, 0}, +{ 5, s_5_27, 0, 1, 0}, +{ 6, s_5_28, 0, 1, 0}, +{ 5, s_5_29, 0, 1, 0}, +{ 3, s_5_30, 0, 1, 0}, +{ 5, s_5_31, 0, 1, 0}, +{ 6, s_5_32, 0, 1, 0}, +{ 4, s_5_33, 0, 1, 0}, +{ 5, s_5_34, 0, 1, 0} +}; + +static const symbol s_6_0[2] = { 'a', 'l' }; +static const symbol s_6_1[4] = { 0xC3, 0xA9, 'p', 'l' }; +static const symbol s_6_2[3] = { 'a', 'u', 'v' }; +static const struct among a_6[3] = { +{ 2, s_6_0, 0, 1, 0}, +{ 4, s_6_1, 0, -1, 0}, +{ 3, s_6_2, 0, -1, 0} +}; + +static const symbol s_7_0[1] = { 'a' }; +static const symbol s_7_1[3] = { 'e', 'r', 'a' }; +static const symbol s_7_2[4] = { 'a', 'i', 's', 'e' }; +static const symbol s_7_3[4] = { 'a', 's', 's', 'e' }; +static const symbol s_7_4[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_7_5[3] = { 0xC3, 0xA9, 'e' }; +static const symbol s_7_6[2] = { 'a', 'i' }; +static const symbol s_7_7[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_7_8[2] = { 'e', 'r' }; +static const symbol s_7_9[2] = { 'a', 's' }; +static const symbol s_7_10[4] = { 'e', 'r', 'a', 's' }; +static const symbol s_7_11[5] = { 0xC3, 0xA2, 'm', 'e', 's' }; +static const symbol s_7_12[5] = { 'a', 'i', 's', 'e', 's' }; +static const symbol s_7_13[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_7_14[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_7_15[5] = { 0xC3, 0xA2, 't', 'e', 's' }; +static const symbol s_7_16[4] = { 0xC3, 0xA9, 'e', 's' }; +static const symbol s_7_17[3] = { 'a', 'i', 's' }; +static const symbol s_7_18[4] = { 'e', 'a', 'i', 's' }; +static const symbol s_7_19[5] = { 'e', 'r', 'a', 'i', 's' }; +static const symbol s_7_20[4] = { 'i', 'o', 'n', 's' }; +static const symbol s_7_21[6] = { 'e', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_7_22[7] = { 'a', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_7_23[5] = { 'e', 'r', 'o', 'n', 's' }; +static const symbol s_7_24[4] = { 'a', 'n', 't', 's' }; +static const symbol s_7_25[3] = { 0xC3, 0xA9, 's' }; +static const symbol s_7_26[3] = { 'a', 'i', 't' }; +static const symbol s_7_27[5] = { 'e', 'r', 'a', 'i', 't' }; +static const symbol s_7_28[3] = { 'a', 'n', 't' }; +static const symbol s_7_29[5] = { 'a', 'I', 'e', 'n', 't' }; +static const symbol s_7_30[7] = { 'e', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_7_31[6] = { 0xC3, 0xA8, 'r', 'e', 'n', 't' }; +static const symbol s_7_32[6] = { 'a', 's', 's', 'e', 'n', 't' }; +static const symbol s_7_33[5] = { 'e', 'r', 'o', 'n', 't' }; +static const symbol s_7_34[3] = { 0xC3, 0xA2, 't' }; +static const symbol s_7_35[2] = { 'e', 'z' }; +static const symbol s_7_36[3] = { 'i', 'e', 'z' }; +static const symbol s_7_37[5] = { 'e', 'r', 'i', 'e', 'z' }; +static const symbol s_7_38[6] = { 'a', 's', 's', 'i', 'e', 'z' }; +static const symbol s_7_39[4] = { 'e', 'r', 'e', 'z' }; +static const symbol s_7_40[2] = { 0xC3, 0xA9 }; +static const struct among a_7[41] = { +{ 1, s_7_0, 0, 3, 0}, +{ 3, s_7_1, -1, 2, 0}, +{ 4, s_7_2, 0, 4, 0}, +{ 4, s_7_3, 0, 3, 0}, +{ 4, s_7_4, 0, 3, 0}, +{ 3, s_7_5, 0, 2, 0}, +{ 2, s_7_6, 0, 3, 0}, +{ 4, s_7_7, -1, 2, 0}, +{ 2, s_7_8, 0, 2, 0}, +{ 2, s_7_9, 0, 3, 0}, +{ 4, s_7_10, -1, 2, 0}, +{ 5, s_7_11, 0, 3, 0}, +{ 5, s_7_12, 0, 4, 0}, +{ 5, s_7_13, 0, 3, 0}, +{ 5, s_7_14, 0, 3, 0}, +{ 5, s_7_15, 0, 3, 0}, +{ 4, s_7_16, 0, 2, 0}, +{ 3, s_7_17, 0, 4, 0}, +{ 4, s_7_18, -1, 2, 0}, +{ 5, s_7_19, -2, 2, 0}, +{ 4, s_7_20, 0, 1, 0}, +{ 6, s_7_21, -1, 2, 0}, +{ 7, s_7_22, -2, 3, 0}, +{ 5, s_7_23, 0, 2, 0}, +{ 4, s_7_24, 0, 3, 0}, +{ 3, s_7_25, 0, 2, 0}, +{ 3, s_7_26, 0, 3, 0}, +{ 5, s_7_27, -1, 2, 0}, +{ 3, s_7_28, 0, 3, 0}, +{ 5, s_7_29, 0, 3, 0}, +{ 7, s_7_30, -1, 2, 0}, +{ 6, s_7_31, 0, 2, 0}, +{ 6, s_7_32, 0, 3, 0}, +{ 5, s_7_33, 0, 2, 0}, +{ 3, s_7_34, 0, 3, 0}, +{ 2, s_7_35, 0, 2, 0}, +{ 3, s_7_36, -1, 2, 0}, +{ 5, s_7_37, -1, 2, 0}, +{ 6, s_7_38, -2, 3, 0}, +{ 4, s_7_39, -4, 2, 0}, +{ 2, s_7_40, 0, 2, 0} +}; + +static const symbol s_8_0[1] = { 'e' }; +static const symbol s_8_1[5] = { 'I', 0xC3, 0xA8, 'r', 'e' }; +static const symbol s_8_2[5] = { 'i', 0xC3, 0xA8, 'r', 'e' }; +static const symbol s_8_3[3] = { 'i', 'o', 'n' }; +static const symbol s_8_4[3] = { 'I', 'e', 'r' }; +static const symbol s_8_5[3] = { 'i', 'e', 'r' }; +static const struct among a_8[6] = { +{ 1, s_8_0, 0, 3, 0}, +{ 5, s_8_1, -1, 2, 0}, +{ 5, s_8_2, -2, 2, 0}, +{ 3, s_8_3, 0, 1, 0}, +{ 3, s_8_4, 0, 2, 0}, +{ 3, s_8_5, 0, 2, 0} +}; + +static const symbol s_9_0[3] = { 'e', 'l', 'l' }; +static const symbol s_9_1[4] = { 'e', 'i', 'l', 'l' }; +static const symbol s_9_2[3] = { 'e', 'n', 'n' }; +static const symbol s_9_3[3] = { 'o', 'n', 'n' }; +static const symbol s_9_4[3] = { 'e', 't', 't' }; +static const struct among a_9[5] = { +{ 3, s_9_0, 0, -1, 0}, +{ 4, s_9_1, 0, -1, 0}, +{ 3, s_9_2, 0, -1, 0}, +{ 3, s_9_3, 0, -1, 0}, +{ 3, s_9_4, 0, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 130, 103, 8, 5 }; + +static const unsigned char g_oux_ending[] = { 65, 85 }; + +static const unsigned char g_elision_char[] = { 131, 14, 3 }; + +static const unsigned char g_keep_with_s[] = { 1, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'q', 'u' }; +static const symbol s_1[] = { 'U' }; +static const symbol s_2[] = { 'I' }; +static const symbol s_3[] = { 'Y' }; +static const symbol s_4[] = { 0xC3, 0xAB }; +static const symbol s_5[] = { 'H', 'e' }; +static const symbol s_6[] = { 0xC3, 0xAF }; +static const symbol s_7[] = { 'H', 'i' }; +static const symbol s_8[] = { 'Y' }; +static const symbol s_9[] = { 'U' }; +static const symbol s_10[] = { 'i' }; +static const symbol s_11[] = { 'u' }; +static const symbol s_12[] = { 'y' }; +static const symbol s_13[] = { 0xC3, 0xAB }; +static const symbol s_14[] = { 0xC3, 0xAF }; +static const symbol s_15[] = { 'i', 'c' }; +static const symbol s_16[] = { 'i', 'q', 'U' }; +static const symbol s_17[] = { 'l', 'o', 'g' }; +static const symbol s_18[] = { 'u' }; +static const symbol s_19[] = { 'e', 'n', 't' }; +static const symbol s_20[] = { 'a', 't' }; +static const symbol s_21[] = { 'e', 'u', 'x' }; +static const symbol s_22[] = { 'i' }; +static const symbol s_23[] = { 'a', 'b', 'l' }; +static const symbol s_24[] = { 'i', 'q', 'U' }; +static const symbol s_25[] = { 'a', 't' }; +static const symbol s_26[] = { 'i', 'c' }; +static const symbol s_27[] = { 'i', 'q', 'U' }; +static const symbol s_28[] = { 'e', 'a', 'u' }; +static const symbol s_29[] = { 'a', 'l' }; +static const symbol s_30[] = { 'o', 'u' }; +static const symbol s_31[] = { 'e', 'u', 'x' }; +static const symbol s_32[] = { 'a', 'n', 't' }; +static const symbol s_33[] = { 'e', 'n', 't' }; +static const symbol s_34[] = { 'H', 'i' }; +static const symbol s_35[] = { 'i' }; +static const symbol s_36[] = { 0xC3, 0xA9 }; +static const symbol s_37[] = { 0xC3, 0xA8 }; +static const symbol s_38[] = { 'e' }; +static const symbol s_39[] = { 'i' }; +static const symbol s_40[] = { 0xC3, 0xA7 }; +static const symbol s_41[] = { 'c' }; + +static int r_elisions(struct SN_env * z) { + z->bra = z->c; + { + int v_1 = z->c; + if (in_grouping_U(z, g_elision_char, 99, 116, 0)) goto lab1; + goto lab0; + lab1: + z->c = v_1; + if (!(eq_s(z, 2, s_0))) return 0; + } +lab0: + if (z->c == z->l || z->p[z->c] != '\'') return 0; + z->c++; + z->ket = z->c; + if (z->c < z->l) goto lab2; + return 0; +lab2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_prelude(struct SN_env * z) { + while (1) { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + { + int v_3 = z->c; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab3; + z->bra = z->c; + { + int v_4 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab5; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab5; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'i') goto lab6; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab6; + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + goto lab4; + lab6: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'y') goto lab3; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + } + lab4: + goto lab2; + lab3: + z->c = v_3; + z->bra = z->c; + if (!(eq_s(z, 2, s_4))) goto lab7; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + goto lab2; + lab7: + z->c = v_3; + z->bra = z->c; + if (!(eq_s(z, 2, s_6))) goto lab8; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + goto lab2; + lab8: + z->c = v_3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab9; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab9; + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + goto lab2; + lab9: + z->c = v_3; + if (z->c == z->l || z->p[z->c] != 'q') goto lab1; + z->c++; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab1; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + } + lab2: + z->c = v_2; + break; + lab1: + z->c = v_2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + int among_var; + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab2; + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + goto lab1; + lab2: + z->c = v_2; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 3 || !((33282 >> (z->p[z->c + 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among(z, a_0, 4); + if (!among_var) goto lab3; + switch (among_var) { + case 1: + if (in_grouping_U(z, g_v, 97, 251, 0)) goto lab3; + break; + } + goto lab1; + lab3: + z->c = v_2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + { + int ret = out_grouping_U(z, g_v, 97, 251, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_3 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[0] = z->c; + lab4: + z->c = v_3; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 2 || !((35652352 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 7; else + among_var = find_among(z, a_1, 7); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_13); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_4, 44); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int v_2 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + } + lab1: + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_18); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_19); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_2, 6); + if (!among_var) { z->c = z->l - v_3; goto lab3; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_20))) { z->c = z->l - v_3; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_4 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_4; + { + int ret = r_R1(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + } + lab4: + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_3; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_22); + if (ret < 0) return ret; + } + break; + } + lab3: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_5; goto lab6; } + among_var = find_among_b(z, a_3, 3); + if (!among_var) { z->c = z->l - v_5; goto lab6; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_6 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_6; + { + int ret = slice_from_s(z, 3, s_23); + if (ret < 0) return ret; + } + } + lab7: + break; + case 2: + { + int v_7 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab9; + lab10: + z->c = z->l - v_7; + { + int ret = slice_from_s(z, 3, s_24); + if (ret < 0) return ret; + } + } + lab9: + break; + case 3: + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_5; goto lab6; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab6: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_25))) { z->c = z->l - v_8; goto lab11; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_8; goto lab11; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_26))) { z->c = z->l - v_8; goto lab11; } + z->bra = z->c; + { + int v_9 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - v_9; + { + int ret = slice_from_s(z, 3, s_27); + if (ret < 0) return ret; + } + } + lab12: + lab11: + ; + } + break; + case 9: + { + int ret = slice_from_s(z, 3, s_28); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_29); + if (ret < 0) return ret; + } + break; + case 11: + if (in_grouping_b_U(z, g_oux_ending, 98, 112, 0)) return 0; + { + int ret = slice_from_s(z, 2, s_30); + if (ret < 0) return ret; + } + break; + case 12: + { + int v_10 = z->l - z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab15; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab14; + lab15: + z->c = z->l - v_10; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + } + lab14: + break; + case 13: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + if (out_grouping_b_U(z, g_v, 97, 251, 0)) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_32); + if (ret < 0) return ret; + } + return 0; + break; + case 15: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_33); + if (ret < 0) return ret; + } + return 0; + break; + case 16: + { + int v_11 = z->l - z->c; + if (in_grouping_b_U(z, g_v, 97, 251, 0)) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_11; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 0; + break; + } + return 1; +} + +static int r_i_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68944418 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_5, 35)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'H') goto lab0; + z->c--; + { z->lb = v_1; return 0; } + lab0: + z->c = z->l - v_2; + } + if (out_grouping_b_U(z, g_v, 97, 251, 0)) { z->lb = v_1; return 0; } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + among_var = find_among_b(z, a_7, 41); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') { z->c = z->l - v_2; goto lab0; } + z->c--; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_2; goto lab0; } + if (ret < 0) return ret; + } + z->bra = z->c; + lab0: + ; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int v_3 = z->l - z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 108 && z->p[z->c - 1] != 118)) goto lab1; + among_var = find_among_b(z, a_6, 3); + if (!among_var) goto lab1; + switch (among_var) { + case 1: + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + if (z->c > z->lb) goto lab1; + break; + } + return 0; + lab1: + z->c = z->l - v_3; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 2, s_34))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + if (out_grouping_b_U(z, g_keep_with_s, 97, 232, 0)) { z->c = z->l - v_1; goto lab0; } + } + lab1: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + + { + int v_4; + if (z->c < z->I[2]) return 0; + v_4 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((278560 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_4; return 0; } + among_var = find_among_b(z, a_8, 6); + if (!among_var) { z->lb = v_4; return 0; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret == 0) { z->lb = v_4; return 0; } + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab4; + z->c--; + goto lab3; + lab4: + z->c = z->l - v_5; + if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_4; return 0; } + z->c--; + } + lab3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_35); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->lb = v_4; + } + return 1; +} + +static int r_un_double(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1069056 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_9, 5)) return 0; + z->c = z->l - v_1; + } + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_un_accent(struct SN_env * z) { + { + int v_1 = 1; + while (1) { + if (out_grouping_b_U(z, g_v, 97, 251, 0)) goto lab0; + v_1--; + continue; + lab0: + break; + } + if (v_1 > 0) return 0; + } + z->ket = z->c; + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_36))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_37))) return 0; + } +lab1: + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_38); + if (ret < 0) return ret; + } + return 1; +} + +extern int french_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_elisions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + { + int v_6 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = z->l - v_6; + { + int ret = r_i_verb_suffix(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + goto lab3; + lab5: + z->c = z->l - v_6; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + } + lab3: + z->c = z->l - v_5; + { + int v_7 = z->l - z->c; + z->ket = z->c; + { + int v_8 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') goto lab8; + z->c--; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_39); + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_8; + if (!(eq_s_b(z, 2, s_40))) { z->c = z->l - v_7; goto lab6; } + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_41); + if (ret < 0) return ret; + } + } + lab7: + lab6: + ; + } + } + goto lab1; + lab2: + z->c = z->l - v_4; + { + int ret = r_residual_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_3; + } + { + int v_9 = z->l - z->c; + { + int ret = r_un_double(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_un_accent(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + z->c = z->lb; + { + int v_11 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_11; + } + return 1; +} + +extern struct SN_env * french_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void french_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_french.h b/contrib/libs/snowball/src_c/stem_UTF_8_french.h new file mode 100644 index 000000000000..5ff67b920feb --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_french.h @@ -0,0 +1,15 @@ +/* Generated from french.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_UTF_8_create_env(void); +extern void french_UTF_8_close_env(struct SN_env * z); + +extern int french_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_german.c b/contrib/libs/snowball/src_c/stem_UTF_8_german.c new file mode 100644 index 000000000000..5878df2dec4e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_german.c @@ -0,0 +1,635 @@ +/* Generated from german.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int german_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * german_UTF_8_create_env(void); +extern void german_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 'a', 'e' }; +static const symbol s_0_2[2] = { 'o', 'e' }; +static const symbol s_0_3[2] = { 'q', 'u' }; +static const symbol s_0_4[2] = { 'u', 'e' }; +static const symbol s_0_5[2] = { 0xC3, 0x9F }; +static const struct among a_0[6] = { +{ 0, 0, 0, 5, 0}, +{ 2, s_0_1, -1, 2, 0}, +{ 2, s_0_2, -2, 3, 0}, +{ 2, s_0_3, -3, -1, 0}, +{ 2, s_0_4, -4, 4, 0}, +{ 2, s_0_5, -5, 1, 0} +}; + +static const symbol s_1_1[1] = { 'U' }; +static const symbol s_1_2[1] = { 'Y' }; +static const symbol s_1_3[2] = { 0xC3, 0xA4 }; +static const symbol s_1_4[2] = { 0xC3, 0xB6 }; +static const symbol s_1_5[2] = { 0xC3, 0xBC }; +static const struct among a_1[6] = { +{ 0, 0, 0, 5, 0}, +{ 1, s_1_1, -1, 2, 0}, +{ 1, s_1_2, -2, 1, 0}, +{ 2, s_1_3, -3, 3, 0}, +{ 2, s_1_4, -4, 4, 0}, +{ 2, s_1_5, -5, 2, 0} +}; + +static const symbol s_2_0[1] = { 'e' }; +static const symbol s_2_1[2] = { 'e', 'm' }; +static const symbol s_2_2[2] = { 'e', 'n' }; +static const symbol s_2_3[7] = { 'e', 'r', 'i', 'n', 'n', 'e', 'n' }; +static const symbol s_2_4[4] = { 'e', 'r', 'i', 'n' }; +static const symbol s_2_5[2] = { 'l', 'n' }; +static const symbol s_2_6[3] = { 'e', 'r', 'n' }; +static const symbol s_2_7[2] = { 'e', 'r' }; +static const symbol s_2_8[1] = { 's' }; +static const symbol s_2_9[2] = { 'e', 's' }; +static const symbol s_2_10[3] = { 'l', 'n', 's' }; +static const struct among a_2[11] = { +{ 1, s_2_0, 0, 3, 0}, +{ 2, s_2_1, 0, 1, 0}, +{ 2, s_2_2, 0, 3, 0}, +{ 7, s_2_3, -1, 2, 0}, +{ 4, s_2_4, 0, 2, 0}, +{ 2, s_2_5, 0, 5, 0}, +{ 3, s_2_6, 0, 2, 0}, +{ 2, s_2_7, 0, 2, 0}, +{ 1, s_2_8, 0, 4, 0}, +{ 2, s_2_9, -1, 3, 0}, +{ 3, s_2_10, -2, 5, 0} +}; + +static const symbol s_3_0[4] = { 't', 'i', 'c', 'k' }; +static const symbol s_3_1[4] = { 'p', 'l', 'a', 'n' }; +static const symbol s_3_2[6] = { 'g', 'e', 'o', 'r', 'd', 'n' }; +static const symbol s_3_3[6] = { 'i', 'n', 't', 'e', 'r', 'n' }; +static const symbol s_3_4[2] = { 't', 'r' }; +static const struct among a_3[5] = { +{ 4, s_3_0, 0, -1, 0}, +{ 4, s_3_1, 0, -1, 0}, +{ 6, s_3_2, 0, -1, 0}, +{ 6, s_3_3, 0, -1, 0}, +{ 2, s_3_4, 0, -1, 0} +}; + +static const symbol s_4_0[2] = { 'e', 'n' }; +static const symbol s_4_1[2] = { 'e', 'r' }; +static const symbol s_4_2[2] = { 'e', 't' }; +static const symbol s_4_3[2] = { 's', 't' }; +static const symbol s_4_4[3] = { 'e', 's', 't' }; +static const struct among a_4[5] = { +{ 2, s_4_0, 0, 1, 0}, +{ 2, s_4_1, 0, 1, 0}, +{ 2, s_4_2, 0, 3, 0}, +{ 2, s_4_3, 0, 2, 0}, +{ 3, s_4_4, -1, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'g' }; +static const symbol s_5_1[4] = { 'l', 'i', 'c', 'h' }; +static const struct among a_5[2] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'e', 'n', 'd' }; +static const symbol s_6_1[2] = { 'i', 'g' }; +static const symbol s_6_2[3] = { 'u', 'n', 'g' }; +static const symbol s_6_3[4] = { 'l', 'i', 'c', 'h' }; +static const symbol s_6_4[4] = { 'i', 's', 'c', 'h' }; +static const symbol s_6_5[2] = { 'i', 'k' }; +static const symbol s_6_6[4] = { 'h', 'e', 'i', 't' }; +static const symbol s_6_7[4] = { 'k', 'e', 'i', 't' }; +static const struct among a_6[8] = { +{ 3, s_6_0, 0, 1, 0}, +{ 2, s_6_1, 0, 2, 0}, +{ 3, s_6_2, 0, 1, 0}, +{ 4, s_6_3, 0, 3, 0}, +{ 4, s_6_4, 0, 2, 0}, +{ 2, s_6_5, 0, 2, 0}, +{ 4, s_6_6, 0, 3, 0}, +{ 4, s_6_7, 0, 4, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 }; + +static const unsigned char g_et_ending[] = { 1, 128, 198, 227, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_s_ending[] = { 117, 30, 5 }; + +static const unsigned char g_st_ending[] = { 117, 30, 4 }; + +static const symbol s_0[] = { 'U' }; +static const symbol s_1[] = { 'Y' }; +static const symbol s_2[] = { 's', 's' }; +static const symbol s_3[] = { 0xC3, 0xA4 }; +static const symbol s_4[] = { 0xC3, 0xB6 }; +static const symbol s_5[] = { 0xC3, 0xBC }; +static const symbol s_6[] = { 'y' }; +static const symbol s_7[] = { 'u' }; +static const symbol s_8[] = { 'a' }; +static const symbol s_9[] = { 'o' }; +static const symbol s_10[] = { 's', 'y', 's', 't' }; +static const symbol s_11[] = { 'n', 'i', 's' }; +static const symbol s_12[] = { 'l' }; +static const symbol s_13[] = { 'i', 'g' }; +static const symbol s_14[] = { 'e', 'r' }; +static const symbol s_15[] = { 'e', 'n' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab1; + z->bra = z->c; + { + int v_4 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab3; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab3; + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = v_4; + if (z->c == z->l || z->p[z->c] != 'y') goto lab1; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab1; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + } + lab2: + z->c = v_3; + break; + lab1: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + while (1) { + int v_5 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_4); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab4; + z->c = ret; + } + break; + } + continue; + lab4: + z->c = v_5; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[2] = z->c; + if (z->I[2] >= z->I[0]) goto lab0; + z->I[2] = z->I[0]; +lab0: + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + among_var = find_among(z, a_1, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((811040 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) goto lab0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 4, s_10))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') { z->c = z->l - v_3; goto lab2; } + z->c--; + z->bra = z->c; + if (!(eq_s_b(z, 3, s_11))) { z->c = z->l - v_3; goto lab2; } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 4: + if (in_grouping_b_U(z, g_s_ending, 98, 116, 0)) goto lab0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - v_1; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1327104 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3; + among_var = find_among_b(z, a_4, 5); + if (!among_var) goto lab3; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b_U(z, g_st_ending, 98, 116, 0)) goto lab3; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 3); + if (ret < 0) goto lab3; + z->c = ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_5 = z->l - z->c; + if (in_grouping_b_U(z, g_et_ending, 85, 228, 0)) goto lab3; + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((280576 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab4; + if (!find_among_b(z, a_3, 5)) goto lab4; + goto lab3; + lab4: + z->c = z->l - v_6; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab3: + z->c = z->l - v_4; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1051024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab5; + among_var = find_among_b(z, a_6, 8); + if (!among_var) goto lab5; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_13))) { z->c = z->l - v_8; goto lab6; } + z->bra = z->c; + { + int v_9 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab7; + z->c--; + { z->c = z->l - v_8; goto lab6; } + lab7: + z->c = z->l - v_9; + } + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_8; goto lab6; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab6: + ; + } + break; + case 2: + { + int v_10 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab8; + z->c--; + goto lab5; + lab8: + z->c = z->l - v_10; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_11 = z->l - z->c; + z->ket = z->c; + { + int v_12 = z->l - z->c; + if (!(eq_s_b(z, 2, s_14))) goto lab11; + goto lab10; + lab11: + z->c = z->l - v_12; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - v_11; goto lab9; } + } + lab10: + z->bra = z->c; + { + int ret = r_R1(z); + if (ret == 0) { z->c = z->l - v_11; goto lab9; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab9: + ; + } + break; + case 4: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_13 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 103 && z->p[z->c - 1] != 104)) { z->c = z->l - v_13; goto lab12; } + if (!find_among_b(z, a_5, 2)) { z->c = z->l - v_13; goto lab12; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_13; goto lab12; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab12: + ; + } + break; + } + lab5: + z->c = z->l - v_7; + } + return 1; +} + +extern int german_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int v_2 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + z->lb = z->c; z->c = z->l; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->lb; + { + int v_3 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_3; + } + return 1; +} + +extern struct SN_env * german_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void german_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_german.h b/contrib/libs/snowball/src_c/stem_UTF_8_german.h new file mode 100644 index 000000000000..c3548f870e5b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_german.h @@ -0,0 +1,15 @@ +/* Generated from german.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_UTF_8_create_env(void); +extern void german_UTF_8_close_env(struct SN_env * z); + +extern int german_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_greek.c b/contrib/libs/snowball/src_c/stem_UTF_8_greek.c new file mode 100644 index 000000000000..293cd846413f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_greek.c @@ -0,0 +1,3755 @@ +/* Generated from greek.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +static int r_step_7(struct SN_env * z); +static int r_step_6(struct SN_env * z); +static int r_step_5m(struct SN_env * z); +static int r_step_5l(struct SN_env * z); +static int r_step_5k(struct SN_env * z); +static int r_step_5j(struct SN_env * z); +static int r_step_5i(struct SN_env * z); +static int r_step_5h(struct SN_env * z); +static int r_step_5g(struct SN_env * z); +static int r_step_5f(struct SN_env * z); +static int r_step_5e(struct SN_env * z); +static int r_step_5d(struct SN_env * z); +static int r_step_5c(struct SN_env * z); +static int r_step_5b(struct SN_env * z); +static int r_step_5a(struct SN_env * z); +static int r_step_4(struct SN_env * z); +static int r_step_3(struct SN_env * z); +static int r_step_2d(struct SN_env * z); +static int r_step_2c(struct SN_env * z); +static int r_step_2b(struct SN_env * z); +static int r_step_2a(struct SN_env * z); +static int r_step_1(struct SN_env * z); +static int r_step_s10(struct SN_env * z); +static int r_step_s9(struct SN_env * z); +static int r_step_s8(struct SN_env * z); +static int r_step_s7(struct SN_env * z); +static int r_step_s6(struct SN_env * z); +static int r_step_s5(struct SN_env * z); +static int r_step_s4(struct SN_env * z); +static int r_step_s3(struct SN_env * z); +static int r_step_s2(struct SN_env * z); +static int r_step_s1(struct SN_env * z); +static int r_has_min_length(struct SN_env * z); +static int r_tolower(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif +extern int greek_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * greek_UTF_8_create_env(void); +extern void greek_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 0xCF, 0x82 }; +static const symbol s_0_2[2] = { 0xCE, 0x86 }; +static const symbol s_0_3[2] = { 0xCE, 0x88 }; +static const symbol s_0_4[2] = { 0xCE, 0x89 }; +static const symbol s_0_5[2] = { 0xCE, 0x8A }; +static const symbol s_0_6[2] = { 0xCF, 0x8A }; +static const symbol s_0_7[2] = { 0xCF, 0x8B }; +static const symbol s_0_8[2] = { 0xCE, 0x8C }; +static const symbol s_0_9[2] = { 0xCF, 0x8C }; +static const symbol s_0_10[2] = { 0xCF, 0x8D }; +static const symbol s_0_11[2] = { 0xCE, 0x8E }; +static const symbol s_0_12[2] = { 0xCF, 0x8E }; +static const symbol s_0_13[2] = { 0xCE, 0x8F }; +static const symbol s_0_14[2] = { 0xCE, 0x90 }; +static const symbol s_0_15[2] = { 0xCE, 0x91 }; +static const symbol s_0_16[2] = { 0xCE, 0x92 }; +static const symbol s_0_17[2] = { 0xCE, 0x93 }; +static const symbol s_0_18[2] = { 0xCE, 0x94 }; +static const symbol s_0_19[2] = { 0xCE, 0x95 }; +static const symbol s_0_20[2] = { 0xCE, 0x96 }; +static const symbol s_0_21[2] = { 0xCE, 0x97 }; +static const symbol s_0_22[2] = { 0xCE, 0x98 }; +static const symbol s_0_23[2] = { 0xCE, 0x99 }; +static const symbol s_0_24[2] = { 0xCE, 0x9A }; +static const symbol s_0_25[2] = { 0xCE, 0x9B }; +static const symbol s_0_26[2] = { 0xCE, 0x9C }; +static const symbol s_0_27[2] = { 0xCE, 0x9D }; +static const symbol s_0_28[2] = { 0xCE, 0x9E }; +static const symbol s_0_29[2] = { 0xCE, 0x9F }; +static const symbol s_0_30[2] = { 0xCE, 0xA0 }; +static const symbol s_0_31[2] = { 0xCE, 0xA1 }; +static const symbol s_0_32[2] = { 0xCE, 0xA3 }; +static const symbol s_0_33[2] = { 0xCE, 0xA4 }; +static const symbol s_0_34[2] = { 0xCE, 0xA5 }; +static const symbol s_0_35[2] = { 0xCE, 0xA6 }; +static const symbol s_0_36[2] = { 0xCE, 0xA7 }; +static const symbol s_0_37[2] = { 0xCE, 0xA8 }; +static const symbol s_0_38[2] = { 0xCE, 0xA9 }; +static const symbol s_0_39[2] = { 0xCE, 0xAA }; +static const symbol s_0_40[2] = { 0xCE, 0xAB }; +static const symbol s_0_41[2] = { 0xCE, 0xAC }; +static const symbol s_0_42[2] = { 0xCE, 0xAD }; +static const symbol s_0_43[2] = { 0xCE, 0xAE }; +static const symbol s_0_44[2] = { 0xCE, 0xAF }; +static const symbol s_0_45[2] = { 0xCE, 0xB0 }; +static const struct among a_0[46] = { +{ 0, 0, 0, 25, 0}, +{ 2, s_0_1, -1, 18, 0}, +{ 2, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, 5, 0}, +{ 2, s_0_4, -4, 7, 0}, +{ 2, s_0_5, -5, 9, 0}, +{ 2, s_0_6, -6, 7, 0}, +{ 2, s_0_7, -7, 20, 0}, +{ 2, s_0_8, -8, 15, 0}, +{ 2, s_0_9, -9, 15, 0}, +{ 2, s_0_10, -10, 20, 0}, +{ 2, s_0_11, -11, 20, 0}, +{ 2, s_0_12, -12, 24, 0}, +{ 2, s_0_13, -13, 24, 0}, +{ 2, s_0_14, -14, 7, 0}, +{ 2, s_0_15, -15, 1, 0}, +{ 2, s_0_16, -16, 2, 0}, +{ 2, s_0_17, -17, 3, 0}, +{ 2, s_0_18, -18, 4, 0}, +{ 2, s_0_19, -19, 5, 0}, +{ 2, s_0_20, -20, 6, 0}, +{ 2, s_0_21, -21, 7, 0}, +{ 2, s_0_22, -22, 8, 0}, +{ 2, s_0_23, -23, 9, 0}, +{ 2, s_0_24, -24, 10, 0}, +{ 2, s_0_25, -25, 11, 0}, +{ 2, s_0_26, -26, 12, 0}, +{ 2, s_0_27, -27, 13, 0}, +{ 2, s_0_28, -28, 14, 0}, +{ 2, s_0_29, -29, 15, 0}, +{ 2, s_0_30, -30, 16, 0}, +{ 2, s_0_31, -31, 17, 0}, +{ 2, s_0_32, -32, 18, 0}, +{ 2, s_0_33, -33, 19, 0}, +{ 2, s_0_34, -34, 20, 0}, +{ 2, s_0_35, -35, 21, 0}, +{ 2, s_0_36, -36, 22, 0}, +{ 2, s_0_37, -37, 23, 0}, +{ 2, s_0_38, -38, 24, 0}, +{ 2, s_0_39, -39, 9, 0}, +{ 2, s_0_40, -40, 20, 0}, +{ 2, s_0_41, -41, 1, 0}, +{ 2, s_0_42, -42, 5, 0}, +{ 2, s_0_43, -43, 7, 0}, +{ 2, s_0_44, -44, 9, 0}, +{ 2, s_0_45, -45, 20, 0} +}; + +static const symbol s_1_0[16] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x89, 0xCF, 0x83 }; +static const symbol s_1_1[6] = { 0xCF, 0x86, 0xCF, 0x89, 0xCF, 0x83 }; +static const symbol s_1_2[10] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_1_3[10] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_1_4[10] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_1_5[20] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_6[10] = { 0xCF, 0x86, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_7[14] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_8[14] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_9[14] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_10[18] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_11[14] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_1_12[12] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_1_13[14] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_1_14[12] = { 0xCF, 0x83, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_1_15[16] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_1_16[14] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_1_17[18] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_18[8] = { 0xCF, 0x86, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_19[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_20[12] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_21[12] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_22[16] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_1_23[10] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_1_24[12] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_1_25[10] = { 0xCF, 0x83, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_1_26[14] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_1_27[12] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_1_28[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB7 }; +static const symbol s_1_29[20] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x89, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_30[10] = { 0xCF, 0x86, 0xCF, 0x89, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_31[14] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_32[14] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_33[14] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_34[18] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_35[12] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_36[14] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_37[12] = { 0xCF, 0x83, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_38[16] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_1_39[14] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_1[40] = { +{ 16, s_1_0, 0, 10, 0}, +{ 6, s_1_1, 0, 9, 0}, +{ 10, s_1_2, 0, 7, 0}, +{ 10, s_1_3, 0, 8, 0}, +{ 10, s_1_4, 0, 6, 0}, +{ 20, s_1_5, 0, 10, 0}, +{ 10, s_1_6, 0, 9, 0}, +{ 14, s_1_7, 0, 7, 0}, +{ 14, s_1_8, 0, 8, 0}, +{ 14, s_1_9, 0, 6, 0}, +{ 18, s_1_10, 0, 11, 0}, +{ 14, s_1_11, 0, 11, 0}, +{ 12, s_1_12, 0, 1, 0}, +{ 14, s_1_13, 0, 2, 0}, +{ 12, s_1_14, 0, 4, 0}, +{ 16, s_1_15, 0, 5, 0}, +{ 14, s_1_16, 0, 3, 0}, +{ 18, s_1_17, 0, 10, 0}, +{ 8, s_1_18, 0, 9, 0}, +{ 12, s_1_19, 0, 7, 0}, +{ 12, s_1_20, 0, 8, 0}, +{ 12, s_1_21, 0, 6, 0}, +{ 16, s_1_22, 0, 11, 0}, +{ 10, s_1_23, 0, 1, 0}, +{ 12, s_1_24, 0, 2, 0}, +{ 10, s_1_25, 0, 4, 0}, +{ 14, s_1_26, 0, 5, 0}, +{ 12, s_1_27, 0, 3, 0}, +{ 12, s_1_28, 0, 7, 0}, +{ 20, s_1_29, 0, 10, 0}, +{ 10, s_1_30, 0, 9, 0}, +{ 14, s_1_31, 0, 7, 0}, +{ 14, s_1_32, 0, 8, 0}, +{ 14, s_1_33, 0, 6, 0}, +{ 18, s_1_34, 0, 11, 0}, +{ 12, s_1_35, 0, 1, 0}, +{ 14, s_1_36, 0, 2, 0}, +{ 12, s_1_37, 0, 4, 0}, +{ 16, s_1_38, 0, 5, 0}, +{ 14, s_1_39, 0, 3, 0} +}; + +static const symbol s_2_0[2] = { 0xCF, 0x80 }; +static const symbol s_2_1[6] = { 0xCE, 0xB9, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_2_2[2] = { 0xCF, 0x81 }; +static const symbol s_2_3[4] = { 0xCF, 0x80, 0xCF, 0x81 }; +static const symbol s_2_4[6] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCF, 0x81 }; +static const symbol s_2_5[6] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x81 }; +static const symbol s_2_6[12] = { 0xCE, 0xB3, 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xBA, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_2_7[10] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_2_8[10] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_2_9[6] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_2_10[6] = { 0xCE, 0xB3, 0xCE, 0xBA, 0xCF, 0x81 }; +static const symbol s_2_11[14] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_2_12[12] = { 0xCE, 0xB2, 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xB2, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_2_13[12] = { 0xCE, 0xB3, 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_2_14[6] = { 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_2_15[4] = { 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_16[12] = { 0xCE, 0xBE, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_17[6] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_18[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_19[12] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_20[8] = { 0xCE, 0xB5, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_2_21[2] = { 0xCE, 0xB2 }; +static const symbol s_2_22[8] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_2_23[12] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x85, 0xCF, 0x81, 0xCE, 0xB9 }; +static const symbol s_2_24[8] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBA }; +static const symbol s_2_25[8] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBA }; +static const symbol s_2_26[2] = { 0xCE, 0xBB }; +static const symbol s_2_27[2] = { 0xCE, 0xBC }; +static const symbol s_2_28[8] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xBD }; +static const symbol s_2_29[8] = { 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const symbol s_2_30[14] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const struct among a_2[31] = { +{ 2, s_2_0, 0, 2, 0}, +{ 6, s_2_1, -1, 2, 0}, +{ 2, s_2_2, 0, 2, 0}, +{ 4, s_2_3, -1, 2, 0}, +{ 6, s_2_4, -1, 2, 0}, +{ 6, s_2_5, -3, 2, 0}, +{ 12, s_2_6, -4, 2, 0}, +{ 10, s_2_7, -5, 2, 0}, +{ 10, s_2_8, -6, 2, 0}, +{ 6, s_2_9, -7, 2, 0}, +{ 6, s_2_10, -8, 2, 0}, +{ 14, s_2_11, -9, 2, 0}, +{ 12, s_2_12, -10, 2, 0}, +{ 12, s_2_13, -11, 2, 0}, +{ 6, s_2_14, 0, 2, 0}, +{ 4, s_2_15, 0, 1, 0}, +{ 12, s_2_16, -1, 1, 0}, +{ 6, s_2_17, -2, 1, 0}, +{ 12, s_2_18, -3, 1, 0}, +{ 12, s_2_19, -4, 1, 0}, +{ 8, s_2_20, -5, 1, 0}, +{ 2, s_2_21, 0, 2, 0}, +{ 8, s_2_22, 0, 1, 0}, +{ 12, s_2_23, 0, 2, 0}, +{ 8, s_2_24, 0, 2, 0}, +{ 8, s_2_25, 0, 2, 0}, +{ 2, s_2_26, 0, 2, 0}, +{ 2, s_2_27, 0, 2, 0}, +{ 8, s_2_28, 0, 2, 0}, +{ 8, s_2_29, 0, 1, 0}, +{ 14, s_2_30, -1, 1, 0} +}; + +static const symbol s_3_0[8] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_3_1[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_3_2[6] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCF, 0x89 }; +static const symbol s_3_3[6] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB1 }; +static const symbol s_3_4[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_3_5[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_3_6[6] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB5 }; +static const symbol s_3_7[12] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_3_8[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_3_9[12] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_3_10[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_3_11[8] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_3_12[10] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_3_13[8] = { 0xCE, 0xB9, 0xCE, 0xB6, 0xCE, 0xB1, 0xCE, 0xBD }; +static const struct among a_3[14] = { +{ 8, s_3_0, 0, 1, 0}, +{ 10, s_3_1, 0, 1, 0}, +{ 6, s_3_2, 0, 1, 0}, +{ 6, s_3_3, 0, 1, 0}, +{ 10, s_3_4, 0, 1, 0}, +{ 10, s_3_5, 0, 1, 0}, +{ 6, s_3_6, 0, 1, 0}, +{ 12, s_3_7, 0, 1, 0}, +{ 10, s_3_8, 0, 1, 0}, +{ 12, s_3_9, 0, 1, 0}, +{ 10, s_3_10, 0, 1, 0}, +{ 8, s_3_11, 0, 1, 0}, +{ 10, s_3_12, 0, 1, 0}, +{ 8, s_3_13, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 0xCF, 0x83 }; +static const symbol s_4_1[2] = { 0xCF, 0x87 }; +static const symbol s_4_2[4] = { 0xCF, 0x85, 0xCF, 0x88 }; +static const symbol s_4_3[4] = { 0xCE, 0xB6, 0xCF, 0x89 }; +static const symbol s_4_4[4] = { 0xCE, 0xB2, 0xCE, 0xB9 }; +static const symbol s_4_5[4] = { 0xCE, 0xBB, 0xCE, 0xB9 }; +static const symbol s_4_6[4] = { 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_4_7[4] = { 0xCE, 0xB5, 0xCE, 0xBD }; +static const struct among a_4[8] = { +{ 2, s_4_0, 0, 1, 0}, +{ 2, s_4_1, 0, 1, 0}, +{ 4, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 1, 0}, +{ 4, s_4_4, 0, 1, 0}, +{ 4, s_4_5, 0, 1, 0}, +{ 4, s_4_6, 0, 1, 0}, +{ 4, s_4_7, 0, 1, 0} +}; + +static const symbol s_5_0[12] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_5_1[10] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1 }; +static const symbol s_5_2[14] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_5_3[10] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5 }; +static const symbol s_5_4[14] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_5_5[14] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_5_6[12] = { 0xCF, 0x89, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD }; +static const struct among a_5[7] = { +{ 12, s_5_0, 0, 1, 0}, +{ 10, s_5_1, 0, 1, 0}, +{ 14, s_5_2, 0, 1, 0}, +{ 10, s_5_3, 0, 1, 0}, +{ 14, s_5_4, 0, 1, 0}, +{ 14, s_5_5, 0, 1, 0}, +{ 12, s_5_6, 0, 1, 0} +}; + +static const symbol s_6_0[2] = { 0xCF, 0x80 }; +static const symbol s_6_1[6] = { 0xCE, 0xBB, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_6_2[16] = { 0xCE, 0xB4, 0xCE, 0xB7, 0xCE, 0xBC, 0xCE, 0xBF, 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_6_3[4] = { 0xCE, 0xB1, 0xCF, 0x86 }; +static const symbol s_6_4[18] = { 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB1, 0xCF, 0x86 }; +static const symbol s_6_5[12] = { 0xCE, 0xBE, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_6[6] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_7[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_8[12] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_9[8] = { 0xCE, 0xB5, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_10[14] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_6_11[12] = { 0xCE, 0xB5, 0xCE, 0xBE, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x87, 0xCE, 0xB1 }; +static const symbol s_6_12[4] = { 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_6_13[6] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_6_14[12] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_6_15[6] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_6_16[4] = { 0xCE, 0xB3, 0xCE, 0xB5 }; +static const symbol s_6_17[6] = { 0xCE, 0xB3, 0xCE, 0xBA, 0xCE, 0xB5 }; +static const symbol s_6_18[6] = { 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_6_19[12] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x89, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_6_20[8] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_6_21[12] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_6_22[12] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_6_23[8] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_6_24[4] = { 0xCE, 0xB3, 0xCE, 0xBA }; +static const symbol s_6_25[2] = { 0xCE, 0xBC }; +static const symbol s_6_26[12] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_6_27[6] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xBC }; +static const symbol s_6_28[4] = { 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_6_29[8] = { 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const symbol s_6_30[14] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const symbol s_6_31[6] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF }; +static const struct among a_6[32] = { +{ 2, s_6_0, 0, 2, 0}, +{ 6, s_6_1, 0, 2, 0}, +{ 16, s_6_2, 0, 2, 0}, +{ 4, s_6_3, 0, 2, 0}, +{ 18, s_6_4, -1, 2, 0}, +{ 12, s_6_5, 0, 1, 0}, +{ 6, s_6_6, 0, 1, 0}, +{ 12, s_6_7, 0, 1, 0}, +{ 12, s_6_8, 0, 1, 0}, +{ 8, s_6_9, 0, 1, 0}, +{ 14, s_6_10, 0, 1, 0}, +{ 12, s_6_11, 0, 1, 0}, +{ 4, s_6_12, 0, 1, 0}, +{ 6, s_6_13, -1, 1, 0}, +{ 12, s_6_14, -1, 1, 0}, +{ 6, s_6_15, 0, 1, 0}, +{ 4, s_6_16, 0, 2, 0}, +{ 6, s_6_17, 0, 2, 0}, +{ 6, s_6_18, 0, 1, 0}, +{ 12, s_6_19, -1, 1, 0}, +{ 8, s_6_20, -2, 1, 0}, +{ 12, s_6_21, -1, 1, 0}, +{ 12, s_6_22, -4, 1, 0}, +{ 8, s_6_23, 0, 1, 0}, +{ 4, s_6_24, 0, 2, 0}, +{ 2, s_6_25, 0, 2, 0}, +{ 12, s_6_26, -1, 2, 0}, +{ 6, s_6_27, -2, 2, 0}, +{ 4, s_6_28, 0, 2, 0}, +{ 8, s_6_29, 0, 1, 0}, +{ 14, s_6_30, -1, 1, 0}, +{ 6, s_6_31, 0, 2, 0} +}; + +static const symbol s_7_0[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_7_1[6] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_7_2[6] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_7_3[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_7_4[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_7_5[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_7_6[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD }; +static const struct among a_7[7] = { +{ 8, s_7_0, 0, 1, 0}, +{ 6, s_7_1, 0, 1, 0}, +{ 6, s_7_2, 0, 1, 0}, +{ 10, s_7_3, 0, 1, 0}, +{ 10, s_7_4, 0, 1, 0}, +{ 10, s_7_5, 0, 1, 0}, +{ 8, s_7_6, 0, 1, 0} +}; + +static const symbol s_8_0[12] = { 0xCE, 0xBE, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_1[6] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_2[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_3[12] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_4[8] = { 0xCE, 0xB5, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_5[14] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xB1 }; +static const symbol s_8_6[12] = { 0xCE, 0xB5, 0xCE, 0xBE, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x87, 0xCE, 0xB1 }; +static const symbol s_8_7[4] = { 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_8_8[6] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_8_9[12] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB5 }; +static const symbol s_8_10[6] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_8_11[6] = { 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_8_12[12] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x89, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_8_13[8] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_8_14[12] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_8_15[12] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_8_16[8] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_8_17[8] = { 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const symbol s_8_18[14] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const struct among a_8[19] = { +{ 12, s_8_0, 0, 1, 0}, +{ 6, s_8_1, 0, 1, 0}, +{ 12, s_8_2, 0, 1, 0}, +{ 12, s_8_3, 0, 1, 0}, +{ 8, s_8_4, 0, 1, 0}, +{ 14, s_8_5, 0, 1, 0}, +{ 12, s_8_6, 0, 1, 0}, +{ 4, s_8_7, 0, 1, 0}, +{ 6, s_8_8, -1, 1, 0}, +{ 12, s_8_9, -1, 1, 0}, +{ 6, s_8_10, 0, 1, 0}, +{ 6, s_8_11, 0, 1, 0}, +{ 12, s_8_12, -1, 1, 0}, +{ 8, s_8_13, -2, 1, 0}, +{ 12, s_8_14, -1, 1, 0}, +{ 12, s_8_15, -4, 1, 0}, +{ 8, s_8_16, 0, 1, 0}, +{ 8, s_8_17, 0, 1, 0}, +{ 14, s_8_18, -1, 1, 0} +}; + +static const symbol s_9_0[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_9_1[6] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x89 }; +static const symbol s_9_2[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_9_3[12] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_9_4[12] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_9_5[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_9_6[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const struct among a_9[7] = { +{ 10, s_9_0, 0, 1, 0}, +{ 6, s_9_1, 0, 1, 0}, +{ 10, s_9_2, 0, 1, 0}, +{ 12, s_9_3, 0, 1, 0}, +{ 12, s_9_4, 0, 1, 0}, +{ 8, s_9_5, 0, 1, 0}, +{ 10, s_9_6, 0, 1, 0} +}; + +static const symbol s_10_0[2] = { 0xCF, 0x80 }; +static const symbol s_10_1[6] = { 0xCE, 0xB5, 0xCF, 0x85, 0xCF, 0x80 }; +static const symbol s_10_2[4] = { 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_10_3[6] = { 0xCE, 0xB5, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_10_4[6] = { 0xCE, 0xB3, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_10_5[4] = { 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_10_6[6] = { 0xCF, 0x87, 0xCF, 0x89, 0xCF, 0x81 }; +static const symbol s_10_7[4] = { 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_10_8[6] = { 0xCE, 0xB1, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_10_9[4] = { 0xCF, 0x87, 0xCF, 0x84 }; +static const symbol s_10_10[6] = { 0xCE, 0xB1, 0xCF, 0x87, 0xCF, 0x84 }; +static const symbol s_10_11[4] = { 0xCE, 0xBA, 0xCF, 0x84 }; +static const symbol s_10_12[6] = { 0xCE, 0xB1, 0xCE, 0xBA, 0xCF, 0x84 }; +static const symbol s_10_13[4] = { 0xCF, 0x83, 0xCF, 0x87 }; +static const symbol s_10_14[6] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x87 }; +static const symbol s_10_15[6] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x87 }; +static const symbol s_10_16[4] = { 0xCF, 0x85, 0xCF, 0x88 }; +static const symbol s_10_17[6] = { 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_10_18[4] = { 0xCF, 0x86, 0xCE, 0xB1 }; +static const symbol s_10_19[6] = { 0xCE, 0xB7, 0xCF, 0x86, 0xCE, 0xB1 }; +static const symbol s_10_20[6] = { 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xB3 }; +static const symbol s_10_21[6] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xB3 }; +static const symbol s_10_22[4] = { 0xCE, 0xB7, 0xCE, 0xB4 }; +static const symbol s_10_23[4] = { 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_10_24[6] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_10_25[6] = { 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_10_26[6] = { 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_10_27[12] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x89, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_10_28[8] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_10_29[6] = { 0xCE, 0xB5, 0xCF, 0x87, 0xCE, 0xB8 }; +static const symbol s_10_30[6] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_10_31[4] = { 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_10_32[6] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_10_33[6] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_10_34[6] = { 0xCE, 0xBA, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_10_35[6] = { 0xCF, 0x86, 0xCE, 0xB9, 0xCE, 0xBB }; +static const symbol s_10_36[2] = { 0xCE, 0xBC }; +static const symbol s_10_37[6] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xBC }; +static const symbol s_10_38[6] = { 0xCE, 0xB1, 0xCF, 0x87, 0xCE, 0xBD }; +static const symbol s_10_39[14] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x81, 0xCE, 0xBF }; +static const struct among a_10[40] = { +{ 2, s_10_0, 0, 2, 0}, +{ 6, s_10_1, -1, 2, 0}, +{ 4, s_10_2, -2, 2, 0}, +{ 6, s_10_3, -3, 2, 0}, +{ 6, s_10_4, 0, 2, 0}, +{ 4, s_10_5, 0, 2, 0}, +{ 6, s_10_6, 0, 2, 0}, +{ 4, s_10_7, 0, 2, 0}, +{ 6, s_10_8, 0, 2, 0}, +{ 4, s_10_9, 0, 2, 0}, +{ 6, s_10_10, -1, 2, 0}, +{ 4, s_10_11, 0, 2, 0}, +{ 6, s_10_12, -1, 2, 0}, +{ 4, s_10_13, 0, 2, 0}, +{ 6, s_10_14, -1, 2, 0}, +{ 6, s_10_15, 0, 2, 0}, +{ 4, s_10_16, 0, 2, 0}, +{ 6, s_10_17, 0, 2, 0}, +{ 4, s_10_18, 0, 2, 0}, +{ 6, s_10_19, -1, 2, 0}, +{ 6, s_10_20, 0, 2, 0}, +{ 6, s_10_21, 0, 2, 0}, +{ 4, s_10_22, 0, 2, 0}, +{ 4, s_10_23, 0, 1, 0}, +{ 6, s_10_24, -1, 1, 0}, +{ 6, s_10_25, 0, 1, 0}, +{ 6, s_10_26, 0, 1, 0}, +{ 12, s_10_27, -1, 1, 0}, +{ 8, s_10_28, 0, 1, 0}, +{ 6, s_10_29, 0, 2, 0}, +{ 6, s_10_30, 0, 2, 0}, +{ 4, s_10_31, 0, 2, 0}, +{ 6, s_10_32, 0, 2, 0}, +{ 6, s_10_33, 0, 2, 0}, +{ 6, s_10_34, 0, 2, 0}, +{ 6, s_10_35, 0, 2, 0}, +{ 2, s_10_36, 0, 2, 0}, +{ 6, s_10_37, -1, 2, 0}, +{ 6, s_10_38, 0, 2, 0}, +{ 14, s_10_39, 0, 1, 0} +}; + +static const symbol s_11_0[12] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_11_1[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_11_2[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB7, 0xCF, 0x83 }; +static const symbol s_11_3[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_11_4[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_11_5[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_11_6[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_11_7[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB7 }; +static const symbol s_11_8[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB9 }; +static const symbol s_11_9[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_11_10[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xBF }; +static const struct among a_11[11] = { +{ 12, s_11_0, 0, 1, 0}, +{ 10, s_11_1, 0, 1, 0}, +{ 10, s_11_2, 0, 1, 0}, +{ 10, s_11_3, 0, 1, 0}, +{ 10, s_11_4, 0, 1, 0}, +{ 8, s_11_5, 0, 1, 0}, +{ 8, s_11_6, 0, 1, 0}, +{ 8, s_11_7, 0, 1, 0}, +{ 10, s_11_8, 0, 1, 0}, +{ 10, s_11_9, 0, 1, 0}, +{ 8, s_11_10, 0, 1, 0} +}; + +static const symbol s_12_0[4] = { 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_12_1[12] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_12_2[14] = { 0xCE, 0xBC, 0xCE, 0xB9, 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB5 }; +static const symbol s_12_3[10] = { 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_12_4[12] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_12_5[8] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_12_6[16] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const struct among a_12[7] = { +{ 4, s_12_0, 0, 1, 0}, +{ 12, s_12_1, -1, 1, 0}, +{ 14, s_12_2, -2, 1, 0}, +{ 10, s_12_3, 0, 1, 0}, +{ 12, s_12_4, 0, 1, 0}, +{ 8, s_12_5, 0, 2, 0}, +{ 16, s_12_6, -1, 2, 0} +}; + +static const symbol s_13_0[10] = { 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_1[14] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB5, 0xCF, 0x80, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_2[14] = { 0xCE, 0xB3, 0xCE, 0xBD, 0xCF, 0x89, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_3[16] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xBD, 0xCF, 0x89, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_4[16] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBA, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_5[12] = { 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_6[10] = { 0xCE, 0xB5, 0xCE, 0xB8, 0xCE, 0xBD, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_13_7[14] = { 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB9, 0xCE, 0xBD }; +static const symbol s_13_8[20] = { 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBE, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB4, 0xCF, 0x81, 0xCE, 0xB9, 0xCE, 0xBD }; +static const symbol s_13_9[16] = { 0xCE, 0xB2, 0xCF, 0x85, 0xCE, 0xB6, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBD }; +static const struct among a_13[10] = { +{ 10, s_13_0, 0, 7, 0}, +{ 14, s_13_1, 0, 6, 0}, +{ 14, s_13_2, 0, 3, 0}, +{ 16, s_13_3, -1, 1, 0}, +{ 16, s_13_4, 0, 5, 0}, +{ 12, s_13_5, 0, 2, 0}, +{ 10, s_13_6, 0, 4, 0}, +{ 14, s_13_7, 0, 10, 0}, +{ 20, s_13_8, 0, 8, 0}, +{ 16, s_13_9, 0, 9, 0} +}; + +static const symbol s_14_0[12] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_14_1[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_14_2[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_14_3[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xBF, 0xCE, 0xB9 }; +static const symbol s_14_4[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_14_5[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xBF }; +static const struct among a_14[6] = { +{ 12, s_14_0, 0, 1, 0}, +{ 10, s_14_1, 0, 1, 0}, +{ 10, s_14_2, 0, 1, 0}, +{ 10, s_14_3, 0, 1, 0}, +{ 10, s_14_4, 0, 1, 0}, +{ 8, s_14_5, 0, 1, 0} +}; + +static const symbol s_15_0[2] = { 0xCF, 0x83 }; +static const symbol s_15_1[2] = { 0xCF, 0x87 }; +static const struct among a_15[2] = { +{ 2, s_15_0, 0, 1, 0}, +{ 2, s_15_1, 0, 1, 0} +}; + +static const symbol s_16_0[12] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_16_1[14] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_16_2[10] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9 }; +static const symbol s_16_3[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9 }; +static const struct among a_16[4] = { +{ 12, s_16_0, 0, 1, 0}, +{ 14, s_16_1, 0, 1, 0}, +{ 10, s_16_2, 0, 1, 0}, +{ 12, s_16_3, 0, 1, 0} +}; + +static const symbol s_17_0[2] = { 0xCF, 0x80 }; +static const symbol s_17_1[12] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_17_2[2] = { 0xCF, 0x81 }; +static const symbol s_17_3[4] = { 0xCE, 0xB2, 0xCF, 0x81 }; +static const symbol s_17_4[8] = { 0xCE, 0xBB, 0xCE, 0xB1, 0xCE, 0xB2, 0xCF, 0x81 }; +static const symbol s_17_5[8] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB2, 0xCF, 0x81 }; +static const symbol s_17_6[10] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_17_7[6] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_17_8[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB8, 0xCF, 0x81 }; +static const symbol s_17_9[6] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_17_10[2] = { 0xCF, 0x83 }; +static const symbol s_17_11[12] = { 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_17_12[6] = { 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_17_13[10] = { 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_17_14[4] = { 0xCF, 0x81, 0xCF, 0x85 }; +static const symbol s_17_15[2] = { 0xCF, 0x86 }; +static const symbol s_17_16[4] = { 0xCF, 0x83, 0xCF, 0x86 }; +static const symbol s_17_17[10] = { 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x86 }; +static const symbol s_17_18[6] = { 0xCE, 0xBD, 0xCF, 0x85, 0xCF, 0x86 }; +static const symbol s_17_19[2] = { 0xCF, 0x87 }; +static const symbol s_17_20[2] = { 0xCE, 0xB2 }; +static const symbol s_17_21[8] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB2 }; +static const symbol s_17_22[8] = { 0xCF, 0x83, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB2 }; +static const symbol s_17_23[18] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x87, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB2 }; +static const symbol s_17_24[8] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB4 }; +static const symbol s_17_25[2] = { 0xCE, 0xB6 }; +static const symbol s_17_26[4] = { 0xCF, 0x84, 0xCE, 0xB6 }; +static const symbol s_17_27[2] = { 0xCE, 0xBA }; +static const symbol s_17_28[4] = { 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_17_29[10] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_17_30[6] = { 0xCF, 0x83, 0xCE, 0xBF, 0xCE, 0xBA }; +static const symbol s_17_31[4] = { 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_17_32[6] = { 0xCF, 0x86, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_17_33[8] = { 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_17_34[6] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_17_35[6] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_17_36[4] = { 0xCE, 0xB3, 0xCE, 0xBB }; +static const symbol s_17_37[12] = { 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB }; +static const symbol s_17_38[8] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBC }; +static const symbol s_17_39[8] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB9, 0xCE, 0xBC }; +static const symbol s_17_40[8] = { 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xBC }; +static const symbol s_17_41[12] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBA, 0xCF, 0x81, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_17_42[8] = { 0xCF, 0x83, 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_17_43[8] = { 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_17_44[14] = { 0xCE, 0xB7, 0xCE, 0xB3, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xBD }; +static const symbol s_17_45[6] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xBD }; +static const struct among a_17[46] = { +{ 2, s_17_0, 0, 2, 0}, +{ 12, s_17_1, -1, 1, 0}, +{ 2, s_17_2, 0, 1, 0}, +{ 4, s_17_3, -1, 1, 0}, +{ 8, s_17_4, -1, 1, 0}, +{ 8, s_17_5, -2, 1, 0}, +{ 10, s_17_6, -4, 2, 0}, +{ 6, s_17_7, -5, 1, 0}, +{ 8, s_17_8, -6, 1, 0}, +{ 6, s_17_9, -7, 1, 0}, +{ 2, s_17_10, 0, 1, 0}, +{ 12, s_17_11, -1, 1, 0}, +{ 6, s_17_12, -2, 2, 0}, +{ 10, s_17_13, 0, 1, 0}, +{ 4, s_17_14, 0, 1, 0}, +{ 2, s_17_15, 0, 1, 0}, +{ 4, s_17_16, -1, 1, 0}, +{ 10, s_17_17, -1, 1, 0}, +{ 6, s_17_18, -3, 2, 0}, +{ 2, s_17_19, 0, 1, 0}, +{ 2, s_17_20, 0, 2, 0}, +{ 8, s_17_21, -1, 1, 0}, +{ 8, s_17_22, -2, 1, 0}, +{ 18, s_17_23, -1, 1, 0}, +{ 8, s_17_24, 0, 2, 0}, +{ 2, s_17_25, 0, 2, 0}, +{ 4, s_17_26, -1, 1, 0}, +{ 2, s_17_27, 0, 1, 0}, +{ 4, s_17_28, -1, 1, 0}, +{ 10, s_17_29, -2, 1, 0}, +{ 6, s_17_30, -3, 1, 0}, +{ 4, s_17_31, 0, 1, 0}, +{ 6, s_17_32, 0, 1, 0}, +{ 8, s_17_33, 0, 1, 0}, +{ 6, s_17_34, 0, 2, 0}, +{ 6, s_17_35, 0, 1, 0}, +{ 4, s_17_36, 0, 2, 0}, +{ 12, s_17_37, 0, 2, 0}, +{ 8, s_17_38, 0, 1, 0}, +{ 8, s_17_39, 0, 1, 0}, +{ 8, s_17_40, 0, 1, 0}, +{ 12, s_17_41, 0, 2, 0}, +{ 8, s_17_42, 0, 1, 0}, +{ 8, s_17_43, 0, 2, 0}, +{ 14, s_17_44, 0, 2, 0}, +{ 6, s_17_45, 0, 1, 0} +}; + +static const symbol s_18_0[10] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_18_1[10] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_18_2[8] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_18_3[8] = { 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_18_4[12] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_18_5[6] = { 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9 }; +static const symbol s_18_6[10] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB9 }; +static const symbol s_18_7[10] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_18[8] = { +{ 10, s_18_0, 0, 1, 0}, +{ 10, s_18_1, 0, 1, 0}, +{ 8, s_18_2, 0, 1, 0}, +{ 8, s_18_3, 0, 1, 0}, +{ 12, s_18_4, -1, 1, 0}, +{ 6, s_18_5, 0, 1, 0}, +{ 10, s_18_6, -1, 1, 0}, +{ 10, s_18_7, 0, 1, 0} +}; + +static const symbol s_19_0[4] = { 0xCE, 0xB9, 0xCF, 0x81 }; +static const symbol s_19_1[6] = { 0xCF, 0x88, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_19_2[8] = { 0xCE, 0xB1, 0xCE, 0xB9, 0xCF, 0x86, 0xCE, 0xBD }; +static const symbol s_19_3[6] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF }; +static const struct among a_19[4] = { +{ 4, s_19_0, 0, 1, 0}, +{ 6, s_19_1, 0, 1, 0}, +{ 8, s_19_2, 0, 1, 0}, +{ 6, s_19_3, 0, 1, 0} +}; + +static const symbol s_20_0[2] = { 0xCE, 0xB5 }; +static const symbol s_20_1[10] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xB9, 0xCF, 0x87, 0xCE, 0xBD }; +static const struct among a_20[2] = { +{ 2, s_20_0, 0, 1, 0}, +{ 10, s_20_1, 0, 1, 0} +}; + +static const symbol s_21_0[8] = { 0xCE, 0xB9, 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_21_1[10] = { 0xCE, 0xB9, 0xCE, 0xB4, 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_21_2[8] = { 0xCE, 0xB9, 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xBF }; +static const struct among a_21[3] = { +{ 8, s_21_0, 0, 1, 0}, +{ 10, s_21_1, 0, 1, 0}, +{ 8, s_21_2, 0, 1, 0} +}; + +static const symbol s_22_0[2] = { 0xCF, 0x81 }; +static const symbol s_22_1[4] = { 0xCE, 0xB9, 0xCE, 0xB2 }; +static const symbol s_22_2[2] = { 0xCE, 0xB4 }; +static const symbol s_22_3[6] = { 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xBA }; +static const symbol s_22_4[10] = { 0xCF, 0x86, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xBA }; +static const symbol s_22_5[8] = { 0xCE, 0xBF, 0xCE, 0xB2, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_22_6[6] = { 0xCE, 0xBC, 0xCE, 0xB7, 0xCE, 0xBD }; +static const struct among a_22[7] = { +{ 2, s_22_0, 0, 1, 0}, +{ 4, s_22_1, 0, 1, 0}, +{ 2, s_22_2, 0, 1, 0}, +{ 6, s_22_3, 0, 1, 0}, +{ 10, s_22_4, 0, 1, 0}, +{ 8, s_22_5, 0, 1, 0}, +{ 6, s_22_6, 0, 1, 0} +}; + +static const symbol s_23_0[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_23_1[10] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_23_2[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB5 }; +static const symbol s_23_3[8] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xBF }; +static const struct among a_23[4] = { +{ 10, s_23_0, 0, 1, 0}, +{ 10, s_23_1, 0, 1, 0}, +{ 8, s_23_2, 0, 1, 0}, +{ 8, s_23_3, 0, 1, 0} +}; + +static const symbol s_24_0[8] = { 0xCE, 0xB1, 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_24_1[8] = { 0xCE, 0xB1, 0xCE, 0xB4, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_24[2] = { +{ 8, s_24_0, 0, 1, 0}, +{ 8, s_24_1, 0, 1, 0} +}; + +static const symbol s_25_0[10] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_25_1[6] = { 0xCE, 0xBA, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_25_2[10] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_25_3[10] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_25_4[10] = { 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_25_5[10] = { 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9 }; +static const symbol s_25_6[6] = { 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_25_7[4] = { 0xCE, 0xBF, 0xCE, 0xBA }; +static const symbol s_25_8[6] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_25_9[6] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBD }; +static const struct among a_25[10] = { +{ 10, s_25_0, 0, -1, 0}, +{ 6, s_25_1, 0, -1, 0}, +{ 10, s_25_2, 0, -1, 0}, +{ 10, s_25_3, 0, -1, 0}, +{ 10, s_25_4, 0, -1, 0}, +{ 10, s_25_5, 0, -1, 0}, +{ 6, s_25_6, 0, -1, 0}, +{ 4, s_25_7, 0, -1, 0}, +{ 6, s_25_8, 0, -1, 0}, +{ 6, s_25_9, 0, -1, 0} +}; + +static const symbol s_26_0[8] = { 0xCE, 0xB5, 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_26_1[8] = { 0xCE, 0xB5, 0xCE, 0xB4, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_26[2] = { +{ 8, s_26_0, 0, 1, 0}, +{ 8, s_26_1, 0, 1, 0} +}; + +static const symbol s_27_0[10] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x80 }; +static const symbol s_27_1[4] = { 0xCF, 0x85, 0xCF, 0x80 }; +static const symbol s_27_2[6] = { 0xCE, 0xB4, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_27_3[6] = { 0xCE, 0xB3, 0xCE, 0xB7, 0xCF, 0x80 }; +static const symbol s_27_4[4] = { 0xCE, 0xB9, 0xCF, 0x80 }; +static const symbol s_27_5[6] = { 0xCE, 0xB5, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_27_6[4] = { 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_27_7[6] = { 0xCE, 0xBC, 0xCE, 0xB9, 0xCE, 0xBB }; +static const struct among a_27[8] = { +{ 10, s_27_0, 0, 1, 0}, +{ 4, s_27_1, 0, 1, 0}, +{ 6, s_27_2, 0, 1, 0}, +{ 6, s_27_3, 0, 1, 0}, +{ 4, s_27_4, 0, 1, 0}, +{ 6, s_27_5, 0, 1, 0}, +{ 4, s_27_6, 0, 1, 0}, +{ 6, s_27_7, 0, 1, 0} +}; + +static const symbol s_28_0[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_28_1[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB4, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_28[2] = { +{ 10, s_28_0, 0, 1, 0}, +{ 10, s_28_1, 0, 1, 0} +}; + +static const symbol s_29_0[4] = { 0xCF, 0x83, 0xCF, 0x80 }; +static const symbol s_29_1[4] = { 0xCF, 0x86, 0xCF, 0x81 }; +static const symbol s_29_2[2] = { 0xCF, 0x83 }; +static const symbol s_29_3[6] = { 0xCE, 0xBB, 0xCE, 0xB9, 0xCF, 0x87 }; +static const symbol s_29_4[8] = { 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_29_5[4] = { 0xCF, 0x86, 0xCE, 0xB5 }; +static const symbol s_29_6[6] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBA }; +static const symbol s_29_7[4] = { 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_29_8[12] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_29_9[8] = { 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_29_10[4] = { 0xCF, 0x86, 0xCE, 0xBB }; +static const symbol s_29_11[10] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_29_12[6] = { 0xCE, 0xB2, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_29_13[4] = { 0xCF, 0x87, 0xCE, 0xBD }; +static const symbol s_29_14[8] = { 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBE }; +static const struct among a_29[15] = { +{ 4, s_29_0, 0, 1, 0}, +{ 4, s_29_1, 0, 1, 0}, +{ 2, s_29_2, 0, 1, 0}, +{ 6, s_29_3, 0, 1, 0}, +{ 8, s_29_4, 0, 1, 0}, +{ 4, s_29_5, 0, 1, 0}, +{ 6, s_29_6, 0, 1, 0}, +{ 4, s_29_7, 0, 1, 0}, +{ 12, s_29_8, 0, 1, 0}, +{ 8, s_29_9, 0, 1, 0}, +{ 4, s_29_10, 0, 1, 0}, +{ 10, s_29_11, 0, 1, 0}, +{ 6, s_29_12, 0, 1, 0}, +{ 4, s_29_13, 0, 1, 0}, +{ 8, s_29_14, 0, 1, 0} +}; + +static const symbol s_30_0[6] = { 0xCE, 0xB5, 0xCF, 0x89, 0xCF, 0x83 }; +static const symbol s_30_1[6] = { 0xCE, 0xB5, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_30[2] = { +{ 6, s_30_0, 0, 1, 0}, +{ 6, s_30_1, 0, 1, 0} +}; + +static const symbol s_31_0[2] = { 0xCF, 0x80 }; +static const symbol s_31_1[6] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_31_2[2] = { 0xCE, 0xB4 }; +static const symbol s_31_3[4] = { 0xCE, 0xB9, 0xCE, 0xB4 }; +static const symbol s_31_4[2] = { 0xCE, 0xB8 }; +static const symbol s_31_5[6] = { 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_31_6[4] = { 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_31_7[2] = { 0xCE, 0xBD }; +static const struct among a_31[8] = { +{ 2, s_31_0, 0, 1, 0}, +{ 6, s_31_1, 0, 1, 0}, +{ 2, s_31_2, 0, 1, 0}, +{ 4, s_31_3, -1, 1, 0}, +{ 2, s_31_4, 0, 1, 0}, +{ 6, s_31_5, 0, 1, 0}, +{ 4, s_31_6, 0, 1, 0}, +{ 2, s_31_7, 0, 1, 0} +}; + +static const symbol s_32_0[6] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_32_1[4] = { 0xCE, 0xB9, 0xCE, 0xB1 }; +static const symbol s_32_2[6] = { 0xCE, 0xB9, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_32[3] = { +{ 6, s_32_0, 0, 1, 0}, +{ 4, s_32_1, 0, 1, 0}, +{ 6, s_32_2, 0, 1, 0} +}; + +static const symbol s_33_0[8] = { 0xCE, 0xB9, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_33_1[6] = { 0xCE, 0xB9, 0xCE, 0xBA, 0xCE, 0xB1 }; +static const symbol s_33_2[8] = { 0xCE, 0xB9, 0xCE, 0xBA, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_33_3[6] = { 0xCE, 0xB9, 0xCE, 0xBA, 0xCE, 0xBF }; +static const struct among a_33[4] = { +{ 8, s_33_0, 0, 1, 0}, +{ 6, s_33_1, 0, 1, 0}, +{ 8, s_33_2, 0, 1, 0}, +{ 6, s_33_3, 0, 1, 0} +}; + +static const symbol s_34_0[8] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB, 0xCF, 0x80 }; +static const symbol s_34_1[6] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_34_2[12] = { 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_34_3[8] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_34_4[8] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_34_5[6] = { 0xCF, 0x86, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_34_6[6] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_34_7[8] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_34_8[8] = { 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x81, 0xCF, 0x84 }; +static const symbol s_34_9[14] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_34_10[6] = { 0xCE, 0xBD, 0xCE, 0xB9, 0xCF, 0x84 }; +static const symbol s_34_11[12] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_34_12[8] = { 0xCE, 0xB5, 0xCE, 0xBE, 0xCF, 0x89, 0xCE, 0xB4 }; +static const symbol s_34_13[4] = { 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_34_14[10] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_34_15[10] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_34_16[10] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xB4 }; +static const symbol s_34_17[6] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xB4 }; +static const symbol s_34_18[8] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xB4 }; +static const symbol s_34_19[12] = { 0xCF, 0x80, 0xCF, 0x81, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xB4 }; +static const symbol s_34_20[10] = { 0xCF, 0x86, 0xCF, 0x85, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB4 }; +static const symbol s_34_21[4] = { 0xCE, 0xB7, 0xCE, 0xB8 }; +static const symbol s_34_22[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB7, 0xCE, 0xB8 }; +static const symbol s_34_23[6] = { 0xCE, 0xBE, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_34_24[8] = { 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_34_25[4] = { 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_34_26[14] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x87, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_34_27[14] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB7, 0xCE, 0xBB }; +static const symbol s_34_28[8] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB }; +static const symbol s_34_29[8] = { 0xCE, 0xB2, 0xCF, 0x81, 0xCF, 0x89, 0xCE, 0xBC }; +static const symbol s_34_30[8] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_34_31[8] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_34_32[8] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_34_33[12] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xBD }; +static const symbol s_34_34[14] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCE, 0xBB, 0xCE, 0xBD }; +static const symbol s_34_35[10] = { 0xCF, 0x86, 0xCE, 0xB9, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xBD }; +static const struct among a_34[36] = { +{ 8, s_34_0, 0, 1, 0}, +{ 6, s_34_1, 0, 1, 0}, +{ 12, s_34_2, 0, 1, 0}, +{ 8, s_34_3, 0, 1, 0}, +{ 8, s_34_4, 0, 1, 0}, +{ 6, s_34_5, 0, 1, 0}, +{ 6, s_34_6, 0, 1, 0}, +{ 8, s_34_7, 0, 1, 0}, +{ 8, s_34_8, 0, 1, 0}, +{ 14, s_34_9, 0, 1, 0}, +{ 6, s_34_10, 0, 1, 0}, +{ 12, s_34_11, 0, 1, 0}, +{ 8, s_34_12, 0, 1, 0}, +{ 4, s_34_13, 0, 1, 0}, +{ 10, s_34_14, -1, 1, 0}, +{ 10, s_34_15, -2, 1, 0}, +{ 10, s_34_16, 0, 1, 0}, +{ 6, s_34_17, 0, 1, 0}, +{ 8, s_34_18, 0, 1, 0}, +{ 12, s_34_19, 0, 1, 0}, +{ 10, s_34_20, 0, 1, 0}, +{ 4, s_34_21, 0, 1, 0}, +{ 8, s_34_22, -1, 1, 0}, +{ 6, s_34_23, 0, 1, 0}, +{ 8, s_34_24, 0, 1, 0}, +{ 4, s_34_25, 0, 1, 0}, +{ 14, s_34_26, -1, 1, 0}, +{ 14, s_34_27, 0, 1, 0}, +{ 8, s_34_28, 0, 1, 0}, +{ 8, s_34_29, 0, 1, 0}, +{ 8, s_34_30, 0, 1, 0}, +{ 8, s_34_31, 0, 1, 0}, +{ 8, s_34_32, 0, 1, 0}, +{ 12, s_34_33, 0, 1, 0}, +{ 14, s_34_34, 0, 1, 0}, +{ 10, s_34_35, 0, 1, 0} +}; + +static const symbol s_35_0[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_35_1[10] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_35_2[10] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_35_3[10] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_35_4[14] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const struct among a_35[5] = { +{ 12, s_35_0, 0, 1, 0}, +{ 10, s_35_1, 0, 1, 0}, +{ 10, s_35_2, 0, 1, 0}, +{ 10, s_35_3, 0, 1, 0}, +{ 14, s_35_4, -1, 1, 0} +}; + +static const symbol s_36_0[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_36_1[8] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xBA, 0xCF, 0x81 }; +static const symbol s_36_2[10] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_36_3[6] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x84 }; +static const symbol s_36_4[2] = { 0xCF, 0x87 }; +static const symbol s_36_5[6] = { 0xCF, 0x83, 0xCE, 0xB9, 0xCF, 0x87 }; +static const symbol s_36_6[8] = { 0xCE, 0xB2, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB2 }; +static const symbol s_36_7[6] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xB8 }; +static const symbol s_36_8[6] = { 0xCE, 0xBE, 0xCE, 0xB5, 0xCE, 0xB8 }; +static const symbol s_36_9[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xB8 }; +static const symbol s_36_10[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBA }; +static const symbol s_36_11[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const struct among a_36[12] = { +{ 8, s_36_0, 0, 1, 0}, +{ 8, s_36_1, 0, 1, 0}, +{ 10, s_36_2, 0, 1, 0}, +{ 6, s_36_3, 0, 1, 0}, +{ 2, s_36_4, 0, 1, 0}, +{ 6, s_36_5, -1, 1, 0}, +{ 8, s_36_6, 0, 1, 0}, +{ 6, s_36_7, 0, 1, 0}, +{ 6, s_36_8, 0, 1, 0}, +{ 8, s_36_9, 0, 1, 0}, +{ 8, s_36_10, 0, 1, 0}, +{ 6, s_36_11, 0, 1, 0} +}; + +static const symbol s_37_0[4] = { 0xCF, 0x84, 0xCF, 0x81 }; +static const symbol s_37_1[4] = { 0xCF, 0x84, 0xCF, 0x83 }; +static const struct among a_37[2] = { +{ 4, s_37_0, 0, 1, 0}, +{ 4, s_37_1, 0, 1, 0} +}; + +static const symbol s_38_0[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_1[10] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_2[14] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_3[16] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_4[12] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_5[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_6[10] = { 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_7[12] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_8[10] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_9[10] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_38_10[14] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const struct among a_38[11] = { +{ 12, s_38_0, 0, 1, 0}, +{ 10, s_38_1, 0, 1, 0}, +{ 14, s_38_2, 0, 1, 0}, +{ 16, s_38_3, -1, 1, 0}, +{ 12, s_38_4, 0, 1, 0}, +{ 14, s_38_5, -1, 1, 0}, +{ 10, s_38_6, 0, 1, 0}, +{ 12, s_38_7, -1, 1, 0}, +{ 10, s_38_8, 0, 1, 0}, +{ 10, s_38_9, 0, 1, 0}, +{ 14, s_38_10, -1, 1, 0} +}; + +static const symbol s_39_0[2] = { 0xCF, 0x80 }; +static const symbol s_39_1[4] = { 0xCF, 0x83, 0xCF, 0x80 }; +static const symbol s_39_2[14] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xB4, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_39_3[8] = { 0xCE, 0xB1, 0xCE, 0xB4, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_39_4[18] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB7, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB4, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_39_5[8] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_39_6[6] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_39_7[12] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_39_8[12] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x81 }; +static const symbol s_39_9[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_39_10[4] = { 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_39_11[10] = { 0xCE, 0xB2, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_39_12[6] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_39_13[12] = { 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB8, 0xCE, 0xB7, 0xCF, 0x81 }; +static const symbol s_39_14[12] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_39_15[2] = { 0xCF, 0x83 }; +static const symbol s_39_16[16] = { 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_39_17[6] = { 0xCE, 0xB8, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_39_18[6] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_39_19[10] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_39_20[8] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_39_21[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_39_22[8] = { 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_39_23[14] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBB, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_39_24[6] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x84 }; +static const symbol s_39_25[12] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x84 }; +static const symbol s_39_26[10] = { 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB, 0xCF, 0x84 }; +static const symbol s_39_27[8] = { 0xCE, 0xB6, 0xCF, 0x89, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_39_28[10] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xB9, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_39_29[2] = { 0xCF, 0x86 }; +static const symbol s_39_30[14] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x86 }; +static const symbol s_39_31[14] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xB9, 0xCE, 0xBB, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x86 }; +static const symbol s_39_32[6] = { 0xCE, 0xBF, 0xCF, 0x81, 0xCF, 0x86 }; +static const symbol s_39_33[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x86 }; +static const symbol s_39_34[8] = { 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x86 }; +static const symbol s_39_35[16] = { 0xCF, 0x86, 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x86 }; +static const symbol s_39_36[10] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB7, 0xCF, 0x86 }; +static const symbol s_39_37[12] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB7, 0xCF, 0x86 }; +static const symbol s_39_38[2] = { 0xCF, 0x87 }; +static const symbol s_39_39[14] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_40[8] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_41[12] = { 0xCE, 0xB2, 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_42[22] = { 0xCE, 0xBC, 0xCE, 0xB9, 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xB2, 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_43[22] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB2, 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_44[22] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBD, 0xCE, 0xBF, 0xCE, 0xB2, 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB7, 0xCF, 0x87 }; +static const symbol s_39_45[6] = { 0xCE, 0xBB, 0xCE, 0xB9, 0xCF, 0x87 }; +static const symbol s_39_46[6] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB2 }; +static const symbol s_39_47[8] = { 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB2 }; +static const symbol s_39_48[14] = { 0xCF, 0x88, 0xCE, 0xB7, 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB2 }; +static const symbol s_39_49[6] = { 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB2 }; +static const symbol s_39_50[8] = { 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB2 }; +static const symbol s_39_51[16] = { 0xCE, 0xBE, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB2 }; +static const symbol s_39_52[2] = { 0xCE, 0xB3 }; +static const symbol s_39_53[10] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xB3 }; +static const symbol s_39_54[10] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xB3 }; +static const symbol s_39_55[4] = { 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_39_56[8] = { 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_39_57[8] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_39_58[10] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB9, 0xCE, 0xB3, 0xCE, 0xB3 }; +static const symbol s_39_59[12] = { 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB9, 0xCE, 0xB3, 0xCE, 0xB3 }; +static const symbol s_39_60[10] = { 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB9, 0xCE, 0xB3, 0xCE, 0xB3 }; +static const symbol s_39_61[8] = { 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCE, 0xB3 }; +static const symbol s_39_62[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB7, 0xCE, 0xB3 }; +static const symbol s_39_63[6] = { 0xCF, 0x83, 0xCE, 0xB9, 0xCE, 0xB3 }; +static const symbol s_39_64[14] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB6 }; +static const symbol s_39_65[2] = { 0xCE, 0xB8 }; +static const symbol s_39_66[12] = { 0xCE, 0xBC, 0xCF, 0x89, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xB8 }; +static const symbol s_39_67[6] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xB8 }; +static const symbol s_39_68[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xB8 }; +static const symbol s_39_69[8] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_39_70[12] = { 0xCE, 0xB2, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x87, 0xCF, 0x85, 0xCE, 0xBA }; +static const symbol s_39_71[6] = { 0xCE, 0xB4, 0xCE, 0xB5, 0xCE, 0xBA }; +static const symbol s_39_72[10] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBA }; +static const symbol s_39_73[4] = { 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_39_74[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_39_75[10] = { 0xCE, 0xB2, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB, 0xCE, 0xBA }; +static const symbol s_39_76[4] = { 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_39_77[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_39_78[12] = { 0xCF, 0x88, 0xCF, 0x85, 0xCF, 0x87, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_39_79[10] = { 0xCE, 0xBB, 0xCE, 0xB1, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_39_80[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_39_81[6] = { 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_39_82[14] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCE, 0xB8, 0xCF, 0x85, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_39_83[14] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_39_84[12] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_39_85[12] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_39_86[6] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_39_87[12] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x81, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xBB }; +static const symbol s_39_88[2] = { 0xCE, 0xBC }; +static const symbol s_39_89[14] = { 0xCE, 0xB4, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB4, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC }; +static const symbol s_39_90[10] = { 0xCE, 0xB2, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x87, 0xCE, 0xBC }; +static const symbol s_39_91[16] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xB4, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_39_92[16] = { 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB, 0xCE, 0xBC }; +static const symbol s_39_93[2] = { 0xCE, 0xBD }; +static const symbol s_39_94[16] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD }; +static const struct among a_39[95] = { +{ 2, s_39_0, 0, 1, 0}, +{ 4, s_39_1, -1, 1, 0}, +{ 14, s_39_2, -2, 1, 0}, +{ 8, s_39_3, -3, 1, 0}, +{ 18, s_39_4, -4, 1, 0}, +{ 8, s_39_5, -5, 1, 0}, +{ 6, s_39_6, -6, 1, 0}, +{ 12, s_39_7, -1, 1, 0}, +{ 12, s_39_8, 0, 1, 0}, +{ 6, s_39_9, 0, 1, 0}, +{ 4, s_39_10, 0, 1, 0}, +{ 10, s_39_11, -1, 1, 0}, +{ 6, s_39_12, -2, 1, 0}, +{ 12, s_39_13, 0, 1, 0}, +{ 12, s_39_14, 0, 1, 0}, +{ 2, s_39_15, 0, 1, 0}, +{ 16, s_39_16, -1, 1, 0}, +{ 6, s_39_17, -2, 1, 0}, +{ 6, s_39_18, -3, 1, 0}, +{ 10, s_39_19, -4, 1, 0}, +{ 8, s_39_20, 0, 1, 0}, +{ 8, s_39_21, 0, 1, 0}, +{ 8, s_39_22, 0, 1, 0}, +{ 14, s_39_23, 0, 1, 0}, +{ 6, s_39_24, 0, 1, 0}, +{ 12, s_39_25, 0, 1, 0}, +{ 10, s_39_26, 0, 1, 0}, +{ 8, s_39_27, 0, 1, 0}, +{ 10, s_39_28, 0, 1, 0}, +{ 2, s_39_29, 0, 1, 0}, +{ 14, s_39_30, -1, 1, 0}, +{ 14, s_39_31, -2, 1, 0}, +{ 6, s_39_32, -3, 1, 0}, +{ 8, s_39_33, -4, 1, 0}, +{ 8, s_39_34, -5, 1, 0}, +{ 16, s_39_35, -1, 1, 0}, +{ 10, s_39_36, -7, 1, 0}, +{ 12, s_39_37, -1, 1, 0}, +{ 2, s_39_38, 0, 1, 0}, +{ 14, s_39_39, -1, 1, 0}, +{ 8, s_39_40, -2, 1, 0}, +{ 12, s_39_41, -3, 1, 0}, +{ 22, s_39_42, -1, 1, 0}, +{ 22, s_39_43, -2, 1, 0}, +{ 22, s_39_44, -3, 1, 0}, +{ 6, s_39_45, -7, 1, 0}, +{ 6, s_39_46, 0, 1, 0}, +{ 8, s_39_47, -1, 1, 0}, +{ 14, s_39_48, -2, 1, 0}, +{ 6, s_39_49, 0, 1, 0}, +{ 8, s_39_50, -1, 1, 0}, +{ 16, s_39_51, -1, 1, 0}, +{ 2, s_39_52, 0, 1, 0}, +{ 10, s_39_53, -1, 1, 0}, +{ 10, s_39_54, -2, 1, 0}, +{ 4, s_39_55, -3, 1, 0}, +{ 8, s_39_56, -1, 1, 0}, +{ 8, s_39_57, -2, 1, 0}, +{ 10, s_39_58, -6, 1, 0}, +{ 12, s_39_59, -1, 1, 0}, +{ 10, s_39_60, -8, 1, 0}, +{ 8, s_39_61, -9, 1, 0}, +{ 8, s_39_62, -10, 1, 0}, +{ 6, s_39_63, -11, 1, 0}, +{ 14, s_39_64, 0, 1, 0}, +{ 2, s_39_65, 0, 1, 0}, +{ 12, s_39_66, -1, 1, 0}, +{ 6, s_39_67, -2, 1, 0}, +{ 8, s_39_68, -1, 1, 0}, +{ 8, s_39_69, 0, 1, 0}, +{ 12, s_39_70, 0, 1, 0}, +{ 6, s_39_71, 0, 1, 0}, +{ 10, s_39_72, 0, 1, 0}, +{ 4, s_39_73, 0, 1, 0}, +{ 8, s_39_74, -1, 1, 0}, +{ 10, s_39_75, 0, 1, 0}, +{ 4, s_39_76, 0, 1, 0}, +{ 8, s_39_77, -1, 1, 0}, +{ 12, s_39_78, -2, 1, 0}, +{ 10, s_39_79, -3, 1, 0}, +{ 6, s_39_80, 0, 1, 0}, +{ 6, s_39_81, 0, 1, 0}, +{ 14, s_39_82, -1, 1, 0}, +{ 14, s_39_83, -2, 1, 0}, +{ 12, s_39_84, -3, 1, 0}, +{ 12, s_39_85, 0, 1, 0}, +{ 6, s_39_86, 0, 1, 0}, +{ 12, s_39_87, 0, 1, 0}, +{ 2, s_39_88, 0, 1, 0}, +{ 14, s_39_89, -1, 1, 0}, +{ 10, s_39_90, -2, 1, 0}, +{ 16, s_39_91, -3, 1, 0}, +{ 16, s_39_92, -4, 1, 0}, +{ 2, s_39_93, 0, 1, 0}, +{ 16, s_39_94, -1, 1, 0} +}; + +static const symbol s_40_0[10] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5 }; +static const struct among a_40[1] = { +{ 10, s_40_0, 0, 1, 0} +}; + +static const symbol s_41_0[6] = { 0xCF, 0x80, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_41_1[6] = { 0xCE, 0xB5, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_41_2[6] = { 0xCF, 0x87, 0xCF, 0x89, 0xCF, 0x81 }; +static const symbol s_41_3[6] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_41_4[4] = { 0xCE, 0xB2, 0xCF, 0x81 }; +static const symbol s_41_5[6] = { 0xCE, 0xB1, 0xCE, 0xB9, 0xCF, 0x81 }; +static const symbol s_41_6[6] = { 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_41_7[6] = { 0xCE, 0xBD, 0xCE, 0xB5, 0xCF, 0x84 }; +static const symbol s_41_8[4] = { 0xCF, 0x83, 0xCF, 0x87 }; +static const symbol s_41_9[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB4 }; +static const symbol s_41_10[6] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xB4 }; +static const symbol s_41_11[4] = { 0xCE, 0xBF, 0xCE, 0xB4 }; +static const symbol s_41_12[10] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB8 }; +static const symbol s_41_13[4] = { 0xCF, 0x83, 0xCE, 0xB8 }; +static const symbol s_41_14[6] = { 0xCE, 0xB5, 0xCF, 0x85, 0xCE, 0xB8 }; +static const symbol s_41_15[6] = { 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_41_16[6] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_41_17[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_41_18[6] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_41_19[6] = { 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xB8 }; +static const symbol s_41_20[6] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xB8 }; +static const symbol s_41_21[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB8 }; +static const symbol s_41_22[6] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xB8 }; +static const symbol s_41_23[6] = { 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xB8 }; +static const symbol s_41_24[6] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBA }; +static const symbol s_41_25[8] = { 0xCF, 0x89, 0xCF, 0x86, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_41_26[6] = { 0xCE, 0xB2, 0xCE, 0xBF, 0xCE, 0xBB }; +static const symbol s_41_27[6] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_41_28[6] = { 0xCE, 0xB1, 0xCE, 0xB9, 0xCE, 0xBD }; +static const symbol s_41_29[6] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBD }; +static const symbol s_41_30[6] = { 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xBD }; +static const struct among a_41[31] = { +{ 6, s_41_0, 0, 1, 0}, +{ 6, s_41_1, 0, 1, 0}, +{ 6, s_41_2, 0, 1, 0}, +{ 6, s_41_3, 0, 1, 0}, +{ 4, s_41_4, 0, 1, 0}, +{ 6, s_41_5, 0, 1, 0}, +{ 6, s_41_6, 0, 1, 0}, +{ 6, s_41_7, 0, 1, 0}, +{ 4, s_41_8, 0, 1, 0}, +{ 8, s_41_9, 0, 1, 0}, +{ 6, s_41_10, 0, 1, 0}, +{ 4, s_41_11, 0, 1, 0}, +{ 10, s_41_12, 0, 1, 0}, +{ 4, s_41_13, 0, 1, 0}, +{ 6, s_41_14, 0, 1, 0}, +{ 6, s_41_15, 0, 1, 0}, +{ 6, s_41_16, 0, 1, 0}, +{ 8, s_41_17, 0, 1, 0}, +{ 6, s_41_18, 0, 1, 0}, +{ 6, s_41_19, 0, 1, 0}, +{ 6, s_41_20, 0, 1, 0}, +{ 8, s_41_21, 0, 1, 0}, +{ 6, s_41_22, 0, 1, 0}, +{ 6, s_41_23, 0, 1, 0}, +{ 6, s_41_24, 0, 1, 0}, +{ 8, s_41_25, 0, 1, 0}, +{ 6, s_41_26, 0, 1, 0}, +{ 6, s_41_27, 0, 1, 0}, +{ 6, s_41_28, 0, 1, 0}, +{ 6, s_41_29, 0, 1, 0}, +{ 6, s_41_30, 0, 1, 0} +}; + +static const symbol s_42_0[8] = { 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x81, 0xCF, 0x80 }; +static const symbol s_42_1[6] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_42_2[8] = { 0xCE, 0xB8, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x81 }; +static const symbol s_42_3[6] = { 0xCE, 0xBD, 0xCF, 0x84, 0xCF, 0x81 }; +static const symbol s_42_4[8] = { 0xCE, 0xB1, 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_42_5[8] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_42_6[6] = { 0xCE, 0xB1, 0xCE, 0xB2, 0xCF, 0x81 }; +static const symbol s_42_7[8] = { 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_42_8[2] = { 0xCF, 0x85 }; +static const symbol s_42_9[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCF, 0x81, 0xCF, 0x86 }; +static const symbol s_42_10[6] = { 0xCE, 0xBD, 0xCE, 0xB9, 0xCF, 0x86 }; +static const symbol s_42_11[6] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_42_12[2] = { 0xCE, 0xB4 }; +static const symbol s_42_13[4] = { 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_42_14[2] = { 0xCE, 0xB8 }; +static const symbol s_42_15[4] = { 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_42_16[4] = { 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_42_17[6] = { 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xBA }; +static const symbol s_42_18[6] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_42_19[14] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_42_20[8] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_42_21[4] = { 0xCE, 0xB5, 0xCE, 0xBC }; +static const symbol s_42_22[4] = { 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_42_23[6] = { 0xCE, 0xB2, 0xCE, 0xB5, 0xCE, 0xBD }; +static const symbol s_42_24[10] = { 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xBD }; +static const struct among a_42[25] = { +{ 8, s_42_0, 0, 1, 0}, +{ 6, s_42_1, 0, 1, 0}, +{ 8, s_42_2, 0, 1, 0}, +{ 6, s_42_3, 0, 1, 0}, +{ 8, s_42_4, 0, 1, 0}, +{ 8, s_42_5, 0, 1, 0}, +{ 6, s_42_6, 0, 1, 0}, +{ 8, s_42_7, 0, 1, 0}, +{ 2, s_42_8, 0, 1, 0}, +{ 8, s_42_9, 0, 1, 0}, +{ 6, s_42_10, 0, 1, 0}, +{ 6, s_42_11, 0, 1, 0}, +{ 2, s_42_12, 0, 1, 0}, +{ 4, s_42_13, -1, 1, 0}, +{ 2, s_42_14, 0, 1, 0}, +{ 4, s_42_15, -1, 1, 0}, +{ 4, s_42_16, 0, 1, 0}, +{ 6, s_42_17, 0, 1, 0}, +{ 6, s_42_18, 0, 1, 0}, +{ 14, s_42_19, 0, 1, 0}, +{ 8, s_42_20, 0, 1, 0}, +{ 4, s_42_21, 0, 1, 0}, +{ 4, s_42_22, 0, 1, 0}, +{ 6, s_42_23, 0, 1, 0}, +{ 10, s_42_24, 0, 1, 0} +}; + +static const symbol s_43_0[10] = { 0xCF, 0x89, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_43_1[10] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x83 }; +static const struct among a_43[2] = { +{ 10, s_43_0, 0, 1, 0}, +{ 10, s_43_1, 0, 1, 0} +}; + +static const symbol s_44_0[12] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_44_1[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const struct among a_44[2] = { +{ 12, s_44_0, 0, 1, 0}, +{ 14, s_44_1, -1, 1, 0} +}; + +static const symbol s_45_0[2] = { 0xCF, 0x80 }; +static const symbol s_45_1[4] = { 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_45_2[12] = { 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x80 }; +static const symbol s_45_3[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_45_4[10] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_45_5[14] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x86 }; +static const struct among a_45[6] = { +{ 2, s_45_0, 0, 1, 0}, +{ 4, s_45_1, -1, 1, 0}, +{ 12, s_45_2, -1, 1, 0}, +{ 8, s_45_3, -3, 1, 0}, +{ 10, s_45_4, -1, 1, 0}, +{ 14, s_45_5, 0, 1, 0} +}; + +static const symbol s_46_0[4] = { 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_46_1[6] = { 0xCE, 0xBD, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_46_2[2] = { 0xCE, 0xB6 }; +static const symbol s_46_3[4] = { 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_46_4[14] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_46_5[10] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCF, 0x84, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_46_6[2] = { 0xCE, 0xBC }; +static const symbol s_46_7[2] = { 0xCE, 0xBE }; +static const symbol s_46_8[6] = { 0xCF, 0x80, 0xCF, 0x81, 0xCE, 0xBF }; +static const struct among a_46[9] = { +{ 4, s_46_0, 0, 1, 0}, +{ 6, s_46_1, 0, 1, 0}, +{ 2, s_46_2, 0, 1, 0}, +{ 4, s_46_3, 0, 1, 0}, +{ 14, s_46_4, -1, 1, 0}, +{ 10, s_46_5, 0, 1, 0}, +{ 2, s_46_6, 0, 1, 0}, +{ 2, s_46_7, 0, 1, 0}, +{ 6, s_46_8, 0, 1, 0} +}; + +static const symbol s_47_0[12] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_47_1[10] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1 }; +static const symbol s_47_2[10] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5 }; +static const struct among a_47[3] = { +{ 12, s_47_0, 0, 1, 0}, +{ 10, s_47_1, 0, 1, 0}, +{ 10, s_47_2, 0, 1, 0} +}; + +static const symbol s_48_0[4] = { 0xCF, 0x83, 0xCF, 0x86 }; +static const symbol s_48_1[8] = { 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB8 }; +static const symbol s_48_2[6] = { 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xB8 }; +static const symbol s_48_3[4] = { 0xCE, 0xBF, 0xCE, 0xB8 }; +static const symbol s_48_4[10] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB }; +static const symbol s_48_5[8] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCF, 0x89, 0xCE, 0xBB }; +static const struct among a_48[6] = { +{ 4, s_48_0, 0, 1, 0}, +{ 8, s_48_1, 0, 1, 0}, +{ 6, s_48_2, 0, 1, 0}, +{ 4, s_48_3, 0, 1, 0}, +{ 10, s_48_4, 0, 1, 0}, +{ 8, s_48_5, 0, 1, 0} +}; + +static const symbol s_49_0[2] = { 0xCE, 0xB8 }; +static const symbol s_49_1[10] = { 0xCF, 0x80, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB8 }; +static const symbol s_49_2[18] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_49_3[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCE, 0xB8 }; +static const symbol s_49_4[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB8 }; +static const struct among a_49[5] = { +{ 2, s_49_0, 0, 1, 0}, +{ 10, s_49_1, -1, 1, 0}, +{ 18, s_49_2, -2, 1, 0}, +{ 8, s_49_3, -3, 1, 0}, +{ 8, s_49_4, -4, 1, 0} +}; + +static const symbol s_50_0[8] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_50_1[6] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1 }; +static const symbol s_50_2[6] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB5 }; +static const struct among a_50[3] = { +{ 8, s_50_0, 0, 1, 0}, +{ 6, s_50_1, 0, 1, 0}, +{ 6, s_50_2, 0, 1, 0} +}; + +static const symbol s_51_0[8] = { 0xCE, 0xB2, 0xCE, 0xBB, 0xCE, 0xB5, 0xCF, 0x80 }; +static const symbol s_51_1[10] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xB4, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_51_2[8] = { 0xCF, 0x80, 0xCF, 0x81, 0xCF, 0x89, 0xCF, 0x84 }; +static const symbol s_51_3[10] = { 0xCE, 0xBA, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_51_4[12] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x87 }; +static const symbol s_51_5[6] = { 0xCE, 0xBB, 0xCE, 0xB1, 0xCF, 0x87 }; +static const symbol s_51_6[6] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_51_7[6] = { 0xCE, 0xBB, 0xCE, 0xB7, 0xCE, 0xB3 }; +static const symbol s_51_8[8] = { 0xCF, 0x86, 0xCF, 0x81, 0xCF, 0x85, 0xCE, 0xB4 }; +static const symbol s_51_9[12] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB9, 0xCE, 0xBB }; +static const symbol s_51_10[8] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBB }; +static const symbol s_51_11[4] = { 0xCE, 0xBF, 0xCE, 0xBC }; +static const struct among a_51[12] = { +{ 8, s_51_0, 0, 1, 0}, +{ 10, s_51_1, 0, 1, 0}, +{ 8, s_51_2, 0, 1, 0}, +{ 10, s_51_3, 0, 1, 0}, +{ 12, s_51_4, 0, 1, 0}, +{ 6, s_51_5, 0, 1, 0}, +{ 6, s_51_6, 0, 1, 0}, +{ 6, s_51_7, 0, 1, 0}, +{ 8, s_51_8, 0, 1, 0}, +{ 12, s_51_9, 0, 1, 0}, +{ 8, s_51_10, 0, 1, 0}, +{ 4, s_51_11, 0, 1, 0} +}; + +static const symbol s_52_0[10] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB9, 0xCF, 0x80 }; +static const symbol s_52_1[2] = { 0xCF, 0x81 }; +static const symbol s_52_2[10] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x81 }; +static const symbol s_52_3[16] = { 0xCE, 0xB5, 0xCE, 0xBD, 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x86, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_52_4[6] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_52_5[14] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x85 }; +static const symbol s_52_6[16] = { 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x85, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x85 }; +static const symbol s_52_7[6] = { 0xCE, 0xBB, 0xCE, 0xB5, 0xCF, 0x87 }; +static const symbol s_52_8[6] = { 0xCF, 0x84, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_52_9[6] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_52_10[6] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xB4 }; +static const symbol s_52_11[12] = { 0xCE, 0xBB, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x80, 0xCE, 0xB9, 0xCE, 0xB4 }; +static const symbol s_52_12[4] = { 0xCE, 0xB4, 0xCE, 0xB5 }; +static const symbol s_52_13[6] = { 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB5 }; +static const symbol s_52_14[10] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xB6 }; +static const symbol s_52_15[12] = { 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xB6 }; +static const symbol s_52_16[6] = { 0xCE, 0xB1, 0xCE, 0xB9, 0xCE, 0xB8 }; +static const symbol s_52_17[12] = { 0xCF, 0x86, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_52_18[6] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xBA }; +static const symbol s_52_19[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB7, 0xCE, 0xBA }; +static const symbol s_52_20[2] = { 0xCE, 0xBB }; +static const symbol s_52_21[2] = { 0xCE, 0xBC }; +static const symbol s_52_22[4] = { 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_52_23[8] = { 0xCE, 0xB2, 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xBC }; +static const symbol s_52_24[14] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB5, 0xCE, 0xB9, 0xCE, 0xBD }; +static const struct among a_52[25] = { +{ 10, s_52_0, 0, 1, 0}, +{ 2, s_52_1, 0, 1, 0}, +{ 10, s_52_2, -1, 1, 0}, +{ 16, s_52_3, -2, 1, 0}, +{ 6, s_52_4, 0, 1, 0}, +{ 14, s_52_5, 0, 1, 0}, +{ 16, s_52_6, 0, 1, 0}, +{ 6, s_52_7, 0, 1, 0}, +{ 6, s_52_8, 0, 1, 0}, +{ 6, s_52_9, 0, 1, 0}, +{ 6, s_52_10, 0, 1, 0}, +{ 12, s_52_11, 0, 1, 0}, +{ 4, s_52_12, 0, 1, 0}, +{ 6, s_52_13, 0, 1, 0}, +{ 10, s_52_14, 0, 1, 0}, +{ 12, s_52_15, 0, 1, 0}, +{ 6, s_52_16, 0, 1, 0}, +{ 12, s_52_17, 0, 1, 0}, +{ 6, s_52_18, 0, 1, 0}, +{ 8, s_52_19, 0, 1, 0}, +{ 2, s_52_20, 0, 1, 0}, +{ 2, s_52_21, 0, 1, 0}, +{ 4, s_52_22, -1, 1, 0}, +{ 8, s_52_23, -2, 1, 0}, +{ 14, s_52_24, 0, 1, 0} +}; + +static const symbol s_53_0[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_53_1[8] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_53_2[8] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB5 }; +static const struct among a_53[3] = { +{ 10, s_53_0, 0, 1, 0}, +{ 8, s_53_1, 0, 1, 0}, +{ 8, s_53_2, 0, 1, 0} +}; + +static const symbol s_54_0[4] = { 0xCF, 0x81, 0xCF, 0x80 }; +static const symbol s_54_1[4] = { 0xCF, 0x80, 0xCF, 0x81 }; +static const symbol s_54_2[4] = { 0xCF, 0x86, 0xCF, 0x81 }; +static const symbol s_54_3[8] = { 0xCF, 0x87, 0xCE, 0xBF, 0xCF, 0x81, 0xCF, 0x84 }; +static const symbol s_54_4[4] = { 0xCF, 0x83, 0xCF, 0x86 }; +static const symbol s_54_5[4] = { 0xCE, 0xBF, 0xCF, 0x86 }; +static const symbol s_54_6[6] = { 0xCF, 0x88, 0xCE, 0xBF, 0xCF, 0x86 }; +static const symbol s_54_7[6] = { 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x87 }; +static const symbol s_54_8[12] = { 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x85, 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x87 }; +static const symbol s_54_9[6] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCE, 0xBB }; +static const symbol s_54_10[4] = { 0xCE, 0xBB, 0xCE, 0xBB }; +static const symbol s_54_11[8] = { 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xB7, 0xCE, 0xBD }; +static const struct among a_54[12] = { +{ 4, s_54_0, 0, 1, 0}, +{ 4, s_54_1, 0, 1, 0}, +{ 4, s_54_2, 0, 1, 0}, +{ 8, s_54_3, 0, 1, 0}, +{ 4, s_54_4, 0, 1, 0}, +{ 4, s_54_5, 0, 1, 0}, +{ 6, s_54_6, -1, -1, 0}, +{ 6, s_54_7, 0, 1, 0}, +{ 12, s_54_8, -1, -1, 0}, +{ 6, s_54_9, 0, 1, 0}, +{ 4, s_54_10, 0, 1, 0}, +{ 8, s_54_11, 0, 1, 0} +}; + +static const symbol s_55_0[2] = { 0xCF, 0x80 }; +static const symbol s_55_1[6] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x80 }; +static const symbol s_55_2[8] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x85, 0xCF, 0x80 }; +static const symbol s_55_3[10] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x84, 0xCE, 0xB9, 0xCF, 0x80 }; +static const symbol s_55_4[8] = { 0xCE, 0xB1, 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x80 }; +static const symbol s_55_5[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBC, 0xCF, 0x80 }; +static const symbol s_55_6[16] = { 0xCF, 0x80, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x89, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_7[14] = { 0xCF, 0x83, 0xCE, 0xB9, 0xCE, 0xB4, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_8[12] = { 0xCE, 0xB4, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_9[8] = { 0xCE, 0xBD, 0xCE, 0xB5, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_10[16] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xBF, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_11[8] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_55_12[2] = { 0xCF, 0x81 }; +static const symbol s_55_13[4] = { 0xCF, 0x84, 0xCF, 0x81 }; +static const symbol s_55_14[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x81 }; +static const symbol s_55_15[10] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_55_16[6] = { 0xCF, 0x87, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_55_17[8] = { 0xCE, 0xB1, 0xCF, 0x87, 0xCE, 0xB1, 0xCF, 0x81 }; +static const symbol s_55_18[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_55_19[2] = { 0xCF, 0x84 }; +static const symbol s_55_20[10] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x85, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_55_21[10] = { 0xCE, 0xB1, 0xCE, 0xB2, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_55_22[10] = { 0xCF, 0x80, 0xCF, 0x81, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_55_23[12] = { 0xCE, 0xB1, 0xCE, 0xB9, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_55_24[8] = { 0xCE, 0xB4, 0xCE, 0xB9, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_55_25[8] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCE, 0xB9, 0xCF, 0x84 }; +static const symbol s_55_26[8] = { 0xCF, 0x83, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_55_27[8] = { 0xCF, 0x85, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x84 }; +static const symbol s_55_28[8] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBF, 0xCF, 0x84 }; +static const symbol s_55_29[8] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x84 }; +static const symbol s_55_30[10] = { 0xCE, 0xBD, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x84 }; +static const symbol s_55_31[6] = { 0xCE, 0xBD, 0xCE, 0xB1, 0xCF, 0x85 }; +static const symbol s_55_32[10] = { 0xCF, 0x80, 0xCE, 0xBF, 0xCE, 0xBB, 0xCF, 0x85, 0xCF, 0x86 }; +static const symbol s_55_33[4] = { 0xCE, 0xB1, 0xCF, 0x86 }; +static const symbol s_55_34[6] = { 0xCE, 0xBE, 0xCE, 0xB5, 0xCF, 0x86 }; +static const symbol s_55_35[8] = { 0xCE, 0xB1, 0xCE, 0xB4, 0xCE, 0xB7, 0xCF, 0x86 }; +static const symbol s_55_36[8] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBC, 0xCF, 0x86 }; +static const symbol s_55_37[12] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBB, 0xCE, 0xB9 }; +static const symbol s_55_38[2] = { 0xCE, 0xBB }; +static const symbol s_55_39[8] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xBB }; +static const symbol s_55_40[2] = { 0xCE, 0xBC }; +static const symbol s_55_41[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBB, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_55_42[4] = { 0xCE, 0xB5, 0xCE, 0xBD }; +static const symbol s_55_43[12] = { 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB2, 0xCE, 0xB5, 0xCE, 0xBD }; +static const struct among a_55[44] = { +{ 2, s_55_0, 0, 1, 0}, +{ 6, s_55_1, -1, 1, 0}, +{ 8, s_55_2, -2, 1, 0}, +{ 10, s_55_3, -3, 1, 0}, +{ 8, s_55_4, -4, 1, 0}, +{ 8, s_55_5, -5, 1, 0}, +{ 16, s_55_6, -6, 1, 0}, +{ 14, s_55_7, -7, 1, 0}, +{ 12, s_55_8, -8, 1, 0}, +{ 8, s_55_9, -9, 1, 0}, +{ 16, s_55_10, -10, 1, 0}, +{ 8, s_55_11, -11, 1, 0}, +{ 2, s_55_12, 0, 1, 0}, +{ 4, s_55_13, -1, 1, 0}, +{ 6, s_55_14, -2, 1, 0}, +{ 10, s_55_15, -3, 1, 0}, +{ 6, s_55_16, -4, 1, 0}, +{ 8, s_55_17, -1, 1, 0}, +{ 8, s_55_18, -6, 1, 0}, +{ 2, s_55_19, 0, 1, 0}, +{ 10, s_55_20, -1, 1, 0}, +{ 10, s_55_21, -2, 1, 0}, +{ 10, s_55_22, -3, 1, 0}, +{ 12, s_55_23, -4, 1, 0}, +{ 8, s_55_24, -5, 1, 0}, +{ 8, s_55_25, -6, 1, 0}, +{ 8, s_55_26, -7, 1, 0}, +{ 8, s_55_27, -8, 1, 0}, +{ 8, s_55_28, -9, 1, 0}, +{ 8, s_55_29, -10, 1, 0}, +{ 10, s_55_30, -1, 1, 0}, +{ 6, s_55_31, 0, 1, 0}, +{ 10, s_55_32, 0, 1, 0}, +{ 4, s_55_33, 0, 1, 0}, +{ 6, s_55_34, 0, 1, 0}, +{ 8, s_55_35, 0, 1, 0}, +{ 8, s_55_36, 0, 1, 0}, +{ 12, s_55_37, 0, 1, 0}, +{ 2, s_55_38, 0, 1, 0}, +{ 8, s_55_39, -1, 1, 0}, +{ 2, s_55_40, 0, 1, 0}, +{ 10, s_55_41, -1, 1, 0}, +{ 4, s_55_42, 0, 1, 0}, +{ 12, s_55_43, -1, 1, 0} +}; + +static const symbol s_56_0[8] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_56_1[6] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1 }; +static const symbol s_56_2[6] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB5 }; +static const struct among a_56[3] = { +{ 8, s_56_0, 0, 1, 0}, +{ 6, s_56_1, 0, 1, 0}, +{ 6, s_56_2, 0, 1, 0} +}; + +static const symbol s_57_0[8] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_57_1[6] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_57_2[6] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB5 }; +static const struct among a_57[3] = { +{ 8, s_57_0, 0, 1, 0}, +{ 6, s_57_1, 0, 1, 0}, +{ 6, s_57_2, 0, 1, 0} +}; + +static const symbol s_58_0[2] = { 0xCE, 0xBD }; +static const symbol s_58_1[10] = { 0xCE, 0xB5, 0xCF, 0x80, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_58_2[14] = { 0xCE, 0xB4, 0xCF, 0x89, 0xCE, 0xB4, 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_58_3[12] = { 0xCF, 0x87, 0xCE, 0xB5, 0xCF, 0x81, 0xCF, 0x83, 0xCE, 0xBF, 0xCE, 0xBD }; +static const symbol s_58_4[14] = { 0xCE, 0xBC, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBF, 0xCE, 0xBD }; +static const symbol s_58_5[12] = { 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB7, 0xCE, 0xBC, 0xCE, 0xBF, 0xCE, 0xBD }; +static const struct among a_58[6] = { +{ 2, s_58_0, 0, 1, 0}, +{ 10, s_58_1, -1, 1, 0}, +{ 14, s_58_2, -2, 1, 0}, +{ 12, s_58_3, -3, 1, 0}, +{ 14, s_58_4, -4, 1, 0}, +{ 12, s_58_5, -5, 1, 0} +}; + +static const symbol s_59_0[8] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const struct among a_59[1] = { +{ 8, s_59_0, 0, 1, 0} +}; + +static const symbol s_60_0[4] = { 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_60_1[10] = { 0xCE, 0xB4, 0xCF, 0x85, 0xCF, 0x83, 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_60_2[8] = { 0xCE, 0xB5, 0xCF, 0x85, 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_60_3[6] = { 0xCE, 0xB1, 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_60_4[14] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xB9, 0xCE, 0xBD, 0xCE, 0xBF, 0xCF, 0x87, 0xCF, 0x81 }; +static const symbol s_60_5[12] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xB9, 0xCE, 0xBC, 0xCF, 0x88 }; +static const symbol s_60_6[4] = { 0xCF, 0x83, 0xCE, 0xB2 }; +static const symbol s_60_7[6] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xB2 }; +static const symbol s_60_8[6] = { 0xCE, 0xB1, 0xCF, 0x80, 0xCE, 0xBB }; +static const symbol s_60_9[10] = { 0xCE, 0xB1, 0xCE, 0xB5, 0xCE, 0xB9, 0xCE, 0xBC, 0xCE, 0xBD }; +static const struct among a_60[10] = { +{ 4, s_60_0, 0, 1, 0}, +{ 10, s_60_1, -1, 1, 0}, +{ 8, s_60_2, -2, 1, 0}, +{ 6, s_60_3, -3, 1, 0}, +{ 14, s_60_4, -4, 1, 0}, +{ 12, s_60_5, 0, 1, 0}, +{ 4, s_60_6, 0, 1, 0}, +{ 6, s_60_7, -1, 1, 0}, +{ 6, s_60_8, 0, 1, 0}, +{ 10, s_60_9, 0, 1, 0} +}; + +static const symbol s_61_0[8] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_61_1[12] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_61_2[12] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const struct among a_61[3] = { +{ 8, s_61_0, 0, 1, 0}, +{ 12, s_61_1, -1, 1, 0}, +{ 12, s_61_2, -2, 1, 0} +}; + +static const symbol s_62_0[2] = { 0xCF, 0x81 }; +static const symbol s_62_1[22] = { 0xCF, 0x83, 0xCF, 0x84, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xB2, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_62_2[18] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_62_3[6] = { 0xCF, 0x83, 0xCF, 0x80, 0xCE, 0xB9 }; +static const symbol s_62_4[2] = { 0xCE, 0xBD }; +static const symbol s_62_5[8] = { 0xCE, 0xB5, 0xCE, 0xBE, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_62[6] = { +{ 2, s_62_0, 0, 1, 0}, +{ 22, s_62_1, 0, 1, 0}, +{ 18, s_62_2, 0, 1, 0}, +{ 6, s_62_3, 0, 1, 0}, +{ 2, s_62_4, 0, 1, 0}, +{ 8, s_62_5, -1, 1, 0} +}; + +static const symbol s_63_0[8] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_63_1[12] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_63_2[12] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const struct among a_63[3] = { +{ 8, s_63_0, 0, 1, 0}, +{ 12, s_63_1, -1, 1, 0}, +{ 12, s_63_2, -2, 1, 0} +}; + +static const symbol s_64_0[10] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_64_1[16] = { 0xCF, 0x80, 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_64_2[16] = { 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xBB, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_64_3[2] = { 0xCF, 0x86 }; +static const symbol s_64_4[2] = { 0xCF, 0x87 }; +static const symbol s_64_5[4] = { 0xCE, 0xB1, 0xCE, 0xB6 }; +static const symbol s_64_6[12] = { 0xCF, 0x89, 0xCF, 0x81, 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x80, 0xCE, 0xBB }; +static const struct among a_64[7] = { +{ 10, s_64_0, 0, 1, 0}, +{ 16, s_64_1, -1, 1, 0}, +{ 16, s_64_2, 0, 1, 0}, +{ 2, s_64_3, 0, 1, 0}, +{ 2, s_64_4, 0, 1, 0}, +{ 4, s_64_5, 0, 1, 0}, +{ 12, s_64_6, 0, 1, 0} +}; + +static const symbol s_65_0[10] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_65_1[8] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1 }; +static const symbol s_65_2[10] = { 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x89, 0xCE, 0xBD }; +static const struct among a_65[3] = { +{ 10, s_65_0, 0, 1, 0}, +{ 8, s_65_1, 0, 1, 0}, +{ 10, s_65_2, 0, 1, 0} +}; + +static const symbol s_66_0[4] = { 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_66_1[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_66_2[4] = { 0xCE, 0xB1, 0xCF, 0x83 }; +static const symbol s_66_3[4] = { 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_66_4[8] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_66_5[8] = { 0xCE, 0xB7, 0xCE, 0xB4, 0xCE, 0xB5, 0xCF, 0x83 }; +static const symbol s_66_6[4] = { 0xCE, 0xB7, 0xCF, 0x83 }; +static const symbol s_66_7[6] = { 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_66_8[10] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_66_9[4] = { 0xCE, 0xBF, 0xCF, 0x83 }; +static const symbol s_66_10[2] = { 0xCF, 0x85 }; +static const symbol s_66_11[4] = { 0xCE, 0xBF, 0xCF, 0x85 }; +static const symbol s_66_12[2] = { 0xCF, 0x89 }; +static const symbol s_66_13[6] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCF, 0x89 }; +static const symbol s_66_14[4] = { 0xCE, 0xB1, 0xCF, 0x89 }; +static const symbol s_66_15[6] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCF, 0x89 }; +static const symbol s_66_16[2] = { 0xCE, 0xB1 }; +static const symbol s_66_17[10] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB1 }; +static const symbol s_66_18[12] = { 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1 }; +static const symbol s_66_19[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1 }; +static const symbol s_66_20[12] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1 }; +static const symbol s_66_21[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCE, 0xB1 }; +static const symbol s_66_22[2] = { 0xCE, 0xB5 }; +static const symbol s_66_23[14] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_24[12] = { 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_25[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_26[14] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_27[16] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_28[14] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_29[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_30[10] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_31[10] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_32[10] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_33[14] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_34[8] = { 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_35[12] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB9, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_66_36[2] = { 0xCE, 0xB7 }; +static const symbol s_66_37[2] = { 0xCE, 0xB9 }; +static const symbol s_66_38[8] = { 0xCE, 0xB1, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_39[8] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_40[10] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_41[8] = { 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_42[8] = { 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_43[10] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_44[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_45[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_46[10] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_47[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_48[8] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_49[10] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_50[8] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCE, 0xB9 }; +static const symbol s_66_51[4] = { 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_66_52[8] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_66_53[6] = { 0xCE, 0xB1, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_66_54[8] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB9 }; +static const symbol s_66_55[4] = { 0xCE, 0xBF, 0xCE, 0xB9 }; +static const symbol s_66_56[6] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_57[10] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_58[10] = { 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_59[12] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_60[10] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_61[10] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_62[12] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_66_63[4] = { 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_66_64[8] = { 0xCE, 0xB7, 0xCE, 0xB4, 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_66_65[4] = { 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_66[10] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_67[16] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_68[18] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_69[8] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_70[14] = { 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_71[16] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x83, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_72[14] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_73[16] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_74[12] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_75[14] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_76[10] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_77[12] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_78[8] = { 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_79[10] = { 0xCE, 0xB9, 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_80[8] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_81[8] = { 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_82[12] = { 0xCE, 0xB7, 0xCE, 0xB8, 0xCE, 0xB7, 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_66_83[2] = { 0xCE, 0xBF }; +static const struct among a_66[84] = { +{ 4, s_66_0, 0, 1, 0}, +{ 6, s_66_1, -1, 1, 0}, +{ 4, s_66_2, 0, 1, 0}, +{ 4, s_66_3, 0, 1, 0}, +{ 8, s_66_4, -1, 1, 0}, +{ 8, s_66_5, -2, 1, 0}, +{ 4, s_66_6, 0, 1, 0}, +{ 6, s_66_7, 0, 1, 0}, +{ 10, s_66_8, -1, 1, 0}, +{ 4, s_66_9, 0, 1, 0}, +{ 2, s_66_10, 0, 1, 0}, +{ 4, s_66_11, -1, 1, 0}, +{ 2, s_66_12, 0, 1, 0}, +{ 6, s_66_13, -1, 1, 0}, +{ 4, s_66_14, -2, 1, 0}, +{ 6, s_66_15, -3, 1, 0}, +{ 2, s_66_16, 0, 1, 0}, +{ 10, s_66_17, -1, 1, 0}, +{ 12, s_66_18, -2, 1, 0}, +{ 14, s_66_19, -1, 1, 0}, +{ 12, s_66_20, -4, 1, 0}, +{ 14, s_66_21, -1, 1, 0}, +{ 2, s_66_22, 0, 1, 0}, +{ 14, s_66_23, -1, 1, 0}, +{ 12, s_66_24, -2, 1, 0}, +{ 14, s_66_25, -1, 1, 0}, +{ 14, s_66_26, -4, 1, 0}, +{ 16, s_66_27, -1, 1, 0}, +{ 14, s_66_28, -6, 1, 0}, +{ 12, s_66_29, -7, 1, 0}, +{ 10, s_66_30, -8, 1, 0}, +{ 10, s_66_31, -9, 1, 0}, +{ 10, s_66_32, -10, 1, 0}, +{ 14, s_66_33, -1, 1, 0}, +{ 8, s_66_34, -12, 1, 0}, +{ 12, s_66_35, -1, 1, 0}, +{ 2, s_66_36, 0, 1, 0}, +{ 2, s_66_37, 0, 1, 0}, +{ 8, s_66_38, -1, 1, 0}, +{ 8, s_66_39, -2, 1, 0}, +{ 10, s_66_40, -1, 1, 0}, +{ 8, s_66_41, -4, 1, 0}, +{ 8, s_66_42, -5, 1, 0}, +{ 10, s_66_43, -1, 1, 0}, +{ 12, s_66_44, -7, 1, 0}, +{ 14, s_66_45, -1, 1, 0}, +{ 10, s_66_46, -9, 1, 0}, +{ 10, s_66_47, -10, 1, 0}, +{ 8, s_66_48, -11, 1, 0}, +{ 10, s_66_49, -12, 1, 0}, +{ 8, s_66_50, -13, 1, 0}, +{ 4, s_66_51, -14, 1, 0}, +{ 8, s_66_52, -1, 1, 0}, +{ 6, s_66_53, -2, 1, 0}, +{ 8, s_66_54, -3, 1, 0}, +{ 4, s_66_55, -18, 1, 0}, +{ 6, s_66_56, 0, 1, 0}, +{ 10, s_66_57, -1, 1, 0}, +{ 10, s_66_58, -2, 1, 0}, +{ 12, s_66_59, -1, 1, 0}, +{ 10, s_66_60, -4, 1, 0}, +{ 10, s_66_61, -5, 1, 0}, +{ 12, s_66_62, -1, 1, 0}, +{ 4, s_66_63, 0, 1, 0}, +{ 8, s_66_64, -1, 1, 0}, +{ 4, s_66_65, 0, 1, 0}, +{ 10, s_66_66, -1, 1, 0}, +{ 16, s_66_67, -1, 1, 0}, +{ 18, s_66_68, -1, 1, 0}, +{ 8, s_66_69, -4, 1, 0}, +{ 14, s_66_70, -5, 1, 0}, +{ 16, s_66_71, -1, 1, 0}, +{ 14, s_66_72, -7, 1, 0}, +{ 16, s_66_73, -1, 1, 0}, +{ 12, s_66_74, -9, 1, 0}, +{ 14, s_66_75, -1, 1, 0}, +{ 10, s_66_76, -11, 1, 0}, +{ 12, s_66_77, -1, 1, 0}, +{ 8, s_66_78, -13, 1, 0}, +{ 10, s_66_79, -1, 1, 0}, +{ 8, s_66_80, -15, 1, 0}, +{ 8, s_66_81, -16, 1, 0}, +{ 12, s_66_82, -1, 1, 0}, +{ 2, s_66_83, 0, 1, 0} +}; + +static const symbol s_67_0[10] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_67_1[8] = { 0xCF, 0x85, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_67_2[8] = { 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_67_3[8] = { 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_67_4[10] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_67_5[8] = { 0xCF, 0x85, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_67_6[8] = { 0xCF, 0x89, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84 }; +static const symbol s_67_7[8] = { 0xCE, 0xBF, 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84 }; +static const struct among a_67[8] = { +{ 10, s_67_0, 0, 1, 0}, +{ 8, s_67_1, 0, 1, 0}, +{ 8, s_67_2, 0, 1, 0}, +{ 8, s_67_3, 0, 1, 0}, +{ 10, s_67_4, 0, 1, 0}, +{ 8, s_67_5, 0, 1, 0}, +{ 8, s_67_6, 0, 1, 0}, +{ 8, s_67_7, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 81, 65, 16, 1 }; + +static const unsigned char g_v2[] = { 81, 65, 0, 1 }; + +static const symbol s_0[] = { 0xCE, 0xB1 }; +static const symbol s_1[] = { 0xCE, 0xB2 }; +static const symbol s_2[] = { 0xCE, 0xB3 }; +static const symbol s_3[] = { 0xCE, 0xB4 }; +static const symbol s_4[] = { 0xCE, 0xB5 }; +static const symbol s_5[] = { 0xCE, 0xB6 }; +static const symbol s_6[] = { 0xCE, 0xB7 }; +static const symbol s_7[] = { 0xCE, 0xB8 }; +static const symbol s_8[] = { 0xCE, 0xB9 }; +static const symbol s_9[] = { 0xCE, 0xBA }; +static const symbol s_10[] = { 0xCE, 0xBB }; +static const symbol s_11[] = { 0xCE, 0xBC }; +static const symbol s_12[] = { 0xCE, 0xBD }; +static const symbol s_13[] = { 0xCE, 0xBE }; +static const symbol s_14[] = { 0xCE, 0xBF }; +static const symbol s_15[] = { 0xCF, 0x80 }; +static const symbol s_16[] = { 0xCF, 0x81 }; +static const symbol s_17[] = { 0xCF, 0x83 }; +static const symbol s_18[] = { 0xCF, 0x84 }; +static const symbol s_19[] = { 0xCF, 0x85 }; +static const symbol s_20[] = { 0xCF, 0x86 }; +static const symbol s_21[] = { 0xCF, 0x87 }; +static const symbol s_22[] = { 0xCF, 0x88 }; +static const symbol s_23[] = { 0xCF, 0x89 }; +static const symbol s_24[] = { 0xCF, 0x86, 0xCE, 0xB1 }; +static const symbol s_25[] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB1 }; +static const symbol s_26[] = { 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBF }; +static const symbol s_27[] = { 0xCF, 0x83, 0xCE, 0xBF }; +static const symbol s_28[] = { 0xCF, 0x84, 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF }; +static const symbol s_29[] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5 }; +static const symbol s_30[] = { 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_31[] = { 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81 }; +static const symbol s_32[] = { 0xCF, 0x86, 0xCF, 0x89 }; +static const symbol s_33[] = { 0xCE, 0xBA, 0xCE, 0xB1, 0xCE, 0xB8, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_34[] = { 0xCE, 0xB3, 0xCE, 0xB5, 0xCE, 0xB3, 0xCE, 0xBF, 0xCE, 0xBD }; +static const symbol s_35[] = { 0xCE, 0xB9 }; +static const symbol s_36[] = { 0xCE, 0xB9, 0xCE, 0xB6 }; +static const symbol s_37[] = { 0xCF, 0x89, 0xCE, 0xBD }; +static const symbol s_38[] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xB1 }; +static const symbol s_39[] = { 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_40[] = { 0xCE, 0xB9 }; +static const symbol s_41[] = { 0xCE, 0xB9, 0xCF, 0x83 }; +static const symbol s_42[] = { 0xCE, 0xB9 }; +static const symbol s_43[] = { 0xCE, 0xB9 }; +static const symbol s_44[] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_45[] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBC }; +static const symbol s_46[] = { 0xCE, 0xB9 }; +static const symbol s_47[] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xBD, 0xCF, 0x89, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_48[] = { 0xCE, 0xB1, 0xCF, 0x84, 0xCE, 0xBF, 0xCE, 0xBC }; +static const symbol s_49[] = { 0xCE, 0xB3, 0xCE, 0xBD, 0xCF, 0x89, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_50[] = { 0xCE, 0xB5, 0xCE, 0xB8, 0xCE, 0xBD }; +static const symbol s_51[] = { 0xCE, 0xB5, 0xCE, 0xBA, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBA, 0xCF, 0x84 }; +static const symbol s_52[] = { 0xCF, 0x83, 0xCE, 0xBA, 0xCE, 0xB5, 0xCF, 0x80, 0xCF, 0x84 }; +static const symbol s_53[] = { 0xCF, 0x84, 0xCE, 0xBF, 0xCF, 0x80 }; +static const symbol s_54[] = { 0xCE, 0xB1, 0xCE, 0xBB, 0xCE, 0xB5, 0xCE, 0xBE, 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB4, 0xCF, 0x81 }; +static const symbol s_55[] = { 0xCE, 0xB2, 0xCF, 0x85, 0xCE, 0xB6, 0xCE, 0xB1, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_56[] = { 0xCE, 0xB8, 0xCE, 0xB5, 0xCE, 0xB1, 0xCF, 0x84, 0xCF, 0x81 }; +static const symbol s_57[] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_58[] = { 0xCE, 0xB1, 0xCE, 0xBA }; +static const symbol s_59[] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_60[] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCF, 0x81 }; +static const symbol s_61[] = { 0xCE, 0xB9, 0xCF, 0x84, 0xCF, 0x83 }; +static const symbol s_62[] = { 0xCE, 0xB9, 0xCE, 0xB4 }; +static const symbol s_63[] = { 0xCE, 0xB9, 0xCE, 0xB4 }; +static const symbol s_64[] = { 0xCE, 0xB9, 0xCF, 0x83, 0xCE, 0xBA }; +static const symbol s_65[] = { 0xCE, 0xB1, 0xCE, 0xB4 }; +static const symbol s_66[] = { 0xCE, 0xB5, 0xCE, 0xB4 }; +static const symbol s_67[] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xB4 }; +static const symbol s_68[] = { 0xCE, 0xB5 }; +static const symbol s_69[] = { 0xCE, 0xB9 }; +static const symbol s_70[] = { 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_71[] = { 0xCE, 0xB9, 0xCE, 0xBA }; +static const symbol s_72[] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_73[] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_74[] = { 0xCE, 0xB1, 0xCE, 0xBC, 0xCE, 0xB5 }; +static const symbol s_75[] = { 0xCE, 0xB1, 0xCE, 0xBC }; +static const symbol s_76[] = { 0xCE, 0xB1, 0xCE, 0xB3, 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_77[] = { 0xCE, 0xB1, 0xCE, 0xBD, 0xCE, 0xB5 }; +static const symbol s_78[] = { 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_79[] = { 0xCE, 0xB1, 0xCE, 0xBD }; +static const symbol s_80[] = { 0xCE, 0xB5, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_81[] = { 0xCE, 0xB5, 0xCF, 0x84 }; +static const symbol s_82[] = { 0xCE, 0xB5, 0xCF, 0x84 }; +static const symbol s_83[] = { 0xCE, 0xB5, 0xCF, 0x84 }; +static const symbol s_84[] = { 0xCE, 0xB1, 0xCF, 0x81, 0xCF, 0x87 }; +static const symbol s_85[] = { 0xCE, 0xBF, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_86[] = { 0xCE, 0xBA, 0xCF, 0x81, 0xCE, 0xB5 }; +static const symbol s_87[] = { 0xCF, 0x89, 0xCE, 0xBD, 0xCF, 0x84 }; +static const symbol s_88[] = { 0xCE, 0xBF, 0xCE, 0xBD }; +static const symbol s_89[] = { 0xCE, 0xBF, 0xCE, 0xBC, 0xCE, 0xB1, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_90[] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_91[] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_92[] = { 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84, 0xCE, 0xB5 }; +static const symbol s_93[] = { 0xCE, 0xB9, 0xCE, 0xB5, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_94[] = { 0xCE, 0xB7, 0xCE, 0xBA }; +static const symbol s_95[] = { 0xCE, 0xB7, 0xCE, 0xBA }; +static const symbol s_96[] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_97[] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCF, 0x83 }; +static const symbol s_98[] = { 0xCE, 0xBA, 0xCE, 0xBF, 0xCE, 0xBB, 0xCE, 0xBB }; +static const symbol s_99[] = { 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_100[] = { 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_101[] = { 0xCE, 0xB1, 0xCE, 0xB3 }; +static const symbol s_102[] = { 0xCE, 0xB7, 0xCF, 0x83 }; +static const symbol s_103[] = { 0xCE, 0xB7, 0xCF, 0x83, 0xCF, 0x84 }; +static const symbol s_104[] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBD }; +static const symbol s_105[] = { 0xCE, 0xBF, 0xCF, 0x85, 0xCE, 0xBC }; +static const symbol s_106[] = { 0xCE, 0xBC, 0xCE, 0xB1 }; + +static int r_has_min_length(struct SN_env * z) { + return len_utf8(z->p) >= 3; +} + +static int r_tolower(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_0, 46); + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 2, s_6); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 2, s_8); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 2, s_11); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 2, s_12); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 2, s_13); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 2, s_15); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 2, s_16); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 2, s_17); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 2, s_19); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 2, s_20); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 2, s_21); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 2, s_22); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 2, s_23); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = z->l - v_1; + break; + } + return 1; +} + +static int r_step_1(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_1, 40); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_24); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 6, s_25); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 6, s_26); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_27); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 8, s_28); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_29); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 6, s_30); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 6, s_31); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 4, s_32); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 12, s_33); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 10, s_34); + if (ret < 0) return ret; + } + break; + } + z->I[0] = 0; + return 1; +} + +static int r_step_s1(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (!find_among_b(z, a_3, 14)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + among_var = find_among_b(z, a_2, 31); + if (!among_var) return 0; + if (z->c > z->lb) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_35); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_36); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_step_s2(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_5, 7)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_4, 8)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_37); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_s3(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 6, s_38))) goto lab1; + z->bra = z->c; + if (z->c > z->lb) goto lab1; + { + int ret = slice_from_s(z, 4, s_39); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + } +lab0: + if (!find_among_b(z, a_7, 7)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + among_var = find_among_b(z, a_6, 32); + if (!among_var) return 0; + if (z->c > z->lb) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_40); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_41); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_step_s4(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_9, 7)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] >> 5 != 5 || !((-2145255424 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_8, 19)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 2, s_42); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_s5(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (!find_among_b(z, a_11, 11)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + among_var = find_among_b(z, a_10, 40); + if (!among_var) return 0; + if (z->c > z->lb) return 0; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_43); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 6, s_44); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_step_s6(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (!find_among_b(z, a_14, 6)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 181) goto lab1; + among_var = find_among_b(z, a_12, 7); + if (!among_var) goto lab1; + if (z->c > z->lb) goto lab1; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 6, s_45); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_46); + if (ret < 0) return ret; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + if (z->c - 9 <= z->lb || (z->p[z->c - 1] != 186 && z->p[z->c - 1] != 189)) return 0; + among_var = find_among_b(z, a_13, 10); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 12, s_47); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 8, s_48); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 10, s_49); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 6, s_50); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 12, s_51); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 10, s_52); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 6, s_53); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 16, s_54); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 12, s_55); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 10, s_56); + if (ret < 0) return ret; + } + break; + } + } +lab0: + return 1; +} + +static int r_step_s7(struct SN_env * z) { + z->ket = z->c; + if (z->c - 9 <= z->lb || (z->p[z->c - 1] != 177 && z->p[z->c - 1] != 185)) return 0; + if (!find_among_b(z, a_16, 4)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 131 && z->p[z->c - 1] != 135)) return 0; + if (!find_among_b(z, a_15, 2)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 8, s_57); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_s8(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (!find_among_b(z, a_18, 8)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + among_var = find_among_b(z, a_17, 46); + if (!among_var) goto lab1; + if (z->c > z->lb) goto lab1; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_58); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 6, s_59); + if (ret < 0) return ret; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + z->bra = z->c; + if (!(eq_s_b(z, 6, s_60))) return 0; + { + int ret = slice_from_s(z, 6, s_61); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_step_s9(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || z->p[z->c - 1] >> 5 != 5 || !((-1610481664 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_21, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_19, 4)) goto lab1; + if (z->c > z->lb) goto lab1; + { + int ret = slice_from_s(z, 4, s_62); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 181 && z->p[z->c - 1] != 189)) return 0; + if (!find_among_b(z, a_20, 2)) return 0; + { + int ret = slice_from_s(z, 4, s_63); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_step_s10(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_23, 4)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_22, 7)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 6, s_64); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_2a(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || (z->p[z->c - 1] != 131 && z->p[z->c - 1] != 189)) return 0; + if (!find_among_b(z, a_24, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + if (!find_among_b(z, a_25, 10)) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + } + { + int saved_c = z->c; + int ret = insert_s(z, z->c, z->c, 4, s_65); + z->c = saved_c; + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_2b(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || (z->p[z->c - 1] != 131 && z->p[z->c - 1] != 189)) return 0; + if (!find_among_b(z, a_26, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + z->bra = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 128 && z->p[z->c - 1] != 187)) return 0; + if (!find_among_b(z, a_27, 8)) return 0; + { + int ret = slice_from_s(z, 4, s_66); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_2c(struct SN_env * z) { + z->ket = z->c; + if (z->c - 9 <= z->lb || (z->p[z->c - 1] != 131 && z->p[z->c - 1] != 189)) return 0; + if (!find_among_b(z, a_28, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_29, 15)) return 0; + { + int ret = slice_from_s(z, 6, s_67); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_2d(struct SN_env * z) { + z->ket = z->c; + if (z->c - 5 <= z->lb || (z->p[z->c - 1] != 131 && z->p[z->c - 1] != 189)) return 0; + if (!find_among_b(z, a_30, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_31, 8)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 2, s_68); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_3(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_32, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (in_grouping_b_U(z, g_v, 945, 969, 0)) return 0; + { + int ret = slice_from_s(z, 2, s_69); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_4(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_33, 4)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (in_grouping_b_U(z, g_v, 945, 969, 0)) goto lab1; + { + int ret = slice_from_s(z, 4, s_70); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + } +lab0: + z->bra = z->c; + if (!find_among_b(z, a_34, 36)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_71); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5a(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 10, s_72))) goto lab0; + z->bra = z->c; + if (z->c > z->lb) goto lab0; + { + int ret = slice_from_s(z, 8, s_73); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 9 <= z->lb || z->p[z->c - 1] != 181) goto lab1; + if (!find_among_b(z, a_35, 5)) goto lab1; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + lab1: + z->c = z->l - v_2; + } + z->ket = z->c; + if (!(eq_s_b(z, 6, s_74))) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_36, 12)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_75); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5b(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 9 <= z->lb || z->p[z->c - 1] != 181) goto lab0; + if (!find_among_b(z, a_38, 11)) goto lab0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 129 && z->p[z->c - 1] != 131)) goto lab0; + if (!find_among_b(z, a_37, 2)) goto lab0; + if (z->c > z->lb) goto lab0; + { + int ret = slice_from_s(z, 8, s_76); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + z->ket = z->c; + if (!(eq_s_b(z, 6, s_77))) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_2 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (in_grouping_b_U(z, g_v2, 945, 969, 0)) goto lab2; + { + int ret = slice_from_s(z, 4, s_78); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + z->ket = z->c; + } +lab1: + z->bra = z->c; + if (!find_among_b(z, a_39, 95)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_79); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5c(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 9 <= z->lb || z->p[z->c - 1] != 181) goto lab0; + if (!find_among_b(z, a_40, 1)) goto lab0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + lab0: + z->c = z->l - v_1; + } + z->ket = z->c; + if (!(eq_s_b(z, 6, s_80))) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_2 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (in_grouping_b_U(z, g_v2, 945, 969, 0)) goto lab2; + { + int ret = slice_from_s(z, 4, s_81); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_41, 31)) goto lab3; + { + int ret = slice_from_s(z, 4, s_82); + if (ret < 0) return ret; + } + goto lab1; + lab3: + z->c = z->l - v_2; + z->ket = z->c; + } +lab1: + z->bra = z->c; + if (!find_among_b(z, a_42, 25)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_83); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5d(struct SN_env * z) { + z->ket = z->c; + if (z->c - 9 <= z->lb || z->p[z->c - 1] != 131) return 0; + if (!find_among_b(z, a_43, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (!(eq_s_b(z, 6, s_84))) goto lab1; + if (z->c > z->lb) goto lab1; + { + int ret = slice_from_s(z, 6, s_85); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + z->bra = z->c; + if (!(eq_s_b(z, 6, s_86))) return 0; + { + int ret = slice_from_s(z, 6, s_87); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_step_5e(struct SN_env * z) { + z->ket = z->c; + if (z->c - 11 <= z->lb || z->p[z->c - 1] != 181) return 0; + if (!find_among_b(z, a_44, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!(eq_s_b(z, 4, s_88))) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 10, s_89); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5f(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 10, s_90))) goto lab0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 128 && z->p[z->c - 1] != 134)) goto lab0; + if (!find_among_b(z, a_45, 6)) goto lab0; + if (z->c > z->lb) goto lab0; + { + int ret = slice_from_s(z, 8, s_91); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + z->ket = z->c; + if (!(eq_s_b(z, 8, s_92))) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_46, 9)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 8, s_93); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5g(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!find_among_b(z, a_47, 3)) goto lab0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + lab0: + z->c = z->l - v_1; + } + z->ket = z->c; + if (!find_among_b(z, a_50, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_2 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_48, 6)) goto lab2; + { + int ret = slice_from_s(z, 4, s_94); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + z->ket = z->c; + z->bra = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 184) return 0; + if (!find_among_b(z, a_49, 5)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_95); + if (ret < 0) return ret; + } + } +lab1: + return 1; +} + +static int r_step_5h(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_53, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_51, 12)) goto lab1; + { + int ret = slice_from_s(z, 6, s_96); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_52, 25)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 6, s_97); + if (ret < 0) return ret; + } + } +lab0: + return 1; +} + +static int r_step_5i(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (!find_among_b(z, a_56, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + { + int v_1 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + if (!(eq_s_b(z, 8, s_98))) goto lab1; + { + int ret = slice_from_s(z, 4, s_99); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_2 = z->l - z->c; + z->ket = z->c; + z->bra = z->c; + among_var = find_among_b(z, a_54, 12); + if (!among_var) goto lab3; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_100); + if (ret < 0) return ret; + } + break; + } + goto lab2; + lab3: + z->c = z->l - v_2; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_55, 44)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_101); + if (ret < 0) return ret; + } + } + lab2: + ; + } +lab0: + return 1; +} + +static int r_step_5j(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_57, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 189) return 0; + if (!find_among_b(z, a_58, 6)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 4, s_102); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5k(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || z->p[z->c - 1] != 181) return 0; + if (!find_among_b(z, a_59, 1)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_60, 10)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 6, s_103); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5l(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || z->p[z->c - 1] != 181) return 0; + if (!find_among_b(z, a_61, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_62, 6)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 6, s_104); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_5m(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || z->p[z->c - 1] != 181) return 0; + if (!find_among_b(z, a_63, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 0; + z->ket = z->c; + z->bra = z->c; + if (!find_among_b(z, a_64, 7)) return 0; + if (z->c > z->lb) return 0; + { + int ret = slice_from_s(z, 6, s_105); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_6(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!find_among_b(z, a_65, 3)) goto lab0; + z->bra = z->c; + { + int ret = slice_from_s(z, 4, s_106); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + if (!(z->I[0])) return 0; + z->ket = z->c; + if (!find_among_b(z, a_66, 84)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step_7(struct SN_env * z) { + z->ket = z->c; + if (z->c - 7 <= z->lb || (z->p[z->c - 1] != 129 && z->p[z->c - 1] != 132)) return 0; + if (!find_among_b(z, a_67, 8)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int greek_UTF_8_stem(struct SN_env * z) { + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_tolower(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->I[0] = 1; + { + int v_2 = z->l - z->c; + { + int ret = r_step_1(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_step_s1(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_step_s2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_step_s3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_step_s4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_step_s5(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_step_s6(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_step_s7(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_step_s8(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + { + int v_11 = z->l - z->c; + { + int ret = r_step_s9(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + } + { + int v_12 = z->l - z->c; + { + int ret = r_step_s10(z); + if (ret < 0) return ret; + } + z->c = z->l - v_12; + } + { + int v_13 = z->l - z->c; + { + int ret = r_step_2a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_13; + } + { + int v_14 = z->l - z->c; + { + int ret = r_step_2b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_14; + } + { + int v_15 = z->l - z->c; + { + int ret = r_step_2c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_15; + } + { + int v_16 = z->l - z->c; + { + int ret = r_step_2d(z); + if (ret < 0) return ret; + } + z->c = z->l - v_16; + } + { + int v_17 = z->l - z->c; + { + int ret = r_step_3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_17; + } + { + int v_18 = z->l - z->c; + { + int ret = r_step_4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_18; + } + { + int v_19 = z->l - z->c; + { + int ret = r_step_5a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_19; + } + { + int v_20 = z->l - z->c; + { + int ret = r_step_5b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_20; + } + { + int v_21 = z->l - z->c; + { + int ret = r_step_5c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_21; + } + { + int v_22 = z->l - z->c; + { + int ret = r_step_5d(z); + if (ret < 0) return ret; + } + z->c = z->l - v_22; + } + { + int v_23 = z->l - z->c; + { + int ret = r_step_5e(z); + if (ret < 0) return ret; + } + z->c = z->l - v_23; + } + { + int v_24 = z->l - z->c; + { + int ret = r_step_5f(z); + if (ret < 0) return ret; + } + z->c = z->l - v_24; + } + { + int v_25 = z->l - z->c; + { + int ret = r_step_5g(z); + if (ret < 0) return ret; + } + z->c = z->l - v_25; + } + { + int v_26 = z->l - z->c; + { + int ret = r_step_5h(z); + if (ret < 0) return ret; + } + z->c = z->l - v_26; + } + { + int v_27 = z->l - z->c; + { + int ret = r_step_5j(z); + if (ret < 0) return ret; + } + z->c = z->l - v_27; + } + { + int v_28 = z->l - z->c; + { + int ret = r_step_5i(z); + if (ret < 0) return ret; + } + z->c = z->l - v_28; + } + { + int v_29 = z->l - z->c; + { + int ret = r_step_5k(z); + if (ret < 0) return ret; + } + z->c = z->l - v_29; + } + { + int v_30 = z->l - z->c; + { + int ret = r_step_5l(z); + if (ret < 0) return ret; + } + z->c = z->l - v_30; + } + { + int v_31 = z->l - z->c; + { + int ret = r_step_5m(z); + if (ret < 0) return ret; + } + z->c = z->l - v_31; + } + { + int v_32 = z->l - z->c; + { + int ret = r_step_6(z); + if (ret < 0) return ret; + } + z->c = z->l - v_32; + } + { + int v_33 = z->l - z->c; + { + int ret = r_step_7(z); + if (ret < 0) return ret; + } + z->c = z->l - v_33; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * greek_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void greek_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_greek.h b/contrib/libs/snowball/src_c/stem_UTF_8_greek.h new file mode 100644 index 000000000000..88dde4ba1a65 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_greek.h @@ -0,0 +1,15 @@ +/* Generated from greek.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * greek_UTF_8_create_env(void); +extern void greek_UTF_8_close_env(struct SN_env * z); + +extern int greek_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_hindi.c b/contrib/libs/snowball/src_c/stem_UTF_8_hindi.c new file mode 100644 index 000000000000..3c4a33e98896 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_hindi.c @@ -0,0 +1,321 @@ +/* Generated from hindi.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +static int r_CONSONANT(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif +extern int hindi_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * hindi_UTF_8_create_env(void); +extern void hindi_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 0xE0, 0xA5, 0x80 }; +static const symbol s_0_1[12] = { 0xE0, 0xA5, 0x82, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_2[12] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_3[12] = { 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_4[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_5[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_6[12] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_7[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_8[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_9[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_10[9] = { 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_11[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_12[12] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_13[12] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_14[9] = { 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_15[12] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_16[12] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_17[6] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_18[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_19[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_20[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_21[6] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_22[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_23[6] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_24[6] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_25[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_26[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_27[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_28[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x81 }; +static const symbol s_0_29[3] = { 0xE0, 0xA5, 0x81 }; +static const symbol s_0_30[6] = { 0xE0, 0xA5, 0x80, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_31[9] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_32[12] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_33[12] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_34[12] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x80, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_35[6] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_36[9] = { 0xE0, 0xA5, 0x81, 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_37[9] = { 0xE0, 0xA4, 0x89, 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_38[6] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_39[6] = { 0xE0, 0xA4, 0x88, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_40[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x88, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_41[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x88, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_42[6] = { 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_43[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_44[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_45[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_46[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_47[6] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_48[9] = { 0xE0, 0xA5, 0x81, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_49[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_50[9] = { 0xE0, 0xA4, 0x89, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_51[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_52[12] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_53[15] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_54[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_55[15] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_56[6] = { 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_57[9] = { 0xE0, 0xA5, 0x81, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_58[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_59[9] = { 0xE0, 0xA4, 0x89, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_60[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_61[12] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_62[15] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_63[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_64[15] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_65[6] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_66[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_67[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_68[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_69[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x82 }; +static const symbol s_0_70[3] = { 0xE0, 0xA5, 0x82 }; +static const symbol s_0_71[3] = { 0xE0, 0xA4, 0x85 }; +static const symbol s_0_72[3] = { 0xE0, 0xA4, 0x86 }; +static const symbol s_0_73[3] = { 0xE0, 0xA4, 0x87 }; +static const symbol s_0_74[3] = { 0xE0, 0xA5, 0x87 }; +static const symbol s_0_75[12] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_76[12] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_77[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_78[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_79[9] = { 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_80[9] = { 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_81[12] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_82[12] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_83[6] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_84[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_85[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_86[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_87[6] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_88[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_89[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_90[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_91[3] = { 0xE0, 0xA4, 0x88 }; +static const symbol s_0_92[6] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x88 }; +static const symbol s_0_93[6] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x88 }; +static const symbol s_0_94[3] = { 0xE0, 0xA4, 0x89 }; +static const symbol s_0_95[3] = { 0xE0, 0xA4, 0x8A }; +static const symbol s_0_96[3] = { 0xE0, 0xA5, 0x8B }; +static const symbol s_0_97[3] = { 0xE0, 0xA5, 0x8D }; +static const symbol s_0_98[3] = { 0xE0, 0xA4, 0x8F }; +static const symbol s_0_99[6] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_100[6] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_101[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_102[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_103[6] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_104[6] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x8F }; +static const symbol s_0_105[3] = { 0xE0, 0xA4, 0x93 }; +static const symbol s_0_106[6] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x93 }; +static const symbol s_0_107[6] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x93 }; +static const symbol s_0_108[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xB0 }; +static const symbol s_0_109[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xB0 }; +static const symbol s_0_110[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xB0 }; +static const symbol s_0_111[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xB0 }; +static const symbol s_0_112[3] = { 0xE0, 0xA4, 0xBE }; +static const symbol s_0_113[12] = { 0xE0, 0xA5, 0x82, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_114[12] = { 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_115[15] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_116[15] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8A, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_117[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_118[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_119[12] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_120[12] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x97, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_121[6] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_122[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_123[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_124[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA4, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_125[6] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_126[9] = { 0xE0, 0xA4, 0x85, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_127[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_128[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_129[9] = { 0xE0, 0xA4, 0x86, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_130[9] = { 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xAF, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_131[3] = { 0xE0, 0xA4, 0xBF }; +static const struct among a_0[132] = { +{ 3, s_0_0, 0, -1, 0}, +{ 12, s_0_1, -1, -1, 0}, +{ 12, s_0_2, -2, -1, 0}, +{ 12, s_0_3, -3, -1, 0}, +{ 15, s_0_4, -1, -1, 0}, +{ 15, s_0_5, -2, -1, 0}, +{ 12, s_0_6, -6, -1, 0}, +{ 15, s_0_7, -1, -1, 0}, +{ 15, s_0_8, -2, -1, 0}, +{ 9, s_0_9, -9, -1, 0}, +{ 9, s_0_10, -10, -1, 0}, +{ 9, s_0_11, -11, -1, 0}, +{ 12, s_0_12, -1, -1, 0}, +{ 12, s_0_13, -2, -1, 0}, +{ 9, s_0_14, -14, -1, 0}, +{ 12, s_0_15, -1, -1, 0}, +{ 12, s_0_16, -2, -1, 0}, +{ 6, s_0_17, -17, -1, r_CONSONANT}, +{ 9, s_0_18, -1, -1, 0}, +{ 9, s_0_19, -2, -1, 0}, +{ 9, s_0_20, -3, -1, 0}, +{ 6, s_0_21, -21, -1, r_CONSONANT}, +{ 9, s_0_22, -1, -1, 0}, +{ 6, s_0_23, 0, -1, 0}, +{ 6, s_0_24, 0, -1, 0}, +{ 12, s_0_25, -1, -1, 0}, +{ 15, s_0_26, -1, -1, 0}, +{ 15, s_0_27, -2, -1, 0}, +{ 12, s_0_28, -4, -1, 0}, +{ 3, s_0_29, 0, -1, 0}, +{ 6, s_0_30, 0, -1, 0}, +{ 9, s_0_31, -1, -1, r_CONSONANT}, +{ 12, s_0_32, -1, -1, 0}, +{ 12, s_0_33, -2, -1, 0}, +{ 12, s_0_34, -3, -1, 0}, +{ 6, s_0_35, 0, -1, 0}, +{ 9, s_0_36, -1, -1, 0}, +{ 9, s_0_37, -2, -1, 0}, +{ 6, s_0_38, 0, -1, 0}, +{ 6, s_0_39, 0, -1, 0}, +{ 9, s_0_40, -1, -1, 0}, +{ 9, s_0_41, -2, -1, 0}, +{ 6, s_0_42, 0, -1, 0}, +{ 12, s_0_43, -1, -1, 0}, +{ 15, s_0_44, -1, -1, 0}, +{ 15, s_0_45, -2, -1, 0}, +{ 12, s_0_46, -4, -1, 0}, +{ 6, s_0_47, 0, -1, 0}, +{ 9, s_0_48, -1, -1, 0}, +{ 9, s_0_49, -2, -1, 0}, +{ 9, s_0_50, -3, -1, 0}, +{ 9, s_0_51, -4, -1, 0}, +{ 12, s_0_52, -1, -1, r_CONSONANT}, +{ 15, s_0_53, -1, -1, 0}, +{ 12, s_0_54, -3, -1, r_CONSONANT}, +{ 15, s_0_55, -1, -1, 0}, +{ 6, s_0_56, 0, -1, 0}, +{ 9, s_0_57, -1, -1, 0}, +{ 9, s_0_58, -2, -1, 0}, +{ 9, s_0_59, -3, -1, 0}, +{ 9, s_0_60, -4, -1, 0}, +{ 12, s_0_61, -1, -1, r_CONSONANT}, +{ 15, s_0_62, -1, -1, 0}, +{ 12, s_0_63, -3, -1, r_CONSONANT}, +{ 15, s_0_64, -1, -1, 0}, +{ 6, s_0_65, 0, -1, 0}, +{ 12, s_0_66, -1, -1, 0}, +{ 15, s_0_67, -1, -1, 0}, +{ 15, s_0_68, -2, -1, 0}, +{ 12, s_0_69, -4, -1, 0}, +{ 3, s_0_70, 0, -1, 0}, +{ 3, s_0_71, 0, -1, 0}, +{ 3, s_0_72, 0, -1, 0}, +{ 3, s_0_73, 0, -1, 0}, +{ 3, s_0_74, 0, -1, 0}, +{ 12, s_0_75, -1, -1, 0}, +{ 12, s_0_76, -2, -1, 0}, +{ 15, s_0_77, -1, -1, 0}, +{ 15, s_0_78, -2, -1, 0}, +{ 9, s_0_79, -5, -1, 0}, +{ 9, s_0_80, -6, -1, 0}, +{ 12, s_0_81, -1, -1, 0}, +{ 12, s_0_82, -2, -1, 0}, +{ 6, s_0_83, -9, -1, r_CONSONANT}, +{ 9, s_0_84, -1, -1, 0}, +{ 9, s_0_85, -2, -1, 0}, +{ 9, s_0_86, -3, -1, 0}, +{ 6, s_0_87, -13, -1, r_CONSONANT}, +{ 9, s_0_88, -1, -1, 0}, +{ 9, s_0_89, -2, -1, 0}, +{ 9, s_0_90, -3, -1, 0}, +{ 3, s_0_91, 0, -1, 0}, +{ 6, s_0_92, -1, -1, 0}, +{ 6, s_0_93, -2, -1, 0}, +{ 3, s_0_94, 0, -1, 0}, +{ 3, s_0_95, 0, -1, 0}, +{ 3, s_0_96, 0, -1, 0}, +{ 3, s_0_97, 0, -1, 0}, +{ 3, s_0_98, 0, -1, 0}, +{ 6, s_0_99, -1, -1, 0}, +{ 6, s_0_100, -2, -1, 0}, +{ 9, s_0_101, -1, -1, 0}, +{ 9, s_0_102, -2, -1, 0}, +{ 6, s_0_103, -5, -1, 0}, +{ 6, s_0_104, -6, -1, 0}, +{ 3, s_0_105, 0, -1, 0}, +{ 6, s_0_106, -1, -1, 0}, +{ 6, s_0_107, -2, -1, 0}, +{ 6, s_0_108, 0, -1, r_CONSONANT}, +{ 9, s_0_109, -1, -1, 0}, +{ 9, s_0_110, -2, -1, 0}, +{ 9, s_0_111, -3, -1, 0}, +{ 3, s_0_112, 0, -1, 0}, +{ 12, s_0_113, -1, -1, 0}, +{ 12, s_0_114, -2, -1, 0}, +{ 15, s_0_115, -1, -1, 0}, +{ 15, s_0_116, -2, -1, 0}, +{ 9, s_0_117, -5, -1, 0}, +{ 9, s_0_118, -6, -1, 0}, +{ 12, s_0_119, -1, -1, 0}, +{ 12, s_0_120, -2, -1, 0}, +{ 6, s_0_121, -9, -1, r_CONSONANT}, +{ 9, s_0_122, -1, -1, 0}, +{ 9, s_0_123, -2, -1, 0}, +{ 9, s_0_124, -3, -1, 0}, +{ 6, s_0_125, -13, -1, r_CONSONANT}, +{ 9, s_0_126, -1, -1, 0}, +{ 9, s_0_127, -2, -1, 0}, +{ 9, s_0_128, -3, -1, 0}, +{ 9, s_0_129, -17, -1, 0}, +{ 9, s_0_130, -18, -1, 0}, +{ 3, s_0_131, 0, -1, 0} +}; + +static const unsigned char g_consonant[] = { 255, 255, 255, 255, 159, 0, 0, 0, 248, 7 }; + + +static int r_CONSONANT(struct SN_env * z) { + if (in_grouping_b_U(z, g_consonant, 2325, 2399, 0)) return 0; + return 1; +} + +extern int hindi_UTF_8_stem(struct SN_env * z) { + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->lb = z->c; z->c = z->l; + z->ket = z->c; + if (!find_among_b(z, a_0, 132)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * hindi_UTF_8_create_env(void) { return SN_create_env(0, 0); } + +extern void hindi_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_hindi.h b/contrib/libs/snowball/src_c/stem_UTF_8_hindi.h new file mode 100644 index 000000000000..0db0172d8bc1 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_hindi.h @@ -0,0 +1,15 @@ +/* Generated from hindi.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hindi_UTF_8_create_env(void); +extern void hindi_UTF_8_close_env(struct SN_env * z); + +extern int hindi_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.c b/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.c new file mode 100644 index 000000000000..8cecc1322d6b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.c @@ -0,0 +1,881 @@ +/* Generated from hungarian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int hungarian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_double(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_factive(struct SN_env * z); +static int r_instrum(struct SN_env * z); +static int r_plur_owner(struct SN_env * z); +static int r_sing_owner(struct SN_env * z); +static int r_owned(struct SN_env * z); +static int r_plural(struct SN_env * z); +static int r_case_other(struct SN_env * z); +static int r_case_special(struct SN_env * z); +static int r_case(struct SN_env * z); +static int r_v_ending(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * hungarian_UTF_8_create_env(void); +extern void hungarian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 0xC3, 0xA1 }; +static const symbol s_0_1[2] = { 0xC3, 0xA9 }; +static const struct among a_0[2] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 2, 0} +}; + +static const symbol s_1_0[2] = { 'b', 'b' }; +static const symbol s_1_1[2] = { 'c', 'c' }; +static const symbol s_1_2[2] = { 'd', 'd' }; +static const symbol s_1_3[2] = { 'f', 'f' }; +static const symbol s_1_4[2] = { 'g', 'g' }; +static const symbol s_1_5[2] = { 'j', 'j' }; +static const symbol s_1_6[2] = { 'k', 'k' }; +static const symbol s_1_7[2] = { 'l', 'l' }; +static const symbol s_1_8[2] = { 'm', 'm' }; +static const symbol s_1_9[2] = { 'n', 'n' }; +static const symbol s_1_10[2] = { 'p', 'p' }; +static const symbol s_1_11[2] = { 'r', 'r' }; +static const symbol s_1_12[3] = { 'c', 'c', 's' }; +static const symbol s_1_13[2] = { 's', 's' }; +static const symbol s_1_14[3] = { 'z', 'z', 's' }; +static const symbol s_1_15[2] = { 't', 't' }; +static const symbol s_1_16[2] = { 'v', 'v' }; +static const symbol s_1_17[3] = { 'g', 'g', 'y' }; +static const symbol s_1_18[3] = { 'l', 'l', 'y' }; +static const symbol s_1_19[3] = { 'n', 'n', 'y' }; +static const symbol s_1_20[3] = { 't', 't', 'y' }; +static const symbol s_1_21[3] = { 's', 's', 'z' }; +static const symbol s_1_22[2] = { 'z', 'z' }; +static const struct among a_1[23] = { +{ 2, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 2, s_1_4, 0, -1, 0}, +{ 2, s_1_5, 0, -1, 0}, +{ 2, s_1_6, 0, -1, 0}, +{ 2, s_1_7, 0, -1, 0}, +{ 2, s_1_8, 0, -1, 0}, +{ 2, s_1_9, 0, -1, 0}, +{ 2, s_1_10, 0, -1, 0}, +{ 2, s_1_11, 0, -1, 0}, +{ 3, s_1_12, 0, -1, 0}, +{ 2, s_1_13, 0, -1, 0}, +{ 3, s_1_14, 0, -1, 0}, +{ 2, s_1_15, 0, -1, 0}, +{ 2, s_1_16, 0, -1, 0}, +{ 3, s_1_17, 0, -1, 0}, +{ 3, s_1_18, 0, -1, 0}, +{ 3, s_1_19, 0, -1, 0}, +{ 3, s_1_20, 0, -1, 0}, +{ 3, s_1_21, 0, -1, 0}, +{ 2, s_1_22, 0, -1, 0} +}; + +static const symbol s_2_0[2] = { 'a', 'l' }; +static const symbol s_2_1[2] = { 'e', 'l' }; +static const struct among a_2[2] = { +{ 2, s_2_0, 0, 1, 0}, +{ 2, s_2_1, 0, 1, 0} +}; + +static const symbol s_3_0[2] = { 'b', 'a' }; +static const symbol s_3_1[2] = { 'r', 'a' }; +static const symbol s_3_2[2] = { 'b', 'e' }; +static const symbol s_3_3[2] = { 'r', 'e' }; +static const symbol s_3_4[2] = { 'i', 'g' }; +static const symbol s_3_5[3] = { 'n', 'a', 'k' }; +static const symbol s_3_6[3] = { 'n', 'e', 'k' }; +static const symbol s_3_7[3] = { 'v', 'a', 'l' }; +static const symbol s_3_8[3] = { 'v', 'e', 'l' }; +static const symbol s_3_9[2] = { 'u', 'l' }; +static const symbol s_3_10[4] = { 'b', 0xC5, 0x91, 'l' }; +static const symbol s_3_11[4] = { 'r', 0xC5, 0x91, 'l' }; +static const symbol s_3_12[4] = { 't', 0xC5, 0x91, 'l' }; +static const symbol s_3_13[4] = { 'n', 0xC3, 0xA1, 'l' }; +static const symbol s_3_14[4] = { 'n', 0xC3, 0xA9, 'l' }; +static const symbol s_3_15[4] = { 'b', 0xC3, 0xB3, 'l' }; +static const symbol s_3_16[4] = { 'r', 0xC3, 0xB3, 'l' }; +static const symbol s_3_17[4] = { 't', 0xC3, 0xB3, 'l' }; +static const symbol s_3_18[3] = { 0xC3, 0xBC, 'l' }; +static const symbol s_3_19[1] = { 'n' }; +static const symbol s_3_20[2] = { 'a', 'n' }; +static const symbol s_3_21[3] = { 'b', 'a', 'n' }; +static const symbol s_3_22[2] = { 'e', 'n' }; +static const symbol s_3_23[3] = { 'b', 'e', 'n' }; +static const symbol s_3_24[7] = { 'k', 0xC3, 0xA9, 'p', 'p', 'e', 'n' }; +static const symbol s_3_25[2] = { 'o', 'n' }; +static const symbol s_3_26[3] = { 0xC3, 0xB6, 'n' }; +static const symbol s_3_27[5] = { 'k', 0xC3, 0xA9, 'p', 'p' }; +static const symbol s_3_28[3] = { 'k', 'o', 'r' }; +static const symbol s_3_29[1] = { 't' }; +static const symbol s_3_30[2] = { 'a', 't' }; +static const symbol s_3_31[2] = { 'e', 't' }; +static const symbol s_3_32[5] = { 'k', 0xC3, 0xA9, 'n', 't' }; +static const symbol s_3_33[7] = { 'a', 'n', 'k', 0xC3, 0xA9, 'n', 't' }; +static const symbol s_3_34[7] = { 'e', 'n', 'k', 0xC3, 0xA9, 'n', 't' }; +static const symbol s_3_35[7] = { 'o', 'n', 'k', 0xC3, 0xA9, 'n', 't' }; +static const symbol s_3_36[2] = { 'o', 't' }; +static const symbol s_3_37[4] = { 0xC3, 0xA9, 'r', 't' }; +static const symbol s_3_38[3] = { 0xC3, 0xB6, 't' }; +static const symbol s_3_39[3] = { 'h', 'e', 'z' }; +static const symbol s_3_40[3] = { 'h', 'o', 'z' }; +static const symbol s_3_41[4] = { 'h', 0xC3, 0xB6, 'z' }; +static const symbol s_3_42[3] = { 'v', 0xC3, 0xA1 }; +static const symbol s_3_43[3] = { 'v', 0xC3, 0xA9 }; +static const struct among a_3[44] = { +{ 2, s_3_0, 0, -1, 0}, +{ 2, s_3_1, 0, -1, 0}, +{ 2, s_3_2, 0, -1, 0}, +{ 2, s_3_3, 0, -1, 0}, +{ 2, s_3_4, 0, -1, 0}, +{ 3, s_3_5, 0, -1, 0}, +{ 3, s_3_6, 0, -1, 0}, +{ 3, s_3_7, 0, -1, 0}, +{ 3, s_3_8, 0, -1, 0}, +{ 2, s_3_9, 0, -1, 0}, +{ 4, s_3_10, 0, -1, 0}, +{ 4, s_3_11, 0, -1, 0}, +{ 4, s_3_12, 0, -1, 0}, +{ 4, s_3_13, 0, -1, 0}, +{ 4, s_3_14, 0, -1, 0}, +{ 4, s_3_15, 0, -1, 0}, +{ 4, s_3_16, 0, -1, 0}, +{ 4, s_3_17, 0, -1, 0}, +{ 3, s_3_18, 0, -1, 0}, +{ 1, s_3_19, 0, -1, 0}, +{ 2, s_3_20, -1, -1, 0}, +{ 3, s_3_21, -1, -1, 0}, +{ 2, s_3_22, -3, -1, 0}, +{ 3, s_3_23, -1, -1, 0}, +{ 7, s_3_24, -2, -1, 0}, +{ 2, s_3_25, -6, -1, 0}, +{ 3, s_3_26, -7, -1, 0}, +{ 5, s_3_27, 0, -1, 0}, +{ 3, s_3_28, 0, -1, 0}, +{ 1, s_3_29, 0, -1, 0}, +{ 2, s_3_30, -1, -1, 0}, +{ 2, s_3_31, -2, -1, 0}, +{ 5, s_3_32, -3, -1, 0}, +{ 7, s_3_33, -1, -1, 0}, +{ 7, s_3_34, -2, -1, 0}, +{ 7, s_3_35, -3, -1, 0}, +{ 2, s_3_36, -7, -1, 0}, +{ 4, s_3_37, -8, -1, 0}, +{ 3, s_3_38, -9, -1, 0}, +{ 3, s_3_39, 0, -1, 0}, +{ 3, s_3_40, 0, -1, 0}, +{ 4, s_3_41, 0, -1, 0}, +{ 3, s_3_42, 0, -1, 0}, +{ 3, s_3_43, 0, -1, 0} +}; + +static const symbol s_4_0[3] = { 0xC3, 0xA1, 'n' }; +static const symbol s_4_1[3] = { 0xC3, 0xA9, 'n' }; +static const symbol s_4_2[8] = { 0xC3, 0xA1, 'n', 'k', 0xC3, 0xA9, 'n', 't' }; +static const struct among a_4[3] = { +{ 3, s_4_0, 0, 2, 0}, +{ 3, s_4_1, 0, 1, 0}, +{ 8, s_4_2, 0, 2, 0} +}; + +static const symbol s_5_0[4] = { 's', 't', 'u', 'l' }; +static const symbol s_5_1[5] = { 'a', 's', 't', 'u', 'l' }; +static const symbol s_5_2[6] = { 0xC3, 0xA1, 's', 't', 'u', 'l' }; +static const symbol s_5_3[5] = { 's', 't', 0xC3, 0xBC, 'l' }; +static const symbol s_5_4[6] = { 'e', 's', 't', 0xC3, 0xBC, 'l' }; +static const symbol s_5_5[7] = { 0xC3, 0xA9, 's', 't', 0xC3, 0xBC, 'l' }; +static const struct among a_5[6] = { +{ 4, s_5_0, 0, 1, 0}, +{ 5, s_5_1, -1, 1, 0}, +{ 6, s_5_2, -2, 2, 0}, +{ 5, s_5_3, 0, 1, 0}, +{ 6, s_5_4, -1, 1, 0}, +{ 7, s_5_5, -2, 3, 0} +}; + +static const symbol s_6_0[2] = { 0xC3, 0xA1 }; +static const symbol s_6_1[2] = { 0xC3, 0xA9 }; +static const struct among a_6[2] = { +{ 2, s_6_0, 0, 1, 0}, +{ 2, s_6_1, 0, 1, 0} +}; + +static const symbol s_7_0[1] = { 'k' }; +static const symbol s_7_1[2] = { 'a', 'k' }; +static const symbol s_7_2[2] = { 'e', 'k' }; +static const symbol s_7_3[2] = { 'o', 'k' }; +static const symbol s_7_4[3] = { 0xC3, 0xA1, 'k' }; +static const symbol s_7_5[3] = { 0xC3, 0xA9, 'k' }; +static const symbol s_7_6[3] = { 0xC3, 0xB6, 'k' }; +static const struct among a_7[7] = { +{ 1, s_7_0, 0, 3, 0}, +{ 2, s_7_1, -1, 3, 0}, +{ 2, s_7_2, -2, 3, 0}, +{ 2, s_7_3, -3, 3, 0}, +{ 3, s_7_4, -4, 1, 0}, +{ 3, s_7_5, -5, 2, 0}, +{ 3, s_7_6, -6, 3, 0} +}; + +static const symbol s_8_0[3] = { 0xC3, 0xA9, 'i' }; +static const symbol s_8_1[5] = { 0xC3, 0xA1, 0xC3, 0xA9, 'i' }; +static const symbol s_8_2[5] = { 0xC3, 0xA9, 0xC3, 0xA9, 'i' }; +static const symbol s_8_3[2] = { 0xC3, 0xA9 }; +static const symbol s_8_4[3] = { 'k', 0xC3, 0xA9 }; +static const symbol s_8_5[4] = { 'a', 'k', 0xC3, 0xA9 }; +static const symbol s_8_6[4] = { 'e', 'k', 0xC3, 0xA9 }; +static const symbol s_8_7[4] = { 'o', 'k', 0xC3, 0xA9 }; +static const symbol s_8_8[5] = { 0xC3, 0xA1, 'k', 0xC3, 0xA9 }; +static const symbol s_8_9[5] = { 0xC3, 0xA9, 'k', 0xC3, 0xA9 }; +static const symbol s_8_10[5] = { 0xC3, 0xB6, 'k', 0xC3, 0xA9 }; +static const symbol s_8_11[4] = { 0xC3, 0xA9, 0xC3, 0xA9 }; +static const struct among a_8[12] = { +{ 3, s_8_0, 0, 1, 0}, +{ 5, s_8_1, -1, 3, 0}, +{ 5, s_8_2, -2, 2, 0}, +{ 2, s_8_3, 0, 1, 0}, +{ 3, s_8_4, -1, 1, 0}, +{ 4, s_8_5, -1, 1, 0}, +{ 4, s_8_6, -2, 1, 0}, +{ 4, s_8_7, -3, 1, 0}, +{ 5, s_8_8, -4, 3, 0}, +{ 5, s_8_9, -5, 2, 0}, +{ 5, s_8_10, -6, 1, 0}, +{ 4, s_8_11, -8, 2, 0} +}; + +static const symbol s_9_0[1] = { 'a' }; +static const symbol s_9_1[2] = { 'j', 'a' }; +static const symbol s_9_2[1] = { 'd' }; +static const symbol s_9_3[2] = { 'a', 'd' }; +static const symbol s_9_4[2] = { 'e', 'd' }; +static const symbol s_9_5[2] = { 'o', 'd' }; +static const symbol s_9_6[3] = { 0xC3, 0xA1, 'd' }; +static const symbol s_9_7[3] = { 0xC3, 0xA9, 'd' }; +static const symbol s_9_8[3] = { 0xC3, 0xB6, 'd' }; +static const symbol s_9_9[1] = { 'e' }; +static const symbol s_9_10[2] = { 'j', 'e' }; +static const symbol s_9_11[2] = { 'n', 'k' }; +static const symbol s_9_12[3] = { 'u', 'n', 'k' }; +static const symbol s_9_13[4] = { 0xC3, 0xA1, 'n', 'k' }; +static const symbol s_9_14[4] = { 0xC3, 0xA9, 'n', 'k' }; +static const symbol s_9_15[4] = { 0xC3, 0xBC, 'n', 'k' }; +static const symbol s_9_16[2] = { 'u', 'k' }; +static const symbol s_9_17[3] = { 'j', 'u', 'k' }; +static const symbol s_9_18[5] = { 0xC3, 0xA1, 'j', 'u', 'k' }; +static const symbol s_9_19[3] = { 0xC3, 0xBC, 'k' }; +static const symbol s_9_20[4] = { 'j', 0xC3, 0xBC, 'k' }; +static const symbol s_9_21[6] = { 0xC3, 0xA9, 'j', 0xC3, 0xBC, 'k' }; +static const symbol s_9_22[1] = { 'm' }; +static const symbol s_9_23[2] = { 'a', 'm' }; +static const symbol s_9_24[2] = { 'e', 'm' }; +static const symbol s_9_25[2] = { 'o', 'm' }; +static const symbol s_9_26[3] = { 0xC3, 0xA1, 'm' }; +static const symbol s_9_27[3] = { 0xC3, 0xA9, 'm' }; +static const symbol s_9_28[1] = { 'o' }; +static const symbol s_9_29[2] = { 0xC3, 0xA1 }; +static const symbol s_9_30[2] = { 0xC3, 0xA9 }; +static const struct among a_9[31] = { +{ 1, s_9_0, 0, 1, 0}, +{ 2, s_9_1, -1, 1, 0}, +{ 1, s_9_2, 0, 1, 0}, +{ 2, s_9_3, -1, 1, 0}, +{ 2, s_9_4, -2, 1, 0}, +{ 2, s_9_5, -3, 1, 0}, +{ 3, s_9_6, -4, 2, 0}, +{ 3, s_9_7, -5, 3, 0}, +{ 3, s_9_8, -6, 1, 0}, +{ 1, s_9_9, 0, 1, 0}, +{ 2, s_9_10, -1, 1, 0}, +{ 2, s_9_11, 0, 1, 0}, +{ 3, s_9_12, -1, 1, 0}, +{ 4, s_9_13, -2, 2, 0}, +{ 4, s_9_14, -3, 3, 0}, +{ 4, s_9_15, -4, 1, 0}, +{ 2, s_9_16, 0, 1, 0}, +{ 3, s_9_17, -1, 1, 0}, +{ 5, s_9_18, -1, 2, 0}, +{ 3, s_9_19, 0, 1, 0}, +{ 4, s_9_20, -1, 1, 0}, +{ 6, s_9_21, -1, 3, 0}, +{ 1, s_9_22, 0, 1, 0}, +{ 2, s_9_23, -1, 1, 0}, +{ 2, s_9_24, -2, 1, 0}, +{ 2, s_9_25, -3, 1, 0}, +{ 3, s_9_26, -4, 2, 0}, +{ 3, s_9_27, -5, 3, 0}, +{ 1, s_9_28, 0, 1, 0}, +{ 2, s_9_29, 0, 2, 0}, +{ 2, s_9_30, 0, 3, 0} +}; + +static const symbol s_10_0[2] = { 'i', 'd' }; +static const symbol s_10_1[3] = { 'a', 'i', 'd' }; +static const symbol s_10_2[4] = { 'j', 'a', 'i', 'd' }; +static const symbol s_10_3[3] = { 'e', 'i', 'd' }; +static const symbol s_10_4[4] = { 'j', 'e', 'i', 'd' }; +static const symbol s_10_5[4] = { 0xC3, 0xA1, 'i', 'd' }; +static const symbol s_10_6[4] = { 0xC3, 0xA9, 'i', 'd' }; +static const symbol s_10_7[1] = { 'i' }; +static const symbol s_10_8[2] = { 'a', 'i' }; +static const symbol s_10_9[3] = { 'j', 'a', 'i' }; +static const symbol s_10_10[2] = { 'e', 'i' }; +static const symbol s_10_11[3] = { 'j', 'e', 'i' }; +static const symbol s_10_12[3] = { 0xC3, 0xA1, 'i' }; +static const symbol s_10_13[3] = { 0xC3, 0xA9, 'i' }; +static const symbol s_10_14[4] = { 'i', 't', 'e', 'k' }; +static const symbol s_10_15[5] = { 'e', 'i', 't', 'e', 'k' }; +static const symbol s_10_16[6] = { 'j', 'e', 'i', 't', 'e', 'k' }; +static const symbol s_10_17[6] = { 0xC3, 0xA9, 'i', 't', 'e', 'k' }; +static const symbol s_10_18[2] = { 'i', 'k' }; +static const symbol s_10_19[3] = { 'a', 'i', 'k' }; +static const symbol s_10_20[4] = { 'j', 'a', 'i', 'k' }; +static const symbol s_10_21[3] = { 'e', 'i', 'k' }; +static const symbol s_10_22[4] = { 'j', 'e', 'i', 'k' }; +static const symbol s_10_23[4] = { 0xC3, 0xA1, 'i', 'k' }; +static const symbol s_10_24[4] = { 0xC3, 0xA9, 'i', 'k' }; +static const symbol s_10_25[3] = { 'i', 'n', 'k' }; +static const symbol s_10_26[4] = { 'a', 'i', 'n', 'k' }; +static const symbol s_10_27[5] = { 'j', 'a', 'i', 'n', 'k' }; +static const symbol s_10_28[4] = { 'e', 'i', 'n', 'k' }; +static const symbol s_10_29[5] = { 'j', 'e', 'i', 'n', 'k' }; +static const symbol s_10_30[5] = { 0xC3, 0xA1, 'i', 'n', 'k' }; +static const symbol s_10_31[5] = { 0xC3, 0xA9, 'i', 'n', 'k' }; +static const symbol s_10_32[5] = { 'a', 'i', 't', 'o', 'k' }; +static const symbol s_10_33[6] = { 'j', 'a', 'i', 't', 'o', 'k' }; +static const symbol s_10_34[6] = { 0xC3, 0xA1, 'i', 't', 'o', 'k' }; +static const symbol s_10_35[2] = { 'i', 'm' }; +static const symbol s_10_36[3] = { 'a', 'i', 'm' }; +static const symbol s_10_37[4] = { 'j', 'a', 'i', 'm' }; +static const symbol s_10_38[3] = { 'e', 'i', 'm' }; +static const symbol s_10_39[4] = { 'j', 'e', 'i', 'm' }; +static const symbol s_10_40[4] = { 0xC3, 0xA1, 'i', 'm' }; +static const symbol s_10_41[4] = { 0xC3, 0xA9, 'i', 'm' }; +static const struct among a_10[42] = { +{ 2, s_10_0, 0, 1, 0}, +{ 3, s_10_1, -1, 1, 0}, +{ 4, s_10_2, -1, 1, 0}, +{ 3, s_10_3, -3, 1, 0}, +{ 4, s_10_4, -1, 1, 0}, +{ 4, s_10_5, -5, 2, 0}, +{ 4, s_10_6, -6, 3, 0}, +{ 1, s_10_7, 0, 1, 0}, +{ 2, s_10_8, -1, 1, 0}, +{ 3, s_10_9, -1, 1, 0}, +{ 2, s_10_10, -3, 1, 0}, +{ 3, s_10_11, -1, 1, 0}, +{ 3, s_10_12, -5, 2, 0}, +{ 3, s_10_13, -6, 3, 0}, +{ 4, s_10_14, 0, 1, 0}, +{ 5, s_10_15, -1, 1, 0}, +{ 6, s_10_16, -1, 1, 0}, +{ 6, s_10_17, -3, 3, 0}, +{ 2, s_10_18, 0, 1, 0}, +{ 3, s_10_19, -1, 1, 0}, +{ 4, s_10_20, -1, 1, 0}, +{ 3, s_10_21, -3, 1, 0}, +{ 4, s_10_22, -1, 1, 0}, +{ 4, s_10_23, -5, 2, 0}, +{ 4, s_10_24, -6, 3, 0}, +{ 3, s_10_25, 0, 1, 0}, +{ 4, s_10_26, -1, 1, 0}, +{ 5, s_10_27, -1, 1, 0}, +{ 4, s_10_28, -3, 1, 0}, +{ 5, s_10_29, -1, 1, 0}, +{ 5, s_10_30, -5, 2, 0}, +{ 5, s_10_31, -6, 3, 0}, +{ 5, s_10_32, 0, 1, 0}, +{ 6, s_10_33, -1, 1, 0}, +{ 6, s_10_34, 0, 2, 0}, +{ 2, s_10_35, 0, 1, 0}, +{ 3, s_10_36, -1, 1, 0}, +{ 4, s_10_37, -1, 1, 0}, +{ 3, s_10_38, -3, 1, 0}, +{ 4, s_10_39, -1, 1, 0}, +{ 4, s_10_40, -5, 2, 0}, +{ 4, s_10_41, -6, 3, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 36, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'e' }; +static const symbol s_3[] = { 'a' }; +static const symbol s_4[] = { 'a' }; +static const symbol s_5[] = { 'e' }; +static const symbol s_6[] = { 'a' }; +static const symbol s_7[] = { 'e' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 'a' }; +static const symbol s_10[] = { 'a' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'a' }; +static const symbol s_13[] = { 'e' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { + int v_1 = z->c; + if (in_grouping_U(z, g_v, 97, 369, 0)) goto lab1; + { + int v_2 = z->c; + { + int ret = in_grouping_U(z, g_v, 97, 369, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + z->I[0] = z->c; + lab2: + z->c = v_2; + } + goto lab0; + lab1: + z->c = v_1; + { + int ret = out_grouping_U(z, g_v, 97, 369, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_v_ending(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 161 && z->p[z->c - 1] != 169)) return 0; + among_var = find_among_b(z, a_0, 2); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_double(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((106790108 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 23)) return 0; + z->c = z->l - v_1; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_instrum(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 108) return 0; + if (!find_among_b(z, a_2, 2)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_double(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_case(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_3, 44)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_v_ending(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_case_special(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 110 && z->p[z->c - 1] != 116)) return 0; + among_var = find_among_b(z, a_4, 3); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_case_other(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 108) return 0; + among_var = find_among_b(z, a_5, 6); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_factive(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 161 && z->p[z->c - 1] != 169)) return 0; + if (!find_among_b(z, a_6, 2)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = r_double(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_undouble(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_plural(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 107) return 0; + among_var = find_among_b(z, a_7, 7); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_owned(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 169)) return 0; + among_var = find_among_b(z, a_8, 12); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_sing_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_9, 31); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_plur_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((10768 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_10, 42); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_13); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int hungarian_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_instrum(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_case(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_case_special(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_case_other(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_factive(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_owned(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_sing_owner(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_plur_owner(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_plural(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * hungarian_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void hungarian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.h b/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.h new file mode 100644 index 000000000000..0978203ab92d --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_hungarian.h @@ -0,0 +1,15 @@ +/* Generated from hungarian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_UTF_8_create_env(void); +extern void hungarian_UTF_8_close_env(struct SN_env * z); + +extern int hungarian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.c b/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.c new file mode 100644 index 000000000000..93f540d96d5f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.c @@ -0,0 +1,426 @@ +/* Generated from indonesian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int indonesian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_VOWEL(struct SN_env * z); +static int r_SUFFIX_I_OK(struct SN_env * z); +static int r_SUFFIX_AN_OK(struct SN_env * z); +static int r_SUFFIX_KAN_OK(struct SN_env * z); +static int r_KER(struct SN_env * z); +static int r_remove_suffix(struct SN_env * z); +static int r_remove_second_order_prefix(struct SN_env * z); +static int r_remove_first_order_prefix(struct SN_env * z); +static int r_remove_possessive_pronoun(struct SN_env * z); +static int r_remove_particle(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * indonesian_UTF_8_create_env(void); +extern void indonesian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'k', 'a', 'h' }; +static const symbol s_0_1[3] = { 'l', 'a', 'h' }; +static const symbol s_0_2[3] = { 'p', 'u', 'n' }; +static const struct among a_0[3] = { +{ 3, s_0_0, 0, 1, 0}, +{ 3, s_0_1, 0, 1, 0}, +{ 3, s_0_2, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 'n', 'y', 'a' }; +static const symbol s_1_1[2] = { 'k', 'u' }; +static const symbol s_1_2[2] = { 'm', 'u' }; +static const struct among a_1[3] = { +{ 3, s_1_0, 0, 1, 0}, +{ 2, s_1_1, 0, 1, 0}, +{ 2, s_1_2, 0, 1, 0} +}; + +static const symbol s_2_0[1] = { 'i' }; +static const symbol s_2_1[2] = { 'a', 'n' }; +static const symbol s_2_2[3] = { 'k', 'a', 'n' }; +static const struct among a_2[3] = { +{ 1, s_2_0, 0, 1, r_SUFFIX_I_OK}, +{ 2, s_2_1, 0, 1, r_SUFFIX_AN_OK}, +{ 3, s_2_2, -1, 1, r_SUFFIX_KAN_OK} +}; + +static const symbol s_3_0[2] = { 'd', 'i' }; +static const symbol s_3_1[2] = { 'k', 'e' }; +static const symbol s_3_2[2] = { 'm', 'e' }; +static const symbol s_3_3[3] = { 'm', 'e', 'm' }; +static const symbol s_3_4[3] = { 'm', 'e', 'n' }; +static const symbol s_3_5[4] = { 'm', 'e', 'n', 'g' }; +static const symbol s_3_6[4] = { 'm', 'e', 'n', 'y' }; +static const symbol s_3_7[3] = { 'p', 'e', 'm' }; +static const symbol s_3_8[3] = { 'p', 'e', 'n' }; +static const symbol s_3_9[4] = { 'p', 'e', 'n', 'g' }; +static const symbol s_3_10[4] = { 'p', 'e', 'n', 'y' }; +static const symbol s_3_11[3] = { 't', 'e', 'r' }; +static const struct among a_3[12] = { +{ 2, s_3_0, 0, 1, 0}, +{ 2, s_3_1, 0, 2, 0}, +{ 2, s_3_2, 0, 1, 0}, +{ 3, s_3_3, -1, 5, 0}, +{ 3, s_3_4, -2, 1, 0}, +{ 4, s_3_5, -1, 1, 0}, +{ 4, s_3_6, -2, 3, r_VOWEL}, +{ 3, s_3_7, 0, 6, 0}, +{ 3, s_3_8, 0, 2, 0}, +{ 4, s_3_9, -1, 2, 0}, +{ 4, s_3_10, -2, 4, r_VOWEL}, +{ 3, s_3_11, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 'b', 'e' }; +static const symbol s_4_1[7] = { 'b', 'e', 'l', 'a', 'j', 'a', 'r' }; +static const symbol s_4_2[3] = { 'b', 'e', 'r' }; +static const symbol s_4_3[2] = { 'p', 'e' }; +static const symbol s_4_4[7] = { 'p', 'e', 'l', 'a', 'j', 'a', 'r' }; +static const symbol s_4_5[3] = { 'p', 'e', 'r' }; +static const struct among a_4[6] = { +{ 2, s_4_0, 0, 3, r_KER}, +{ 7, s_4_1, -1, 4, 0}, +{ 3, s_4_2, -2, 3, 0}, +{ 2, s_4_3, 0, 1, 0}, +{ 7, s_4_4, -1, 2, 0}, +{ 3, s_4_5, -2, 1, 0} +}; + +static const unsigned char g_vowel[] = { 17, 65, 16 }; + +static const symbol s_0[] = { 'e', 'r' }; +static const symbol s_1[] = { 's' }; +static const symbol s_2[] = { 's' }; +static const symbol s_3[] = { 'p' }; +static const symbol s_4[] = { 'p' }; +static const symbol s_5[] = { 'a', 'j', 'a', 'r' }; +static const symbol s_6[] = { 'a', 'j', 'a', 'r' }; + +static int r_remove_particle(struct SN_env * z) { + z->ket = z->c; + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 104 && z->p[z->c - 1] != 110)) return 0; + if (!find_among_b(z, a_0, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_remove_possessive_pronoun(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 117)) return 0; + if (!find_among_b(z, a_1, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_SUFFIX_KAN_OK(struct SN_env * z) { + if (z->I[0] == 3) return 0; + if (z->I[0] == 2) return 0; + return 1; +} + +static int r_SUFFIX_AN_OK(struct SN_env * z) { + return z->I[0] != 1; +} + +static int r_SUFFIX_I_OK(struct SN_env * z) { + if (z->I[0] > 2) return 0; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab0; + z->c--; + return 0; + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_remove_suffix(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 110)) return 0; + if (!find_among_b(z, a_2, 3)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] -= 1; + return 1; +} + +static int r_VOWEL(struct SN_env * z) { + if (in_grouping_U(z, g_vowel, 97, 117, 0)) return 0; + return 1; +} + +static int r_KER(struct SN_env * z) { + if (out_grouping_U(z, g_vowel, 97, 117, 0)) return 0; + if (!(eq_s(z, 2, s_0))) return 0; + return 1; +} + +static int r_remove_first_order_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 105 && z->p[z->c + 1] != 101)) return 0; + among_var = find_among(z, a_3, 12); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 1; + z->I[1] -= 1; + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 3; + z->I[1] -= 1; + break; + case 3: + z->I[0] = 1; + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 4: + z->I[0] = 3; + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 5: + z->I[0] = 1; + z->I[1] -= 1; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab1; + z->c = v_2; + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + } + goto lab0; + lab1: + z->c = v_1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + break; + case 6: + z->I[0] = 3; + z->I[1] -= 1; + { + int v_3 = z->c; + { + int v_4 = z->c; + if (in_grouping_U(z, g_vowel, 97, 117, 0)) goto lab3; + z->c = v_4; + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + } + goto lab2; + lab3: + z->c = v_3; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab2: + break; + } + return 1; +} + +static int r_remove_second_order_prefix(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] != 101) return 0; + among_var = find_among(z, a_4, 6); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 2; + z->I[1] -= 1; + break; + case 2: + { + int ret = slice_from_s(z, 4, s_5); + if (ret < 0) return ret; + } + z->I[1] -= 1; + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[0] = 4; + z->I[1] -= 1; + break; + case 4: + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + z->I[0] = 4; + z->I[1] -= 1; + break; + } + return 1; +} + +extern int indonesian_UTF_8_stem(struct SN_env * z) { + z->I[1] = 0; + { + int v_1 = z->c; + while (1) { + { + int ret = out_grouping_U(z, g_vowel, 97, 117, 1); + if (ret < 0) goto lab1; + z->c += ret; + } + z->I[1] += 1; + continue; + lab1: + break; + } + z->c = v_1; + } + if (z->I[1] <= 2) return 0; + z->I[0] = 0; + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_remove_particle(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + if (z->I[1] <= 2) return 0; + { + int v_3 = z->l - z->c; + { + int ret = r_remove_possessive_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + z->c = z->lb; + if (z->I[1] <= 2) return 0; + { + int v_4 = z->c; + { + int v_5 = z->c; + { + int ret = r_remove_first_order_prefix(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + { + int v_6 = z->c; + { + int v_7 = z->c; + if (z->I[1] <= 2) goto lab4; + z->lb = z->c; z->c = z->l; + { + int ret = r_remove_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + z->c = z->lb; + z->c = v_7; + } + if (z->I[1] <= 2) goto lab4; + { + int ret = r_remove_second_order_prefix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + lab4: + z->c = v_6; + } + z->c = v_5; + } + goto lab2; + lab3: + z->c = v_4; + { + int v_8 = z->c; + { + int ret = r_remove_second_order_prefix(z); + if (ret < 0) return ret; + } + z->c = v_8; + } + { + int v_9 = z->c; + if (z->I[1] <= 2) goto lab5; + z->lb = z->c; z->c = z->l; + { + int ret = r_remove_suffix(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + z->c = z->lb; + lab5: + z->c = v_9; + } + } +lab2: + return 1; +} + +extern struct SN_env * indonesian_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void indonesian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.h b/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.h new file mode 100644 index 000000000000..b7cfe890d647 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_indonesian.h @@ -0,0 +1,15 @@ +/* Generated from indonesian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_UTF_8_create_env(void); +extern void indonesian_UTF_8_close_env(struct SN_env * z); + +extern int indonesian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_irish.c b/contrib/libs/snowball/src_c/stem_UTF_8_irish.c new file mode 100644 index 000000000000..3c2e74a8277a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_irish.c @@ -0,0 +1,492 @@ +/* Generated from irish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int irish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_verb_sfx(struct SN_env * z); +static int r_deriv(struct SN_env * z); +static int r_noun_sfx(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_initial_morph(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * irish_UTF_8_create_env(void); +extern void irish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'b', '\'' }; +static const symbol s_0_1[2] = { 'b', 'h' }; +static const symbol s_0_2[3] = { 'b', 'h', 'f' }; +static const symbol s_0_3[2] = { 'b', 'p' }; +static const symbol s_0_4[2] = { 'c', 'h' }; +static const symbol s_0_5[2] = { 'd', '\'' }; +static const symbol s_0_6[4] = { 'd', '\'', 'f', 'h' }; +static const symbol s_0_7[2] = { 'd', 'h' }; +static const symbol s_0_8[2] = { 'd', 't' }; +static const symbol s_0_9[2] = { 'f', 'h' }; +static const symbol s_0_10[2] = { 'g', 'c' }; +static const symbol s_0_11[2] = { 'g', 'h' }; +static const symbol s_0_12[2] = { 'h', '-' }; +static const symbol s_0_13[2] = { 'm', '\'' }; +static const symbol s_0_14[2] = { 'm', 'b' }; +static const symbol s_0_15[2] = { 'm', 'h' }; +static const symbol s_0_16[2] = { 'n', '-' }; +static const symbol s_0_17[2] = { 'n', 'd' }; +static const symbol s_0_18[2] = { 'n', 'g' }; +static const symbol s_0_19[2] = { 'p', 'h' }; +static const symbol s_0_20[2] = { 's', 'h' }; +static const symbol s_0_21[2] = { 't', '-' }; +static const symbol s_0_22[2] = { 't', 'h' }; +static const symbol s_0_23[2] = { 't', 's' }; +static const struct among a_0[24] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 4, 0}, +{ 3, s_0_2, -1, 2, 0}, +{ 2, s_0_3, 0, 8, 0}, +{ 2, s_0_4, 0, 5, 0}, +{ 2, s_0_5, 0, 1, 0}, +{ 4, s_0_6, -1, 2, 0}, +{ 2, s_0_7, 0, 6, 0}, +{ 2, s_0_8, 0, 9, 0}, +{ 2, s_0_9, 0, 2, 0}, +{ 2, s_0_10, 0, 5, 0}, +{ 2, s_0_11, 0, 7, 0}, +{ 2, s_0_12, 0, 1, 0}, +{ 2, s_0_13, 0, 1, 0}, +{ 2, s_0_14, 0, 4, 0}, +{ 2, s_0_15, 0, 10, 0}, +{ 2, s_0_16, 0, 1, 0}, +{ 2, s_0_17, 0, 6, 0}, +{ 2, s_0_18, 0, 7, 0}, +{ 2, s_0_19, 0, 8, 0}, +{ 2, s_0_20, 0, 3, 0}, +{ 2, s_0_21, 0, 1, 0}, +{ 2, s_0_22, 0, 9, 0}, +{ 2, s_0_23, 0, 3, 0} +}; + +static const symbol s_1_0[7] = { 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_1_1[8] = { 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_1_2[3] = { 'i', 'r', 'e' }; +static const symbol s_1_3[4] = { 'a', 'i', 'r', 'e' }; +static const symbol s_1_4[3] = { 'a', 'b', 'h' }; +static const symbol s_1_5[4] = { 'e', 'a', 'b', 'h' }; +static const symbol s_1_6[3] = { 'i', 'b', 'h' }; +static const symbol s_1_7[4] = { 'a', 'i', 'b', 'h' }; +static const symbol s_1_8[3] = { 'a', 'm', 'h' }; +static const symbol s_1_9[4] = { 'e', 'a', 'm', 'h' }; +static const symbol s_1_10[3] = { 'i', 'm', 'h' }; +static const symbol s_1_11[4] = { 'a', 'i', 'm', 'h' }; +static const symbol s_1_12[6] = { 0xC3, 0xAD, 'o', 'c', 'h', 't' }; +static const symbol s_1_13[7] = { 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't' }; +static const symbol s_1_14[4] = { 'i', 'r', 0xC3, 0xAD }; +static const symbol s_1_15[5] = { 'a', 'i', 'r', 0xC3, 0xAD }; +static const struct among a_1[16] = { +{ 7, s_1_0, 0, 1, 0}, +{ 8, s_1_1, -1, 1, 0}, +{ 3, s_1_2, 0, 2, 0}, +{ 4, s_1_3, -1, 2, 0}, +{ 3, s_1_4, 0, 1, 0}, +{ 4, s_1_5, -1, 1, 0}, +{ 3, s_1_6, 0, 1, 0}, +{ 4, s_1_7, -1, 1, 0}, +{ 3, s_1_8, 0, 1, 0}, +{ 4, s_1_9, -1, 1, 0}, +{ 3, s_1_10, 0, 1, 0}, +{ 4, s_1_11, -1, 1, 0}, +{ 6, s_1_12, 0, 1, 0}, +{ 7, s_1_13, -1, 1, 0}, +{ 4, s_1_14, 0, 2, 0}, +{ 5, s_1_15, -1, 2, 0} +}; + +static const symbol s_2_0[9] = { 0xC3, 0xB3, 'i', 'd', 'e', 'a', 'c', 'h', 'a' }; +static const symbol s_2_1[7] = { 'p', 'a', 't', 'a', 'c', 'h', 'a' }; +static const symbol s_2_2[5] = { 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_3[8] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_4[6] = { 'e', 'a', 'c', 'h', 't', 'a' }; +static const symbol s_2_5[12] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' }; +static const symbol s_2_6[5] = { 'p', 'a', 'i', 't', 'e' }; +static const symbol s_2_7[3] = { 'a', 'c', 'h' }; +static const symbol s_2_8[4] = { 'e', 'a', 'c', 'h' }; +static const symbol s_2_9[8] = { 0xC3, 0xB3, 'i', 'd', 'e', 'a', 'c', 'h' }; +static const symbol s_2_10[7] = { 'g', 'i', 'n', 'e', 'a', 'c', 'h' }; +static const symbol s_2_11[6] = { 'p', 'a', 't', 'a', 'c', 'h' }; +static const symbol s_2_12[10] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h' }; +static const symbol s_2_13[7] = { 'p', 'a', 't', 'a', 'i', 'g', 'h' }; +static const symbol s_2_14[7] = { 0xC3, 0xB3, 'i', 'd', 'i', 'g', 'h' }; +static const symbol s_2_15[8] = { 'a', 'c', 'h', 't', 0xC3, 0xBA, 'i', 'l' }; +static const symbol s_2_16[9] = { 'e', 'a', 'c', 'h', 't', 0xC3, 0xBA, 'i', 'l' }; +static const symbol s_2_17[6] = { 'g', 'i', 'n', 'e', 'a', 's' }; +static const symbol s_2_18[5] = { 'g', 'i', 'n', 'i', 's' }; +static const symbol s_2_19[4] = { 'a', 'c', 'h', 't' }; +static const symbol s_2_20[7] = { 'a', 'r', 'c', 'a', 'c', 'h', 't' }; +static const symbol s_2_21[5] = { 'e', 'a', 'c', 'h', 't' }; +static const symbol s_2_22[11] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't' }; +static const symbol s_2_23[10] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a', 0xC3, 0xAD }; +static const symbol s_2_24[14] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a', 0xC3, 0xAD }; +static const struct among a_2[25] = { +{ 9, s_2_0, 0, 6, 0}, +{ 7, s_2_1, 0, 5, 0}, +{ 5, s_2_2, 0, 1, 0}, +{ 8, s_2_3, -1, 2, 0}, +{ 6, s_2_4, -2, 1, 0}, +{ 12, s_2_5, 0, 4, 0}, +{ 5, s_2_6, 0, 5, 0}, +{ 3, s_2_7, 0, 1, 0}, +{ 4, s_2_8, -1, 1, 0}, +{ 8, s_2_9, -1, 6, 0}, +{ 7, s_2_10, -2, 3, 0}, +{ 6, s_2_11, -4, 5, 0}, +{ 10, s_2_12, 0, 4, 0}, +{ 7, s_2_13, 0, 5, 0}, +{ 7, s_2_14, 0, 6, 0}, +{ 8, s_2_15, 0, 1, 0}, +{ 9, s_2_16, -1, 1, 0}, +{ 6, s_2_17, 0, 3, 0}, +{ 5, s_2_18, 0, 3, 0}, +{ 4, s_2_19, 0, 1, 0}, +{ 7, s_2_20, -1, 2, 0}, +{ 5, s_2_21, -2, 1, 0}, +{ 11, s_2_22, 0, 4, 0}, +{ 10, s_2_23, 0, 2, 0}, +{ 14, s_2_24, 0, 4, 0} +}; + +static const symbol s_3_0[4] = { 'i', 'm', 'i', 'd' }; +static const symbol s_3_1[5] = { 'a', 'i', 'm', 'i', 'd' }; +static const symbol s_3_2[5] = { 0xC3, 0xAD, 'm', 'i', 'd' }; +static const symbol s_3_3[6] = { 'a', 0xC3, 0xAD, 'm', 'i', 'd' }; +static const symbol s_3_4[3] = { 'a', 'd', 'h' }; +static const symbol s_3_5[4] = { 'e', 'a', 'd', 'h' }; +static const symbol s_3_6[5] = { 'f', 'a', 'i', 'd', 'h' }; +static const symbol s_3_7[4] = { 'f', 'i', 'd', 'h' }; +static const symbol s_3_8[4] = { 0xC3, 0xA1, 'i', 'l' }; +static const symbol s_3_9[3] = { 'a', 'i', 'n' }; +static const symbol s_3_10[4] = { 't', 'e', 'a', 'r' }; +static const symbol s_3_11[3] = { 't', 'a', 'r' }; +static const struct among a_3[12] = { +{ 4, s_3_0, 0, 1, 0}, +{ 5, s_3_1, -1, 1, 0}, +{ 5, s_3_2, 0, 1, 0}, +{ 6, s_3_3, -1, 1, 0}, +{ 3, s_3_4, 0, 2, 0}, +{ 4, s_3_5, -1, 2, 0}, +{ 5, s_3_6, 0, 1, 0}, +{ 4, s_3_7, 0, 1, 0}, +{ 4, s_3_8, 0, 2, 0}, +{ 3, s_3_9, 0, 2, 0}, +{ 4, s_3_10, 0, 2, 0}, +{ 3, s_3_11, 0, 2, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 2 }; + +static const symbol s_0[] = { 'f' }; +static const symbol s_1[] = { 's' }; +static const symbol s_2[] = { 'b' }; +static const symbol s_3[] = { 'c' }; +static const symbol s_4[] = { 'd' }; +static const symbol s_5[] = { 'g' }; +static const symbol s_6[] = { 'p' }; +static const symbol s_7[] = { 't' }; +static const symbol s_8[] = { 'm' }; +static const symbol s_9[] = { 'a', 'r', 'c' }; +static const symbol s_10[] = { 'g', 'i', 'n' }; +static const symbol s_11[] = { 'g', 'r', 'a', 'f' }; +static const symbol s_12[] = { 'p', 'a', 'i', 't', 'e' }; +static const symbol s_13[] = { 0xC3, 0xB3, 'i', 'd' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[2] = z->c; + { + int ret = in_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_initial_morph(struct SN_env * z) { + int among_var; + z->bra = z->c; + among_var = find_among(z, a_0, 24); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_noun_sfx(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_1, 16); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_deriv(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_2, 25); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_9); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_10); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_11); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_12); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_sfx(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((282896 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 12); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int irish_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_initial_morph(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_noun_sfx(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_deriv(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_verb_sfx(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * irish_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void irish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_irish.h b/contrib/libs/snowball/src_c/stem_UTF_8_irish.h new file mode 100644 index 000000000000..3260a9c5e8bc --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_irish.h @@ -0,0 +1,15 @@ +/* Generated from irish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_UTF_8_create_env(void); +extern void irish_UTF_8_close_env(struct SN_env * z); + +extern int irish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_italian.c b/contrib/libs/snowball/src_c/stem_UTF_8_italian.c new file mode 100644 index 000000000000..64c43ce397ca --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_italian.c @@ -0,0 +1,1093 @@ +/* Generated from italian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int italian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_vowel_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * italian_UTF_8_create_env(void); +extern void italian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 'q', 'u' }; +static const symbol s_0_2[2] = { 0xC3, 0xA1 }; +static const symbol s_0_3[2] = { 0xC3, 0xA9 }; +static const symbol s_0_4[2] = { 0xC3, 0xAD }; +static const symbol s_0_5[2] = { 0xC3, 0xB3 }; +static const symbol s_0_6[2] = { 0xC3, 0xBA }; +static const struct among a_0[7] = { +{ 0, 0, 0, 7, 0}, +{ 2, s_0_1, -1, 6, 0}, +{ 2, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, 2, 0}, +{ 2, s_0_4, -4, 3, 0}, +{ 2, s_0_5, -5, 4, 0}, +{ 2, s_0_6, -6, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'U' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_1_1, -1, 1, 0}, +{ 1, s_1_2, -2, 2, 0} +}; + +static const symbol s_2_0[2] = { 'l', 'a' }; +static const symbol s_2_1[4] = { 'c', 'e', 'l', 'a' }; +static const symbol s_2_2[6] = { 'g', 'l', 'i', 'e', 'l', 'a' }; +static const symbol s_2_3[4] = { 'm', 'e', 'l', 'a' }; +static const symbol s_2_4[4] = { 't', 'e', 'l', 'a' }; +static const symbol s_2_5[4] = { 'v', 'e', 'l', 'a' }; +static const symbol s_2_6[2] = { 'l', 'e' }; +static const symbol s_2_7[4] = { 'c', 'e', 'l', 'e' }; +static const symbol s_2_8[6] = { 'g', 'l', 'i', 'e', 'l', 'e' }; +static const symbol s_2_9[4] = { 'm', 'e', 'l', 'e' }; +static const symbol s_2_10[4] = { 't', 'e', 'l', 'e' }; +static const symbol s_2_11[4] = { 'v', 'e', 'l', 'e' }; +static const symbol s_2_12[2] = { 'n', 'e' }; +static const symbol s_2_13[4] = { 'c', 'e', 'n', 'e' }; +static const symbol s_2_14[6] = { 'g', 'l', 'i', 'e', 'n', 'e' }; +static const symbol s_2_15[4] = { 'm', 'e', 'n', 'e' }; +static const symbol s_2_16[4] = { 's', 'e', 'n', 'e' }; +static const symbol s_2_17[4] = { 't', 'e', 'n', 'e' }; +static const symbol s_2_18[4] = { 'v', 'e', 'n', 'e' }; +static const symbol s_2_19[2] = { 'c', 'i' }; +static const symbol s_2_20[2] = { 'l', 'i' }; +static const symbol s_2_21[4] = { 'c', 'e', 'l', 'i' }; +static const symbol s_2_22[6] = { 'g', 'l', 'i', 'e', 'l', 'i' }; +static const symbol s_2_23[4] = { 'm', 'e', 'l', 'i' }; +static const symbol s_2_24[4] = { 't', 'e', 'l', 'i' }; +static const symbol s_2_25[4] = { 'v', 'e', 'l', 'i' }; +static const symbol s_2_26[3] = { 'g', 'l', 'i' }; +static const symbol s_2_27[2] = { 'm', 'i' }; +static const symbol s_2_28[2] = { 's', 'i' }; +static const symbol s_2_29[2] = { 't', 'i' }; +static const symbol s_2_30[2] = { 'v', 'i' }; +static const symbol s_2_31[2] = { 'l', 'o' }; +static const symbol s_2_32[4] = { 'c', 'e', 'l', 'o' }; +static const symbol s_2_33[6] = { 'g', 'l', 'i', 'e', 'l', 'o' }; +static const symbol s_2_34[4] = { 'm', 'e', 'l', 'o' }; +static const symbol s_2_35[4] = { 't', 'e', 'l', 'o' }; +static const symbol s_2_36[4] = { 'v', 'e', 'l', 'o' }; +static const struct among a_2[37] = { +{ 2, s_2_0, 0, -1, 0}, +{ 4, s_2_1, -1, -1, 0}, +{ 6, s_2_2, -2, -1, 0}, +{ 4, s_2_3, -3, -1, 0}, +{ 4, s_2_4, -4, -1, 0}, +{ 4, s_2_5, -5, -1, 0}, +{ 2, s_2_6, 0, -1, 0}, +{ 4, s_2_7, -1, -1, 0}, +{ 6, s_2_8, -2, -1, 0}, +{ 4, s_2_9, -3, -1, 0}, +{ 4, s_2_10, -4, -1, 0}, +{ 4, s_2_11, -5, -1, 0}, +{ 2, s_2_12, 0, -1, 0}, +{ 4, s_2_13, -1, -1, 0}, +{ 6, s_2_14, -2, -1, 0}, +{ 4, s_2_15, -3, -1, 0}, +{ 4, s_2_16, -4, -1, 0}, +{ 4, s_2_17, -5, -1, 0}, +{ 4, s_2_18, -6, -1, 0}, +{ 2, s_2_19, 0, -1, 0}, +{ 2, s_2_20, 0, -1, 0}, +{ 4, s_2_21, -1, -1, 0}, +{ 6, s_2_22, -2, -1, 0}, +{ 4, s_2_23, -3, -1, 0}, +{ 4, s_2_24, -4, -1, 0}, +{ 4, s_2_25, -5, -1, 0}, +{ 3, s_2_26, -6, -1, 0}, +{ 2, s_2_27, 0, -1, 0}, +{ 2, s_2_28, 0, -1, 0}, +{ 2, s_2_29, 0, -1, 0}, +{ 2, s_2_30, 0, -1, 0}, +{ 2, s_2_31, 0, -1, 0}, +{ 4, s_2_32, -1, -1, 0}, +{ 6, s_2_33, -2, -1, 0}, +{ 4, s_2_34, -3, -1, 0}, +{ 4, s_2_35, -4, -1, 0}, +{ 4, s_2_36, -5, -1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_3_1[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_3_2[2] = { 'a', 'r' }; +static const symbol s_3_3[2] = { 'e', 'r' }; +static const symbol s_3_4[2] = { 'i', 'r' }; +static const struct among a_3[5] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 2, s_3_2, 0, 2, 0}, +{ 2, s_3_3, 0, 2, 0}, +{ 2, s_3_4, 0, 2, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'o', 's' }; +static const symbol s_4_3[2] = { 'i', 'v' }; +static const struct among a_4[4] = { +{ 2, s_4_0, 0, -1, 0}, +{ 4, s_4_1, 0, -1, 0}, +{ 2, s_4_2, 0, -1, 0}, +{ 2, s_4_3, 0, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_5_2[2] = { 'i', 'v' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 2, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'i', 'c', 'a' }; +static const symbol s_6_1[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_6_2[3] = { 'o', 's', 'a' }; +static const symbol s_6_3[4] = { 'i', 's', 't', 'a' }; +static const symbol s_6_4[3] = { 'i', 'v', 'a' }; +static const symbol s_6_5[4] = { 'a', 'n', 'z', 'a' }; +static const symbol s_6_6[4] = { 'e', 'n', 'z', 'a' }; +static const symbol s_6_7[3] = { 'i', 'c', 'e' }; +static const symbol s_6_8[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_6_9[4] = { 'i', 'c', 'h', 'e' }; +static const symbol s_6_10[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_6_11[5] = { 'a', 'b', 'i', 'l', 'e' }; +static const symbol s_6_12[5] = { 'i', 'b', 'i', 'l', 'e' }; +static const symbol s_6_13[6] = { 'u', 's', 'i', 'o', 'n', 'e' }; +static const symbol s_6_14[6] = { 'a', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_15[6] = { 'u', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_16[5] = { 'a', 't', 'o', 'r', 'e' }; +static const symbol s_6_17[3] = { 'o', 's', 'e' }; +static const symbol s_6_18[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_19[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_20[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_21[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_22[3] = { 'i', 'v', 'e' }; +static const symbol s_6_23[4] = { 'a', 'n', 'z', 'e' }; +static const symbol s_6_24[4] = { 'e', 'n', 'z', 'e' }; +static const symbol s_6_25[3] = { 'i', 'c', 'i' }; +static const symbol s_6_26[6] = { 'a', 't', 'r', 'i', 'c', 'i' }; +static const symbol s_6_27[4] = { 'i', 'c', 'h', 'i' }; +static const symbol s_6_28[5] = { 'a', 'b', 'i', 'l', 'i' }; +static const symbol s_6_29[5] = { 'i', 'b', 'i', 'l', 'i' }; +static const symbol s_6_30[4] = { 'i', 's', 'm', 'i' }; +static const symbol s_6_31[6] = { 'u', 's', 'i', 'o', 'n', 'i' }; +static const symbol s_6_32[6] = { 'a', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_33[6] = { 'u', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_34[5] = { 'a', 't', 'o', 'r', 'i' }; +static const symbol s_6_35[3] = { 'o', 's', 'i' }; +static const symbol s_6_36[4] = { 'a', 'n', 't', 'i' }; +static const symbol s_6_37[6] = { 'a', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_38[6] = { 'i', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_39[4] = { 'i', 's', 't', 'i' }; +static const symbol s_6_40[3] = { 'i', 'v', 'i' }; +static const symbol s_6_41[3] = { 'i', 'c', 'o' }; +static const symbol s_6_42[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_6_43[3] = { 'o', 's', 'o' }; +static const symbol s_6_44[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_45[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_46[3] = { 'i', 'v', 'o' }; +static const symbol s_6_47[4] = { 'i', 't', 0xC3, 0xA0 }; +static const symbol s_6_48[5] = { 'i', 's', 't', 0xC3, 0xA0 }; +static const symbol s_6_49[5] = { 'i', 's', 't', 0xC3, 0xA8 }; +static const symbol s_6_50[5] = { 'i', 's', 't', 0xC3, 0xAC }; +static const struct among a_6[51] = { +{ 3, s_6_0, 0, 1, 0}, +{ 5, s_6_1, 0, 3, 0}, +{ 3, s_6_2, 0, 1, 0}, +{ 4, s_6_3, 0, 1, 0}, +{ 3, s_6_4, 0, 9, 0}, +{ 4, s_6_5, 0, 1, 0}, +{ 4, s_6_6, 0, 5, 0}, +{ 3, s_6_7, 0, 1, 0}, +{ 6, s_6_8, -1, 1, 0}, +{ 4, s_6_9, 0, 1, 0}, +{ 5, s_6_10, 0, 3, 0}, +{ 5, s_6_11, 0, 1, 0}, +{ 5, s_6_12, 0, 1, 0}, +{ 6, s_6_13, 0, 4, 0}, +{ 6, s_6_14, 0, 2, 0}, +{ 6, s_6_15, 0, 4, 0}, +{ 5, s_6_16, 0, 2, 0}, +{ 3, s_6_17, 0, 1, 0}, +{ 4, s_6_18, 0, 1, 0}, +{ 5, s_6_19, 0, 1, 0}, +{ 6, s_6_20, -1, 7, 0}, +{ 4, s_6_21, 0, 1, 0}, +{ 3, s_6_22, 0, 9, 0}, +{ 4, s_6_23, 0, 1, 0}, +{ 4, s_6_24, 0, 5, 0}, +{ 3, s_6_25, 0, 1, 0}, +{ 6, s_6_26, -1, 1, 0}, +{ 4, s_6_27, 0, 1, 0}, +{ 5, s_6_28, 0, 1, 0}, +{ 5, s_6_29, 0, 1, 0}, +{ 4, s_6_30, 0, 1, 0}, +{ 6, s_6_31, 0, 4, 0}, +{ 6, s_6_32, 0, 2, 0}, +{ 6, s_6_33, 0, 4, 0}, +{ 5, s_6_34, 0, 2, 0}, +{ 3, s_6_35, 0, 1, 0}, +{ 4, s_6_36, 0, 1, 0}, +{ 6, s_6_37, 0, 6, 0}, +{ 6, s_6_38, 0, 6, 0}, +{ 4, s_6_39, 0, 1, 0}, +{ 3, s_6_40, 0, 9, 0}, +{ 3, s_6_41, 0, 1, 0}, +{ 4, s_6_42, 0, 1, 0}, +{ 3, s_6_43, 0, 1, 0}, +{ 6, s_6_44, 0, 6, 0}, +{ 6, s_6_45, 0, 6, 0}, +{ 3, s_6_46, 0, 9, 0}, +{ 4, s_6_47, 0, 8, 0}, +{ 5, s_6_48, 0, 1, 0}, +{ 5, s_6_49, 0, 1, 0}, +{ 5, s_6_50, 0, 1, 0} +}; + +static const symbol s_7_0[4] = { 'i', 's', 'c', 'a' }; +static const symbol s_7_1[4] = { 'e', 'n', 'd', 'a' }; +static const symbol s_7_2[3] = { 'a', 't', 'a' }; +static const symbol s_7_3[3] = { 'i', 't', 'a' }; +static const symbol s_7_4[3] = { 'u', 't', 'a' }; +static const symbol s_7_5[3] = { 'a', 'v', 'a' }; +static const symbol s_7_6[3] = { 'e', 'v', 'a' }; +static const symbol s_7_7[3] = { 'i', 'v', 'a' }; +static const symbol s_7_8[6] = { 'e', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_9[6] = { 'i', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_10[4] = { 'i', 's', 'c', 'e' }; +static const symbol s_7_11[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_7_12[3] = { 'a', 'r', 'e' }; +static const symbol s_7_13[3] = { 'e', 'r', 'e' }; +static const symbol s_7_14[3] = { 'i', 'r', 'e' }; +static const symbol s_7_15[4] = { 'a', 's', 's', 'e' }; +static const symbol s_7_16[3] = { 'a', 't', 'e' }; +static const symbol s_7_17[5] = { 'a', 'v', 'a', 't', 'e' }; +static const symbol s_7_18[5] = { 'e', 'v', 'a', 't', 'e' }; +static const symbol s_7_19[5] = { 'i', 'v', 'a', 't', 'e' }; +static const symbol s_7_20[3] = { 'e', 't', 'e' }; +static const symbol s_7_21[5] = { 'e', 'r', 'e', 't', 'e' }; +static const symbol s_7_22[5] = { 'i', 'r', 'e', 't', 'e' }; +static const symbol s_7_23[3] = { 'i', 't', 'e' }; +static const symbol s_7_24[6] = { 'e', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_25[6] = { 'i', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_26[3] = { 'u', 't', 'e' }; +static const symbol s_7_27[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_7_28[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_7_29[4] = { 'i', 's', 'c', 'i' }; +static const symbol s_7_30[4] = { 'e', 'n', 'd', 'i' }; +static const symbol s_7_31[4] = { 'e', 'r', 'e', 'i' }; +static const symbol s_7_32[4] = { 'i', 'r', 'e', 'i' }; +static const symbol s_7_33[4] = { 'a', 's', 's', 'i' }; +static const symbol s_7_34[3] = { 'a', 't', 'i' }; +static const symbol s_7_35[3] = { 'i', 't', 'i' }; +static const symbol s_7_36[6] = { 'e', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_37[6] = { 'i', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_38[3] = { 'u', 't', 'i' }; +static const symbol s_7_39[3] = { 'a', 'v', 'i' }; +static const symbol s_7_40[3] = { 'e', 'v', 'i' }; +static const symbol s_7_41[3] = { 'i', 'v', 'i' }; +static const symbol s_7_42[4] = { 'i', 's', 'c', 'o' }; +static const symbol s_7_43[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_7_44[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_7_45[4] = { 'Y', 'a', 'm', 'o' }; +static const symbol s_7_46[4] = { 'i', 'a', 'm', 'o' }; +static const symbol s_7_47[5] = { 'a', 'v', 'a', 'm', 'o' }; +static const symbol s_7_48[5] = { 'e', 'v', 'a', 'm', 'o' }; +static const symbol s_7_49[5] = { 'i', 'v', 'a', 'm', 'o' }; +static const symbol s_7_50[5] = { 'e', 'r', 'e', 'm', 'o' }; +static const symbol s_7_51[5] = { 'i', 'r', 'e', 'm', 'o' }; +static const symbol s_7_52[6] = { 'a', 's', 's', 'i', 'm', 'o' }; +static const symbol s_7_53[4] = { 'a', 'm', 'm', 'o' }; +static const symbol s_7_54[4] = { 'e', 'm', 'm', 'o' }; +static const symbol s_7_55[6] = { 'e', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_56[6] = { 'i', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_57[4] = { 'i', 'm', 'm', 'o' }; +static const symbol s_7_58[3] = { 'a', 'n', 'o' }; +static const symbol s_7_59[6] = { 'i', 's', 'c', 'a', 'n', 'o' }; +static const symbol s_7_60[5] = { 'a', 'v', 'a', 'n', 'o' }; +static const symbol s_7_61[5] = { 'e', 'v', 'a', 'n', 'o' }; +static const symbol s_7_62[5] = { 'i', 'v', 'a', 'n', 'o' }; +static const symbol s_7_63[6] = { 'e', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_64[6] = { 'i', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_65[3] = { 'o', 'n', 'o' }; +static const symbol s_7_66[6] = { 'i', 's', 'c', 'o', 'n', 'o' }; +static const symbol s_7_67[5] = { 'a', 'r', 'o', 'n', 'o' }; +static const symbol s_7_68[5] = { 'e', 'r', 'o', 'n', 'o' }; +static const symbol s_7_69[5] = { 'i', 'r', 'o', 'n', 'o' }; +static const symbol s_7_70[8] = { 'e', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_71[8] = { 'i', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_72[6] = { 'a', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_73[6] = { 'e', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_74[6] = { 'i', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_75[3] = { 'a', 't', 'o' }; +static const symbol s_7_76[3] = { 'i', 't', 'o' }; +static const symbol s_7_77[3] = { 'u', 't', 'o' }; +static const symbol s_7_78[3] = { 'a', 'v', 'o' }; +static const symbol s_7_79[3] = { 'e', 'v', 'o' }; +static const symbol s_7_80[3] = { 'i', 'v', 'o' }; +static const symbol s_7_81[2] = { 'a', 'r' }; +static const symbol s_7_82[2] = { 'i', 'r' }; +static const symbol s_7_83[4] = { 'e', 'r', 0xC3, 0xA0 }; +static const symbol s_7_84[4] = { 'i', 'r', 0xC3, 0xA0 }; +static const symbol s_7_85[4] = { 'e', 'r', 0xC3, 0xB2 }; +static const symbol s_7_86[4] = { 'i', 'r', 0xC3, 0xB2 }; +static const struct among a_7[87] = { +{ 4, s_7_0, 0, 1, 0}, +{ 4, s_7_1, 0, 1, 0}, +{ 3, s_7_2, 0, 1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 3, s_7_4, 0, 1, 0}, +{ 3, s_7_5, 0, 1, 0}, +{ 3, s_7_6, 0, 1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 6, s_7_8, 0, 1, 0}, +{ 6, s_7_9, 0, 1, 0}, +{ 4, s_7_10, 0, 1, 0}, +{ 4, s_7_11, 0, 1, 0}, +{ 3, s_7_12, 0, 1, 0}, +{ 3, s_7_13, 0, 1, 0}, +{ 3, s_7_14, 0, 1, 0}, +{ 4, s_7_15, 0, 1, 0}, +{ 3, s_7_16, 0, 1, 0}, +{ 5, s_7_17, -1, 1, 0}, +{ 5, s_7_18, -2, 1, 0}, +{ 5, s_7_19, -3, 1, 0}, +{ 3, s_7_20, 0, 1, 0}, +{ 5, s_7_21, -1, 1, 0}, +{ 5, s_7_22, -2, 1, 0}, +{ 3, s_7_23, 0, 1, 0}, +{ 6, s_7_24, 0, 1, 0}, +{ 6, s_7_25, 0, 1, 0}, +{ 3, s_7_26, 0, 1, 0}, +{ 4, s_7_27, 0, 1, 0}, +{ 4, s_7_28, 0, 1, 0}, +{ 4, s_7_29, 0, 1, 0}, +{ 4, s_7_30, 0, 1, 0}, +{ 4, s_7_31, 0, 1, 0}, +{ 4, s_7_32, 0, 1, 0}, +{ 4, s_7_33, 0, 1, 0}, +{ 3, s_7_34, 0, 1, 0}, +{ 3, s_7_35, 0, 1, 0}, +{ 6, s_7_36, 0, 1, 0}, +{ 6, s_7_37, 0, 1, 0}, +{ 3, s_7_38, 0, 1, 0}, +{ 3, s_7_39, 0, 1, 0}, +{ 3, s_7_40, 0, 1, 0}, +{ 3, s_7_41, 0, 1, 0}, +{ 4, s_7_42, 0, 1, 0}, +{ 4, s_7_43, 0, 1, 0}, +{ 4, s_7_44, 0, 1, 0}, +{ 4, s_7_45, 0, 1, 0}, +{ 4, s_7_46, 0, 1, 0}, +{ 5, s_7_47, 0, 1, 0}, +{ 5, s_7_48, 0, 1, 0}, +{ 5, s_7_49, 0, 1, 0}, +{ 5, s_7_50, 0, 1, 0}, +{ 5, s_7_51, 0, 1, 0}, +{ 6, s_7_52, 0, 1, 0}, +{ 4, s_7_53, 0, 1, 0}, +{ 4, s_7_54, 0, 1, 0}, +{ 6, s_7_55, -1, 1, 0}, +{ 6, s_7_56, -2, 1, 0}, +{ 4, s_7_57, 0, 1, 0}, +{ 3, s_7_58, 0, 1, 0}, +{ 6, s_7_59, -1, 1, 0}, +{ 5, s_7_60, -2, 1, 0}, +{ 5, s_7_61, -3, 1, 0}, +{ 5, s_7_62, -4, 1, 0}, +{ 6, s_7_63, 0, 1, 0}, +{ 6, s_7_64, 0, 1, 0}, +{ 3, s_7_65, 0, 1, 0}, +{ 6, s_7_66, -1, 1, 0}, +{ 5, s_7_67, -2, 1, 0}, +{ 5, s_7_68, -3, 1, 0}, +{ 5, s_7_69, -4, 1, 0}, +{ 8, s_7_70, 0, 1, 0}, +{ 8, s_7_71, 0, 1, 0}, +{ 6, s_7_72, 0, 1, 0}, +{ 6, s_7_73, 0, 1, 0}, +{ 6, s_7_74, 0, 1, 0}, +{ 3, s_7_75, 0, 1, 0}, +{ 3, s_7_76, 0, 1, 0}, +{ 3, s_7_77, 0, 1, 0}, +{ 3, s_7_78, 0, 1, 0}, +{ 3, s_7_79, 0, 1, 0}, +{ 3, s_7_80, 0, 1, 0}, +{ 2, s_7_81, 0, 1, 0}, +{ 2, s_7_82, 0, 1, 0}, +{ 4, s_7_83, 0, 1, 0}, +{ 4, s_7_84, 0, 1, 0}, +{ 4, s_7_85, 0, 1, 0}, +{ 4, s_7_86, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2, 1 }; + +static const unsigned char g_AEIO[] = { 17, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2 }; + +static const unsigned char g_CG[] = { 17 }; + +static const symbol s_0[] = { 0xC3, 0xA0 }; +static const symbol s_1[] = { 0xC3, 0xA8 }; +static const symbol s_2[] = { 0xC3, 0xAC }; +static const symbol s_3[] = { 0xC3, 0xB2 }; +static const symbol s_4[] = { 0xC3, 0xB9 }; +static const symbol s_5[] = { 'q', 'U' }; +static const symbol s_6[] = { 'U' }; +static const symbol s_7[] = { 'I' }; +static const symbol s_8[] = { 'd', 'i', 'v', 'a', 'n' }; +static const symbol s_9[] = { 'i' }; +static const symbol s_10[] = { 'u' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'i', 'c' }; +static const symbol s_13[] = { 'l', 'o', 'g' }; +static const symbol s_14[] = { 'u' }; +static const symbol s_15[] = { 'e', 'n', 't', 'e' }; +static const symbol s_16[] = { 'a', 't' }; +static const symbol s_17[] = { 'a', 't' }; +static const symbol s_18[] = { 'i', 'c' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 7); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_2; + break; + } + z->c = v_1; + } + while (1) { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab2; + z->bra = z->c; + { + int v_5 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab4; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab4; + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = v_5; + if (z->c == z->l || z->p[z->c] != 'i') goto lab2; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab2; + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + } + lab3: + z->c = v_4; + break; + lab2: + z->c = v_4; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + continue; + lab1: + z->c = v_3; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping_U(z, g_v, 97, 249, 0)) goto lab4; + { + int ret = out_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab2; + { + int ret = in_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (!(eq_s(z, 5, s_8))) goto lab5; + goto lab1; + lab5: + z->c = v_2; + if (out_grouping_U(z, g_v, 97, 249, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping_U(z, g_v, 97, 249, 0)) goto lab7; + { + int ret = out_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + goto lab6; + lab7: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 249, 0)) goto lab0; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + lab6: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 249, 1); + if (ret < 0) goto lab8; + z->c += ret; + } + z->I[0] = z->c; + lab8: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 85)) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33314 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_2, 37)) return 0; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 111 && z->p[z->c - 1] != 114)) return 0; + among_var = find_among_b(z, a_3, 5); + if (!among_var) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_6, 51); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_12))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_13); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_14); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_15); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4722696 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_2; goto lab1; } + among_var = find_among_b(z, a_4, 4); + if (!among_var) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_16))) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab1: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_5, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 9: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_17))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_18))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_7, 87)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_vowel_suffix(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (in_grouping_b_U(z, g_AEIO, 97, 242, 0)) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'h') { z->c = z->l - v_2; goto lab1; } + z->c--; + z->bra = z->c; + if (in_grouping_b_U(z, g_CG, 99, 103, 0)) { z->c = z->l - v_2; goto lab1; } + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + ; + } + return 1; +} + +extern int italian_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_4; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = r_vowel_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + z->c = z->lb; + { + int v_6 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_6; + } + return 1; +} + +extern struct SN_env * italian_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void italian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_italian.h b/contrib/libs/snowball/src_c/stem_UTF_8_italian.h new file mode 100644 index 000000000000..94139313b11b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_italian.h @@ -0,0 +1,15 @@ +/* Generated from italian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_UTF_8_create_env(void); +extern void italian_UTF_8_close_env(struct SN_env * z); + +extern int italian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.c b/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.c new file mode 100644 index 000000000000..ce5403afbdbd --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.c @@ -0,0 +1,848 @@ +/* Generated from lithuanian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +static int r_fix_conflicts(struct SN_env * z); +static int r_fix_gd(struct SN_env * z); +static int r_fix_chdz(struct SN_env * z); +static int r_step1(struct SN_env * z); +static int r_step2(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif +extern int lithuanian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * lithuanian_UTF_8_create_env(void); +extern void lithuanian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 'a' }; +static const symbol s_0_1[2] = { 'i', 'a' }; +static const symbol s_0_2[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_0_3[4] = { 'o', 's', 'n', 'a' }; +static const symbol s_0_4[5] = { 'i', 'o', 's', 'n', 'a' }; +static const symbol s_0_5[5] = { 'u', 'o', 's', 'n', 'a' }; +static const symbol s_0_6[6] = { 'i', 'u', 'o', 's', 'n', 'a' }; +static const symbol s_0_7[4] = { 'y', 's', 'n', 'a' }; +static const symbol s_0_8[5] = { 0xC4, 0x97, 's', 'n', 'a' }; +static const symbol s_0_9[1] = { 'e' }; +static const symbol s_0_10[2] = { 'i', 'e' }; +static const symbol s_0_11[4] = { 'e', 'n', 'i', 'e' }; +static const symbol s_0_12[4] = { 'e', 'r', 'i', 'e' }; +static const symbol s_0_13[3] = { 'o', 'j', 'e' }; +static const symbol s_0_14[4] = { 'i', 'o', 'j', 'e' }; +static const symbol s_0_15[3] = { 'u', 'j', 'e' }; +static const symbol s_0_16[4] = { 'i', 'u', 'j', 'e' }; +static const symbol s_0_17[3] = { 'y', 'j', 'e' }; +static const symbol s_0_18[5] = { 'e', 'n', 'y', 'j', 'e' }; +static const symbol s_0_19[5] = { 'e', 'r', 'y', 'j', 'e' }; +static const symbol s_0_20[4] = { 0xC4, 0x97, 'j', 'e' }; +static const symbol s_0_21[3] = { 'a', 'm', 'e' }; +static const symbol s_0_22[4] = { 'i', 'a', 'm', 'e' }; +static const symbol s_0_23[4] = { 's', 'i', 'm', 'e' }; +static const symbol s_0_24[3] = { 'o', 'm', 'e' }; +static const symbol s_0_25[4] = { 0xC4, 0x97, 'm', 'e' }; +static const symbol s_0_26[7] = { 't', 'u', 'm', 0xC4, 0x97, 'm', 'e' }; +static const symbol s_0_27[3] = { 'o', 's', 'e' }; +static const symbol s_0_28[4] = { 'i', 'o', 's', 'e' }; +static const symbol s_0_29[4] = { 'u', 'o', 's', 'e' }; +static const symbol s_0_30[5] = { 'i', 'u', 'o', 's', 'e' }; +static const symbol s_0_31[3] = { 'y', 's', 'e' }; +static const symbol s_0_32[5] = { 'e', 'n', 'y', 's', 'e' }; +static const symbol s_0_33[5] = { 'e', 'r', 'y', 's', 'e' }; +static const symbol s_0_34[4] = { 0xC4, 0x97, 's', 'e' }; +static const symbol s_0_35[3] = { 'a', 't', 'e' }; +static const symbol s_0_36[4] = { 'i', 'a', 't', 'e' }; +static const symbol s_0_37[3] = { 'i', 't', 'e' }; +static const symbol s_0_38[4] = { 'k', 'i', 't', 'e' }; +static const symbol s_0_39[4] = { 's', 'i', 't', 'e' }; +static const symbol s_0_40[3] = { 'o', 't', 'e' }; +static const symbol s_0_41[4] = { 't', 'u', 't', 'e' }; +static const symbol s_0_42[4] = { 0xC4, 0x97, 't', 'e' }; +static const symbol s_0_43[7] = { 't', 'u', 'm', 0xC4, 0x97, 't', 'e' }; +static const symbol s_0_44[1] = { 'i' }; +static const symbol s_0_45[2] = { 'a', 'i' }; +static const symbol s_0_46[3] = { 'i', 'a', 'i' }; +static const symbol s_0_47[5] = { 'e', 'r', 'i', 'a', 'i' }; +static const symbol s_0_48[2] = { 'e', 'i' }; +static const symbol s_0_49[5] = { 't', 'u', 'm', 'e', 'i' }; +static const symbol s_0_50[2] = { 'k', 'i' }; +static const symbol s_0_51[3] = { 'i', 'm', 'i' }; +static const symbol s_0_52[5] = { 'e', 'r', 'i', 'm', 'i' }; +static const symbol s_0_53[3] = { 'u', 'm', 'i' }; +static const symbol s_0_54[4] = { 'i', 'u', 'm', 'i' }; +static const symbol s_0_55[2] = { 's', 'i' }; +static const symbol s_0_56[3] = { 'a', 's', 'i' }; +static const symbol s_0_57[4] = { 'i', 'a', 's', 'i' }; +static const symbol s_0_58[3] = { 'e', 's', 'i' }; +static const symbol s_0_59[4] = { 'i', 'e', 's', 'i' }; +static const symbol s_0_60[5] = { 's', 'i', 'e', 's', 'i' }; +static const symbol s_0_61[3] = { 'i', 's', 'i' }; +static const symbol s_0_62[4] = { 'a', 'i', 's', 'i' }; +static const symbol s_0_63[4] = { 'e', 'i', 's', 'i' }; +static const symbol s_0_64[7] = { 't', 'u', 'm', 'e', 'i', 's', 'i' }; +static const symbol s_0_65[4] = { 'u', 'i', 's', 'i' }; +static const symbol s_0_66[3] = { 'o', 's', 'i' }; +static const symbol s_0_67[6] = { 0xC4, 0x97, 'j', 'o', 's', 'i' }; +static const symbol s_0_68[4] = { 'u', 'o', 's', 'i' }; +static const symbol s_0_69[5] = { 'i', 'u', 'o', 's', 'i' }; +static const symbol s_0_70[6] = { 's', 'i', 'u', 'o', 's', 'i' }; +static const symbol s_0_71[3] = { 'u', 's', 'i' }; +static const symbol s_0_72[4] = { 'a', 'u', 's', 'i' }; +static const symbol s_0_73[7] = { 0xC4, 0x8D, 'i', 'a', 'u', 's', 'i' }; +static const symbol s_0_74[4] = { 0xC4, 0x85, 's', 'i' }; +static const symbol s_0_75[4] = { 0xC4, 0x97, 's', 'i' }; +static const symbol s_0_76[4] = { 0xC5, 0xB3, 's', 'i' }; +static const symbol s_0_77[5] = { 't', 0xC5, 0xB3, 's', 'i' }; +static const symbol s_0_78[2] = { 't', 'i' }; +static const symbol s_0_79[4] = { 'e', 'n', 't', 'i' }; +static const symbol s_0_80[4] = { 'i', 'n', 't', 'i' }; +static const symbol s_0_81[3] = { 'o', 't', 'i' }; +static const symbol s_0_82[4] = { 'i', 'o', 't', 'i' }; +static const symbol s_0_83[4] = { 'u', 'o', 't', 'i' }; +static const symbol s_0_84[5] = { 'i', 'u', 'o', 't', 'i' }; +static const symbol s_0_85[4] = { 'a', 'u', 't', 'i' }; +static const symbol s_0_86[5] = { 'i', 'a', 'u', 't', 'i' }; +static const symbol s_0_87[3] = { 'y', 't', 'i' }; +static const symbol s_0_88[4] = { 0xC4, 0x97, 't', 'i' }; +static const symbol s_0_89[7] = { 't', 'e', 'l', 0xC4, 0x97, 't', 'i' }; +static const symbol s_0_90[6] = { 'i', 'n', 0xC4, 0x97, 't', 'i' }; +static const symbol s_0_91[7] = { 't', 'e', 'r', 0xC4, 0x97, 't', 'i' }; +static const symbol s_0_92[2] = { 'u', 'i' }; +static const symbol s_0_93[3] = { 'i', 'u', 'i' }; +static const symbol s_0_94[5] = { 'e', 'n', 'i', 'u', 'i' }; +static const symbol s_0_95[2] = { 'o', 'j' }; +static const symbol s_0_96[3] = { 0xC4, 0x97, 'j' }; +static const symbol s_0_97[1] = { 'k' }; +static const symbol s_0_98[2] = { 'a', 'm' }; +static const symbol s_0_99[3] = { 'i', 'a', 'm' }; +static const symbol s_0_100[3] = { 'i', 'e', 'm' }; +static const symbol s_0_101[2] = { 'i', 'm' }; +static const symbol s_0_102[3] = { 's', 'i', 'm' }; +static const symbol s_0_103[2] = { 'o', 'm' }; +static const symbol s_0_104[3] = { 't', 'u', 'm' }; +static const symbol s_0_105[3] = { 0xC4, 0x97, 'm' }; +static const symbol s_0_106[6] = { 't', 'u', 'm', 0xC4, 0x97, 'm' }; +static const symbol s_0_107[2] = { 'a', 'n' }; +static const symbol s_0_108[2] = { 'o', 'n' }; +static const symbol s_0_109[3] = { 'i', 'o', 'n' }; +static const symbol s_0_110[2] = { 'u', 'n' }; +static const symbol s_0_111[3] = { 'i', 'u', 'n' }; +static const symbol s_0_112[3] = { 0xC4, 0x97, 'n' }; +static const symbol s_0_113[1] = { 'o' }; +static const symbol s_0_114[2] = { 'i', 'o' }; +static const symbol s_0_115[4] = { 'e', 'n', 'i', 'o' }; +static const symbol s_0_116[4] = { 0xC4, 0x97, 'j', 'o' }; +static const symbol s_0_117[2] = { 'u', 'o' }; +static const symbol s_0_118[1] = { 's' }; +static const symbol s_0_119[2] = { 'a', 's' }; +static const symbol s_0_120[3] = { 'i', 'a', 's' }; +static const symbol s_0_121[2] = { 'e', 's' }; +static const symbol s_0_122[3] = { 'i', 'e', 's' }; +static const symbol s_0_123[2] = { 'i', 's' }; +static const symbol s_0_124[3] = { 'a', 'i', 's' }; +static const symbol s_0_125[4] = { 'i', 'a', 'i', 's' }; +static const symbol s_0_126[6] = { 't', 'u', 'm', 'e', 'i', 's' }; +static const symbol s_0_127[4] = { 'i', 'm', 'i', 's' }; +static const symbol s_0_128[6] = { 'e', 'n', 'i', 'm', 'i', 's' }; +static const symbol s_0_129[4] = { 'o', 'm', 'i', 's' }; +static const symbol s_0_130[5] = { 'i', 'o', 'm', 'i', 's' }; +static const symbol s_0_131[4] = { 'u', 'm', 'i', 's' }; +static const symbol s_0_132[5] = { 0xC4, 0x97, 'm', 'i', 's' }; +static const symbol s_0_133[4] = { 'e', 'n', 'i', 's' }; +static const symbol s_0_134[4] = { 'a', 's', 'i', 's' }; +static const symbol s_0_135[4] = { 'y', 's', 'i', 's' }; +static const symbol s_0_136[3] = { 'a', 'm', 's' }; +static const symbol s_0_137[4] = { 'i', 'a', 'm', 's' }; +static const symbol s_0_138[4] = { 'i', 'e', 'm', 's' }; +static const symbol s_0_139[3] = { 'i', 'm', 's' }; +static const symbol s_0_140[5] = { 'e', 'n', 'i', 'm', 's' }; +static const symbol s_0_141[5] = { 'e', 'r', 'i', 'm', 's' }; +static const symbol s_0_142[3] = { 'o', 'm', 's' }; +static const symbol s_0_143[4] = { 'i', 'o', 'm', 's' }; +static const symbol s_0_144[3] = { 'u', 'm', 's' }; +static const symbol s_0_145[4] = { 0xC4, 0x97, 'm', 's' }; +static const symbol s_0_146[3] = { 'e', 'n', 's' }; +static const symbol s_0_147[2] = { 'o', 's' }; +static const symbol s_0_148[3] = { 'i', 'o', 's' }; +static const symbol s_0_149[3] = { 'u', 'o', 's' }; +static const symbol s_0_150[4] = { 'i', 'u', 'o', 's' }; +static const symbol s_0_151[3] = { 'e', 'r', 's' }; +static const symbol s_0_152[2] = { 'u', 's' }; +static const symbol s_0_153[3] = { 'a', 'u', 's' }; +static const symbol s_0_154[4] = { 'i', 'a', 'u', 's' }; +static const symbol s_0_155[3] = { 'i', 'u', 's' }; +static const symbol s_0_156[2] = { 'y', 's' }; +static const symbol s_0_157[4] = { 'e', 'n', 'y', 's' }; +static const symbol s_0_158[4] = { 'e', 'r', 'y', 's' }; +static const symbol s_0_159[3] = { 0xC4, 0x85, 's' }; +static const symbol s_0_160[4] = { 'i', 0xC4, 0x85, 's' }; +static const symbol s_0_161[3] = { 0xC4, 0x97, 's' }; +static const symbol s_0_162[5] = { 'a', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_163[6] = { 'i', 'a', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_164[5] = { 'i', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_165[6] = { 'k', 'i', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_166[6] = { 's', 'i', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_167[5] = { 'o', 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_168[6] = { 0xC4, 0x97, 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_169[9] = { 't', 'u', 'm', 0xC4, 0x97, 'm', 0xC4, 0x97, 's' }; +static const symbol s_0_170[5] = { 'a', 't', 0xC4, 0x97, 's' }; +static const symbol s_0_171[6] = { 'i', 'a', 't', 0xC4, 0x97, 's' }; +static const symbol s_0_172[6] = { 's', 'i', 't', 0xC4, 0x97, 's' }; +static const symbol s_0_173[5] = { 'o', 't', 0xC4, 0x97, 's' }; +static const symbol s_0_174[6] = { 0xC4, 0x97, 't', 0xC4, 0x97, 's' }; +static const symbol s_0_175[9] = { 't', 'u', 'm', 0xC4, 0x97, 't', 0xC4, 0x97, 's' }; +static const symbol s_0_176[3] = { 0xC5, 0xAB, 's' }; +static const symbol s_0_177[3] = { 0xC4, 0xAF, 's' }; +static const symbol s_0_178[4] = { 't', 0xC5, 0xB3, 's' }; +static const symbol s_0_179[2] = { 'a', 't' }; +static const symbol s_0_180[3] = { 'i', 'a', 't' }; +static const symbol s_0_181[2] = { 'i', 't' }; +static const symbol s_0_182[3] = { 's', 'i', 't' }; +static const symbol s_0_183[2] = { 'o', 't' }; +static const symbol s_0_184[3] = { 0xC4, 0x97, 't' }; +static const symbol s_0_185[6] = { 't', 'u', 'm', 0xC4, 0x97, 't' }; +static const symbol s_0_186[1] = { 'u' }; +static const symbol s_0_187[2] = { 'a', 'u' }; +static const symbol s_0_188[3] = { 'i', 'a', 'u' }; +static const symbol s_0_189[5] = { 0xC4, 0x8D, 'i', 'a', 'u' }; +static const symbol s_0_190[2] = { 'i', 'u' }; +static const symbol s_0_191[4] = { 'e', 'n', 'i', 'u' }; +static const symbol s_0_192[3] = { 's', 'i', 'u' }; +static const symbol s_0_193[1] = { 'y' }; +static const symbol s_0_194[2] = { 0xC4, 0x85 }; +static const symbol s_0_195[3] = { 'i', 0xC4, 0x85 }; +static const symbol s_0_196[2] = { 0xC4, 0x97 }; +static const symbol s_0_197[2] = { 0xC4, 0x99 }; +static const symbol s_0_198[2] = { 0xC4, 0xAF }; +static const symbol s_0_199[4] = { 'e', 'n', 0xC4, 0xAF }; +static const symbol s_0_200[4] = { 'e', 'r', 0xC4, 0xAF }; +static const symbol s_0_201[2] = { 0xC5, 0xB3 }; +static const symbol s_0_202[3] = { 'i', 0xC5, 0xB3 }; +static const symbol s_0_203[4] = { 'e', 'r', 0xC5, 0xB3 }; +static const struct among a_0[204] = { +{ 1, s_0_0, 0, -1, 0}, +{ 2, s_0_1, -1, -1, 0}, +{ 4, s_0_2, -1, -1, 0}, +{ 4, s_0_3, -3, -1, 0}, +{ 5, s_0_4, -1, -1, 0}, +{ 5, s_0_5, -2, -1, 0}, +{ 6, s_0_6, -1, -1, 0}, +{ 4, s_0_7, -7, -1, 0}, +{ 5, s_0_8, -8, -1, 0}, +{ 1, s_0_9, 0, -1, 0}, +{ 2, s_0_10, -1, -1, 0}, +{ 4, s_0_11, -1, -1, 0}, +{ 4, s_0_12, -2, -1, 0}, +{ 3, s_0_13, -4, -1, 0}, +{ 4, s_0_14, -1, -1, 0}, +{ 3, s_0_15, -6, -1, 0}, +{ 4, s_0_16, -1, -1, 0}, +{ 3, s_0_17, -8, -1, 0}, +{ 5, s_0_18, -1, -1, 0}, +{ 5, s_0_19, -2, -1, 0}, +{ 4, s_0_20, -11, -1, 0}, +{ 3, s_0_21, -12, -1, 0}, +{ 4, s_0_22, -1, -1, 0}, +{ 4, s_0_23, -14, -1, 0}, +{ 3, s_0_24, -15, -1, 0}, +{ 4, s_0_25, -16, -1, 0}, +{ 7, s_0_26, -1, -1, 0}, +{ 3, s_0_27, -18, -1, 0}, +{ 4, s_0_28, -1, -1, 0}, +{ 4, s_0_29, -2, -1, 0}, +{ 5, s_0_30, -1, -1, 0}, +{ 3, s_0_31, -22, -1, 0}, +{ 5, s_0_32, -1, -1, 0}, +{ 5, s_0_33, -2, -1, 0}, +{ 4, s_0_34, -25, -1, 0}, +{ 3, s_0_35, -26, -1, 0}, +{ 4, s_0_36, -1, -1, 0}, +{ 3, s_0_37, -28, -1, 0}, +{ 4, s_0_38, -1, -1, 0}, +{ 4, s_0_39, -2, -1, 0}, +{ 3, s_0_40, -31, -1, 0}, +{ 4, s_0_41, -32, -1, 0}, +{ 4, s_0_42, -33, -1, 0}, +{ 7, s_0_43, -1, -1, 0}, +{ 1, s_0_44, 0, -1, 0}, +{ 2, s_0_45, -1, -1, 0}, +{ 3, s_0_46, -1, -1, 0}, +{ 5, s_0_47, -1, -1, 0}, +{ 2, s_0_48, -4, -1, 0}, +{ 5, s_0_49, -1, -1, 0}, +{ 2, s_0_50, -6, -1, 0}, +{ 3, s_0_51, -7, -1, 0}, +{ 5, s_0_52, -1, -1, 0}, +{ 3, s_0_53, -9, -1, 0}, +{ 4, s_0_54, -1, -1, 0}, +{ 2, s_0_55, -11, -1, 0}, +{ 3, s_0_56, -1, -1, 0}, +{ 4, s_0_57, -1, -1, 0}, +{ 3, s_0_58, -3, -1, 0}, +{ 4, s_0_59, -1, -1, 0}, +{ 5, s_0_60, -1, -1, 0}, +{ 3, s_0_61, -6, -1, 0}, +{ 4, s_0_62, -1, -1, 0}, +{ 4, s_0_63, -2, -1, 0}, +{ 7, s_0_64, -1, -1, 0}, +{ 4, s_0_65, -4, -1, 0}, +{ 3, s_0_66, -11, -1, 0}, +{ 6, s_0_67, -1, -1, 0}, +{ 4, s_0_68, -2, -1, 0}, +{ 5, s_0_69, -1, -1, 0}, +{ 6, s_0_70, -1, -1, 0}, +{ 3, s_0_71, -16, -1, 0}, +{ 4, s_0_72, -1, -1, 0}, +{ 7, s_0_73, -1, -1, 0}, +{ 4, s_0_74, -19, -1, 0}, +{ 4, s_0_75, -20, -1, 0}, +{ 4, s_0_76, -21, -1, 0}, +{ 5, s_0_77, -1, -1, 0}, +{ 2, s_0_78, -34, -1, 0}, +{ 4, s_0_79, -1, -1, 0}, +{ 4, s_0_80, -2, -1, 0}, +{ 3, s_0_81, -3, -1, 0}, +{ 4, s_0_82, -1, -1, 0}, +{ 4, s_0_83, -2, -1, 0}, +{ 5, s_0_84, -1, -1, 0}, +{ 4, s_0_85, -7, -1, 0}, +{ 5, s_0_86, -1, -1, 0}, +{ 3, s_0_87, -9, -1, 0}, +{ 4, s_0_88, -10, -1, 0}, +{ 7, s_0_89, -1, -1, 0}, +{ 6, s_0_90, -2, -1, 0}, +{ 7, s_0_91, -3, -1, 0}, +{ 2, s_0_92, -48, -1, 0}, +{ 3, s_0_93, -1, -1, 0}, +{ 5, s_0_94, -1, -1, 0}, +{ 2, s_0_95, 0, -1, 0}, +{ 3, s_0_96, 0, -1, 0}, +{ 1, s_0_97, 0, -1, 0}, +{ 2, s_0_98, 0, -1, 0}, +{ 3, s_0_99, -1, -1, 0}, +{ 3, s_0_100, 0, -1, 0}, +{ 2, s_0_101, 0, -1, 0}, +{ 3, s_0_102, -1, -1, 0}, +{ 2, s_0_103, 0, -1, 0}, +{ 3, s_0_104, 0, -1, 0}, +{ 3, s_0_105, 0, -1, 0}, +{ 6, s_0_106, -1, -1, 0}, +{ 2, s_0_107, 0, -1, 0}, +{ 2, s_0_108, 0, -1, 0}, +{ 3, s_0_109, -1, -1, 0}, +{ 2, s_0_110, 0, -1, 0}, +{ 3, s_0_111, -1, -1, 0}, +{ 3, s_0_112, 0, -1, 0}, +{ 1, s_0_113, 0, -1, 0}, +{ 2, s_0_114, -1, -1, 0}, +{ 4, s_0_115, -1, -1, 0}, +{ 4, s_0_116, -3, -1, 0}, +{ 2, s_0_117, -4, -1, 0}, +{ 1, s_0_118, 0, -1, 0}, +{ 2, s_0_119, -1, -1, 0}, +{ 3, s_0_120, -1, -1, 0}, +{ 2, s_0_121, -3, -1, 0}, +{ 3, s_0_122, -1, -1, 0}, +{ 2, s_0_123, -5, -1, 0}, +{ 3, s_0_124, -1, -1, 0}, +{ 4, s_0_125, -1, -1, 0}, +{ 6, s_0_126, -3, -1, 0}, +{ 4, s_0_127, -4, -1, 0}, +{ 6, s_0_128, -1, -1, 0}, +{ 4, s_0_129, -6, -1, 0}, +{ 5, s_0_130, -1, -1, 0}, +{ 4, s_0_131, -8, -1, 0}, +{ 5, s_0_132, -9, -1, 0}, +{ 4, s_0_133, -10, -1, 0}, +{ 4, s_0_134, -11, -1, 0}, +{ 4, s_0_135, -12, -1, 0}, +{ 3, s_0_136, -18, -1, 0}, +{ 4, s_0_137, -1, -1, 0}, +{ 4, s_0_138, -20, -1, 0}, +{ 3, s_0_139, -21, -1, 0}, +{ 5, s_0_140, -1, -1, 0}, +{ 5, s_0_141, -2, -1, 0}, +{ 3, s_0_142, -24, -1, 0}, +{ 4, s_0_143, -1, -1, 0}, +{ 3, s_0_144, -26, -1, 0}, +{ 4, s_0_145, -27, -1, 0}, +{ 3, s_0_146, -28, -1, 0}, +{ 2, s_0_147, -29, -1, 0}, +{ 3, s_0_148, -1, -1, 0}, +{ 3, s_0_149, -2, -1, 0}, +{ 4, s_0_150, -1, -1, 0}, +{ 3, s_0_151, -33, -1, 0}, +{ 2, s_0_152, -34, -1, 0}, +{ 3, s_0_153, -1, -1, 0}, +{ 4, s_0_154, -1, -1, 0}, +{ 3, s_0_155, -3, -1, 0}, +{ 2, s_0_156, -38, -1, 0}, +{ 4, s_0_157, -1, -1, 0}, +{ 4, s_0_158, -2, -1, 0}, +{ 3, s_0_159, -41, -1, 0}, +{ 4, s_0_160, -1, -1, 0}, +{ 3, s_0_161, -43, -1, 0}, +{ 5, s_0_162, -1, -1, 0}, +{ 6, s_0_163, -1, -1, 0}, +{ 5, s_0_164, -3, -1, 0}, +{ 6, s_0_165, -1, -1, 0}, +{ 6, s_0_166, -2, -1, 0}, +{ 5, s_0_167, -6, -1, 0}, +{ 6, s_0_168, -7, -1, 0}, +{ 9, s_0_169, -1, -1, 0}, +{ 5, s_0_170, -9, -1, 0}, +{ 6, s_0_171, -1, -1, 0}, +{ 6, s_0_172, -11, -1, 0}, +{ 5, s_0_173, -12, -1, 0}, +{ 6, s_0_174, -13, -1, 0}, +{ 9, s_0_175, -1, -1, 0}, +{ 3, s_0_176, -58, -1, 0}, +{ 3, s_0_177, -59, -1, 0}, +{ 4, s_0_178, -60, -1, 0}, +{ 2, s_0_179, 0, -1, 0}, +{ 3, s_0_180, -1, -1, 0}, +{ 2, s_0_181, 0, -1, 0}, +{ 3, s_0_182, -1, -1, 0}, +{ 2, s_0_183, 0, -1, 0}, +{ 3, s_0_184, 0, -1, 0}, +{ 6, s_0_185, -1, -1, 0}, +{ 1, s_0_186, 0, -1, 0}, +{ 2, s_0_187, -1, -1, 0}, +{ 3, s_0_188, -1, -1, 0}, +{ 5, s_0_189, -1, -1, 0}, +{ 2, s_0_190, -4, -1, 0}, +{ 4, s_0_191, -1, -1, 0}, +{ 3, s_0_192, -2, -1, 0}, +{ 1, s_0_193, 0, -1, 0}, +{ 2, s_0_194, 0, -1, 0}, +{ 3, s_0_195, -1, -1, 0}, +{ 2, s_0_196, 0, -1, 0}, +{ 2, s_0_197, 0, -1, 0}, +{ 2, s_0_198, 0, -1, 0}, +{ 4, s_0_199, -1, -1, 0}, +{ 4, s_0_200, -2, -1, 0}, +{ 2, s_0_201, 0, -1, 0}, +{ 3, s_0_202, -1, -1, 0}, +{ 4, s_0_203, -2, -1, 0} +}; + +static const symbol s_1_0[3] = { 'i', 'n', 'g' }; +static const symbol s_1_1[2] = { 'a', 'j' }; +static const symbol s_1_2[3] = { 'i', 'a', 'j' }; +static const symbol s_1_3[3] = { 'i', 'e', 'j' }; +static const symbol s_1_4[2] = { 'o', 'j' }; +static const symbol s_1_5[3] = { 'i', 'o', 'j' }; +static const symbol s_1_6[3] = { 'u', 'o', 'j' }; +static const symbol s_1_7[4] = { 'i', 'u', 'o', 'j' }; +static const symbol s_1_8[3] = { 'a', 'u', 'j' }; +static const symbol s_1_9[3] = { 0xC4, 0x85, 'j' }; +static const symbol s_1_10[4] = { 'i', 0xC4, 0x85, 'j' }; +static const symbol s_1_11[3] = { 0xC4, 0x97, 'j' }; +static const symbol s_1_12[3] = { 0xC5, 0xB3, 'j' }; +static const symbol s_1_13[4] = { 'i', 0xC5, 0xB3, 'j' }; +static const symbol s_1_14[2] = { 'o', 'k' }; +static const symbol s_1_15[3] = { 'i', 'o', 'k' }; +static const symbol s_1_16[3] = { 'i', 'u', 'k' }; +static const symbol s_1_17[5] = { 'u', 'l', 'i', 'u', 'k' }; +static const symbol s_1_18[6] = { 'u', 0xC4, 0x8D, 'i', 'u', 'k' }; +static const symbol s_1_19[4] = { 'i', 0xC5, 0xA1, 'k' }; +static const symbol s_1_20[3] = { 'i', 'u', 'l' }; +static const symbol s_1_21[2] = { 'y', 'l' }; +static const symbol s_1_22[3] = { 0xC4, 0x97, 'l' }; +static const symbol s_1_23[2] = { 'a', 'm' }; +static const symbol s_1_24[3] = { 'd', 'a', 'm' }; +static const symbol s_1_25[3] = { 'j', 'a', 'm' }; +static const symbol s_1_26[4] = { 'z', 'g', 'a', 'n' }; +static const symbol s_1_27[3] = { 'a', 'i', 'n' }; +static const symbol s_1_28[3] = { 'e', 's', 'n' }; +static const symbol s_1_29[2] = { 'o', 'p' }; +static const symbol s_1_30[3] = { 'i', 'o', 'p' }; +static const symbol s_1_31[3] = { 'i', 'a', 's' }; +static const symbol s_1_32[3] = { 'i', 'e', 's' }; +static const symbol s_1_33[3] = { 'a', 'i', 's' }; +static const symbol s_1_34[4] = { 'i', 'a', 'i', 's' }; +static const symbol s_1_35[2] = { 'o', 's' }; +static const symbol s_1_36[3] = { 'i', 'o', 's' }; +static const symbol s_1_37[3] = { 'u', 'o', 's' }; +static const symbol s_1_38[4] = { 'i', 'u', 'o', 's' }; +static const symbol s_1_39[3] = { 'a', 'u', 's' }; +static const symbol s_1_40[4] = { 'i', 'a', 'u', 's' }; +static const symbol s_1_41[3] = { 0xC4, 0x85, 's' }; +static const symbol s_1_42[4] = { 'i', 0xC4, 0x85, 's' }; +static const symbol s_1_43[3] = { 0xC4, 0x99, 's' }; +static const symbol s_1_44[7] = { 'u', 't', 0xC4, 0x97, 'a', 'i', 't' }; +static const symbol s_1_45[3] = { 'a', 'n', 't' }; +static const symbol s_1_46[4] = { 'i', 'a', 'n', 't' }; +static const symbol s_1_47[5] = { 's', 'i', 'a', 'n', 't' }; +static const symbol s_1_48[3] = { 'i', 'n', 't' }; +static const symbol s_1_49[2] = { 'o', 't' }; +static const symbol s_1_50[3] = { 'u', 'o', 't' }; +static const symbol s_1_51[4] = { 'i', 'u', 'o', 't' }; +static const symbol s_1_52[2] = { 'y', 't' }; +static const symbol s_1_53[3] = { 0xC4, 0x97, 't' }; +static const symbol s_1_54[5] = { 'y', 'k', 0xC5, 0xA1, 't' }; +static const symbol s_1_55[3] = { 'i', 'a', 'u' }; +static const symbol s_1_56[3] = { 'd', 'a', 'v' }; +static const symbol s_1_57[2] = { 's', 'v' }; +static const symbol s_1_58[3] = { 0xC5, 0xA1, 'v' }; +static const symbol s_1_59[6] = { 'y', 'k', 0xC5, 0xA1, 0xC4, 0x8D }; +static const symbol s_1_60[2] = { 0xC4, 0x99 }; +static const symbol s_1_61[5] = { 0xC4, 0x97, 'j', 0xC4, 0x99 }; +static const struct among a_1[62] = { +{ 3, s_1_0, 0, -1, 0}, +{ 2, s_1_1, 0, -1, 0}, +{ 3, s_1_2, -1, -1, 0}, +{ 3, s_1_3, 0, -1, 0}, +{ 2, s_1_4, 0, -1, 0}, +{ 3, s_1_5, -1, -1, 0}, +{ 3, s_1_6, -2, -1, 0}, +{ 4, s_1_7, -1, -1, 0}, +{ 3, s_1_8, 0, -1, 0}, +{ 3, s_1_9, 0, -1, 0}, +{ 4, s_1_10, -1, -1, 0}, +{ 3, s_1_11, 0, -1, 0}, +{ 3, s_1_12, 0, -1, 0}, +{ 4, s_1_13, -1, -1, 0}, +{ 2, s_1_14, 0, -1, 0}, +{ 3, s_1_15, -1, -1, 0}, +{ 3, s_1_16, 0, -1, 0}, +{ 5, s_1_17, -1, -1, 0}, +{ 6, s_1_18, -2, -1, 0}, +{ 4, s_1_19, 0, -1, 0}, +{ 3, s_1_20, 0, -1, 0}, +{ 2, s_1_21, 0, -1, 0}, +{ 3, s_1_22, 0, -1, 0}, +{ 2, s_1_23, 0, -1, 0}, +{ 3, s_1_24, -1, -1, 0}, +{ 3, s_1_25, -2, -1, 0}, +{ 4, s_1_26, 0, -1, 0}, +{ 3, s_1_27, 0, -1, 0}, +{ 3, s_1_28, 0, -1, 0}, +{ 2, s_1_29, 0, -1, 0}, +{ 3, s_1_30, -1, -1, 0}, +{ 3, s_1_31, 0, -1, 0}, +{ 3, s_1_32, 0, -1, 0}, +{ 3, s_1_33, 0, -1, 0}, +{ 4, s_1_34, -1, -1, 0}, +{ 2, s_1_35, 0, -1, 0}, +{ 3, s_1_36, -1, -1, 0}, +{ 3, s_1_37, -2, -1, 0}, +{ 4, s_1_38, -1, -1, 0}, +{ 3, s_1_39, 0, -1, 0}, +{ 4, s_1_40, -1, -1, 0}, +{ 3, s_1_41, 0, -1, 0}, +{ 4, s_1_42, -1, -1, 0}, +{ 3, s_1_43, 0, -1, 0}, +{ 7, s_1_44, 0, -1, 0}, +{ 3, s_1_45, 0, -1, 0}, +{ 4, s_1_46, -1, -1, 0}, +{ 5, s_1_47, -1, -1, 0}, +{ 3, s_1_48, 0, -1, 0}, +{ 2, s_1_49, 0, -1, 0}, +{ 3, s_1_50, -1, -1, 0}, +{ 4, s_1_51, -1, -1, 0}, +{ 2, s_1_52, 0, -1, 0}, +{ 3, s_1_53, 0, -1, 0}, +{ 5, s_1_54, 0, -1, 0}, +{ 3, s_1_55, 0, -1, 0}, +{ 3, s_1_56, 0, -1, 0}, +{ 2, s_1_57, 0, -1, 0}, +{ 3, s_1_58, 0, -1, 0}, +{ 6, s_1_59, 0, -1, 0}, +{ 2, s_1_60, 0, -1, 0}, +{ 5, s_1_61, -1, -1, 0} +}; + +static const symbol s_2_0[5] = { 'o', 'j', 'i', 'm', 'e' }; +static const symbol s_2_1[6] = { 0xC4, 0x97, 'j', 'i', 'm', 'e' }; +static const symbol s_2_2[5] = { 'a', 'v', 'i', 'm', 'e' }; +static const symbol s_2_3[5] = { 'o', 'k', 'a', 't', 'e' }; +static const symbol s_2_4[4] = { 'a', 'i', 't', 'e' }; +static const symbol s_2_5[4] = { 'u', 'o', 't', 'e' }; +static const symbol s_2_6[5] = { 'a', 's', 'i', 'u', 's' }; +static const symbol s_2_7[7] = { 'o', 'k', 'a', 't', 0xC4, 0x97, 's' }; +static const symbol s_2_8[6] = { 'a', 'i', 't', 0xC4, 0x97, 's' }; +static const symbol s_2_9[6] = { 'u', 'o', 't', 0xC4, 0x97, 's' }; +static const symbol s_2_10[4] = { 'e', 's', 'i', 'u' }; +static const struct among a_2[11] = { +{ 5, s_2_0, 0, 7, 0}, +{ 6, s_2_1, 0, 3, 0}, +{ 5, s_2_2, 0, 6, 0}, +{ 5, s_2_3, 0, 8, 0}, +{ 4, s_2_4, 0, 1, 0}, +{ 4, s_2_5, 0, 2, 0}, +{ 5, s_2_6, 0, 5, 0}, +{ 7, s_2_7, 0, 8, 0}, +{ 6, s_2_8, 0, 1, 0}, +{ 6, s_2_9, 0, 2, 0}, +{ 4, s_2_10, 0, 4, 0} +}; + +static const symbol s_3_0[2] = { 0xC4, 0x8D }; +static const symbol s_3_1[3] = { 'd', 0xC5, 0xBE }; +static const struct among a_3[2] = { +{ 2, s_3_0, 0, 1, 0}, +{ 3, s_3_1, 0, 2, 0} +}; + +static const symbol s_4_0[2] = { 'g', 'd' }; +static const struct among a_4[1] = { +{ 2, s_4_0, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 64, 1, 0, 64, 0, 0, 0, 0, 0, 0, 0, 4, 4 }; + +static const symbol s_0[] = { 'a', 'i', 't', 0xC4, 0x97 }; +static const symbol s_1[] = { 'u', 'o', 't', 0xC4, 0x97 }; +static const symbol s_2[] = { 0xC4, 0x97, 'j', 'i', 'm', 'a', 's' }; +static const symbol s_3[] = { 'e', 's', 'y', 's' }; +static const symbol s_4[] = { 'a', 's', 'y', 's' }; +static const symbol s_5[] = { 'a', 'v', 'i', 'm', 'a', 's' }; +static const symbol s_6[] = { 'o', 'j', 'i', 'm', 'a', 's' }; +static const symbol s_7[] = { 'o', 'k', 'a', 't', 0xC4, 0x97 }; +static const symbol s_8[] = { 't' }; +static const symbol s_9[] = { 'd' }; +static const symbol s_10[] = { 'g' }; + +static int r_step1(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[0]) return 0; + v_1 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (!find_among_b(z, a_0, 204)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_step2(struct SN_env * z) { + while (1) { + int v_1 = z->l - z->c; + + { + int v_2; + if (z->c < z->I[0]) goto lab0; + v_2 = z->lb; z->lb = z->I[0]; + z->ket = z->c; + if (!find_among_b(z, a_1, 62)) { z->lb = v_2; goto lab0; } + z->bra = z->c; + z->lb = v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + continue; + lab0: + z->c = z->l - v_1; + break; + } + return 1; +} + +static int r_fix_conflicts(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2621472 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 5, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 5, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 7, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 4, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 6, s_6); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 6, s_7); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_fix_chdz(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 141 && z->p[z->c - 1] != 190)) return 0; + among_var = find_among_b(z, a_3, 2); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_fix_gd(struct SN_env * z) { + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 100) return 0; + if (!find_among_b(z, a_4, 1)) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + return 1; +} + +extern int lithuanian_UTF_8_stem(struct SN_env * z) { + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + { + int v_3 = z->c; + if (z->c == z->l || z->p[z->c] != 'a') { z->c = v_2; goto lab1; } + z->c++; + z->c = v_3; + } + if (len_utf8(z->p) <= 6) { z->c = v_2; goto lab1; } + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) { z->c = v_2; goto lab1; } + z->c = ret; + } + lab1: + ; + } + { + int ret = out_grouping_U(z, g_v, 97, 371, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 371, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_4 = z->l - z->c; + { + int ret = r_fix_conflicts(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + { + int v_5 = z->l - z->c; + { + int ret = r_step1(z); + if (ret < 0) return ret; + } + z->c = z->l - v_5; + } + { + int v_6 = z->l - z->c; + { + int ret = r_fix_chdz(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_step2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_fix_chdz(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_fix_gd(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * lithuanian_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void lithuanian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.h b/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.h new file mode 100644 index 000000000000..2bf046cf26ce --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_lithuanian.h @@ -0,0 +1,15 @@ +/* Generated from lithuanian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * lithuanian_UTF_8_create_env(void); +extern void lithuanian_UTF_8_close_env(struct SN_env * z); + +extern int lithuanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_nepali.c b/contrib/libs/snowball/src_c/stem_UTF_8_nepali.c new file mode 100644 index 000000000000..b2c0df78b158 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_nepali.c @@ -0,0 +1,391 @@ +/* Generated from nepali.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int nepali_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_remove_category_3(struct SN_env * z); +static int r_remove_category_2(struct SN_env * z); +static int r_remove_category_1(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * nepali_UTF_8_create_env(void); +extern void nepali_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x80 }; +static const symbol s_0_1[9] = { 0xE0, 0xA4, 0xB2, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x87 }; +static const symbol s_0_2[6] = { 0xE0, 0xA4, 0xB2, 0xE0, 0xA5, 0x87 }; +static const symbol s_0_3[9] = { 0xE0, 0xA4, 0xB2, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0x88 }; +static const symbol s_0_4[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x88 }; +static const symbol s_0_5[12] = { 0xE0, 0xA4, 0xB8, 0xE0, 0xA4, 0x81, 0xE0, 0xA4, 0x97, 0xE0, 0xA5, 0x88 }; +static const symbol s_0_6[6] = { 0xE0, 0xA4, 0xAE, 0xE0, 0xA5, 0x88 }; +static const symbol s_0_7[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_0_8[9] = { 0xE0, 0xA4, 0xB8, 0xE0, 0xA4, 0x81, 0xE0, 0xA4, 0x97 }; +static const symbol s_0_9[9] = { 0xE0, 0xA4, 0xB8, 0xE0, 0xA4, 0x82, 0xE0, 0xA4, 0x97 }; +static const symbol s_0_10[18] = { 0xE0, 0xA4, 0xAE, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xB0, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xAB, 0xE0, 0xA4, 0xA4 }; +static const symbol s_0_11[6] = { 0xE0, 0xA4, 0xB0, 0xE0, 0xA4, 0xA4 }; +static const symbol s_0_12[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_13[6] = { 0xE0, 0xA4, 0xAE, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_14[18] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xB5, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xB0, 0xE0, 0xA4, 0xBE }; +static const symbol s_0_15[6] = { 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBF }; +static const symbol s_0_16[9] = { 0xE0, 0xA4, 0xAA, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xBF }; +static const struct among a_0[17] = { +{ 6, s_0_0, 0, 2, 0}, +{ 9, s_0_1, 0, 1, 0}, +{ 6, s_0_2, 0, 1, 0}, +{ 9, s_0_3, 0, 1, 0}, +{ 6, s_0_4, 0, 2, 0}, +{ 12, s_0_5, 0, 1, 0}, +{ 6, s_0_6, 0, 1, 0}, +{ 6, s_0_7, 0, 2, 0}, +{ 9, s_0_8, 0, 1, 0}, +{ 9, s_0_9, 0, 1, 0}, +{ 18, s_0_10, 0, 1, 0}, +{ 6, s_0_11, 0, 1, 0}, +{ 6, s_0_12, 0, 2, 0}, +{ 6, s_0_13, 0, 1, 0}, +{ 18, s_0_14, 0, 1, 0}, +{ 6, s_0_15, 0, 2, 0}, +{ 9, s_0_16, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 0xE0, 0xA4, 0x81 }; +static const symbol s_1_1[3] = { 0xE0, 0xA4, 0x82 }; +static const symbol s_1_2[3] = { 0xE0, 0xA5, 0x88 }; +static const struct among a_1[3] = { +{ 3, s_1_0, 0, 1, 0}, +{ 3, s_1_1, 0, 1, 0}, +{ 3, s_1_2, 0, 2, 0} +}; + +static const symbol s_2_0[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_1[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_2[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_3[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_4[12] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x96, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_5[6] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_6[6] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x80 }; +static const symbol s_2_7[6] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_8[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_9[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_10[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_11[6] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_12[9] = { 0xE0, 0xA4, 0xB9, 0xE0, 0xA4, 0xB0, 0xE0, 0xA5, 0x81 }; +static const symbol s_2_13[9] = { 0xE0, 0xA4, 0xB9, 0xE0, 0xA4, 0xB0, 0xE0, 0xA5, 0x82 }; +static const symbol s_2_14[6] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x87 }; +static const symbol s_2_15[6] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA5, 0x87 }; +static const symbol s_2_16[6] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87 }; +static const symbol s_2_17[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_18[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_19[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_20[6] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_21[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_22[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x88 }; +static const symbol s_2_23[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_24[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_25[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_26[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_27[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_28[6] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_29[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_30[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_31[6] = { 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_32[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_33[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_34[9] = { 0xE0, 0xA4, 0xAD, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_35[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_36[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_37[12] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8B }; +static const symbol s_2_38[6] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_39[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_40[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_41[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_42[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_43[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_44[6] = { 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_45[12] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_46[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_47[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8C }; +static const symbol s_2_48[9] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_49[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_50[12] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_51[15] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_52[12] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_53[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_54[12] = { 0xE0, 0xA4, 0xB2, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_55[12] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_56[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_57[9] = { 0xE0, 0xA4, 0xAA, 0xE0, 0xA4, 0xB0, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_58[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_59[15] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_60[12] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_61[12] = { 0xE0, 0xA4, 0xB9, 0xE0, 0xA5, 0x8B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_62[9] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_63[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_64[12] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_65[15] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_66[12] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_67[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x9B, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_68[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_69[12] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D }; +static const symbol s_2_70[9] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x8F }; +static const symbol s_2_71[3] = { 0xE0, 0xA4, 0x9B }; +static const symbol s_2_72[6] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_73[6] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_74[9] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_75[15] = { 0xE0, 0xA4, 0xB9, 0xE0, 0xA5, 0x81, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_76[15] = { 0xE0, 0xA4, 0xB9, 0xE0, 0xA5, 0x81, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_77[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_78[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_79[6] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_80[6] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x9B }; +static const symbol s_2_81[9] = { 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_82[12] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_83[9] = { 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_84[12] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_85[12] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0x8F, 0xE0, 0xA4, 0x95, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_86[6] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_87[9] = { 0xE0, 0xA4, 0x87, 0xE0, 0xA4, 0xA6, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_88[9] = { 0xE0, 0xA4, 0xBF, 0xE0, 0xA4, 0xA6, 0xE0, 0xA4, 0xBE }; +static const symbol s_2_89[12] = { 0xE0, 0xA4, 0xA6, 0xE0, 0xA5, 0x87, 0xE0, 0xA4, 0x96, 0xE0, 0xA4, 0xBF }; +static const symbol s_2_90[12] = { 0xE0, 0xA4, 0xAE, 0xE0, 0xA4, 0xBE, 0xE0, 0xA4, 0xA5, 0xE0, 0xA4, 0xBF }; +static const struct among a_2[91] = { +{ 9, s_2_0, 0, 1, 0}, +{ 9, s_2_1, 0, 1, 0}, +{ 12, s_2_2, -1, 1, 0}, +{ 12, s_2_3, -2, 1, 0}, +{ 12, s_2_4, 0, 1, 0}, +{ 6, s_2_5, 0, 1, 0}, +{ 6, s_2_6, 0, 1, 0}, +{ 6, s_2_7, 0, 1, 0}, +{ 9, s_2_8, -1, 1, 0}, +{ 12, s_2_9, -1, 1, 0}, +{ 9, s_2_10, -3, 1, 0}, +{ 6, s_2_11, 0, 1, 0}, +{ 9, s_2_12, 0, 1, 0}, +{ 9, s_2_13, 0, 1, 0}, +{ 6, s_2_14, 0, 1, 0}, +{ 6, s_2_15, 0, 1, 0}, +{ 6, s_2_16, 0, 1, 0}, +{ 9, s_2_17, 0, 1, 0}, +{ 12, s_2_18, -1, 1, 0}, +{ 9, s_2_19, 0, 1, 0}, +{ 6, s_2_20, 0, 1, 0}, +{ 9, s_2_21, -1, 1, 0}, +{ 9, s_2_22, -2, 1, 0}, +{ 9, s_2_23, 0, 1, 0}, +{ 12, s_2_24, -1, 1, 0}, +{ 9, s_2_25, 0, 1, 0}, +{ 12, s_2_26, -1, 1, 0}, +{ 12, s_2_27, -2, 1, 0}, +{ 6, s_2_28, 0, 1, 0}, +{ 9, s_2_29, -1, 1, 0}, +{ 9, s_2_30, -2, 1, 0}, +{ 6, s_2_31, 0, 1, 0}, +{ 9, s_2_32, -1, 1, 0}, +{ 12, s_2_33, -2, 1, 0}, +{ 9, s_2_34, -3, 1, 0}, +{ 9, s_2_35, -4, 1, 0}, +{ 12, s_2_36, -1, 1, 0}, +{ 12, s_2_37, -2, 1, 0}, +{ 6, s_2_38, 0, 1, 0}, +{ 9, s_2_39, -1, 1, 0}, +{ 9, s_2_40, -2, 1, 0}, +{ 12, s_2_41, -1, 1, 0}, +{ 9, s_2_42, -4, 1, 0}, +{ 9, s_2_43, -5, 1, 0}, +{ 6, s_2_44, 0, 1, 0}, +{ 12, s_2_45, -1, 1, 0}, +{ 12, s_2_46, -2, 1, 0}, +{ 12, s_2_47, -3, 1, 0}, +{ 9, s_2_48, 0, 1, 0}, +{ 12, s_2_49, -1, 1, 0}, +{ 12, s_2_50, -2, 1, 0}, +{ 15, s_2_51, -1, 1, 0}, +{ 12, s_2_52, -4, 1, 0}, +{ 12, s_2_53, -5, 1, 0}, +{ 12, s_2_54, 0, 1, 0}, +{ 12, s_2_55, 0, 1, 0}, +{ 12, s_2_56, 0, 1, 0}, +{ 9, s_2_57, 0, 1, 0}, +{ 9, s_2_58, 0, 1, 0}, +{ 15, s_2_59, -1, 1, 0}, +{ 12, s_2_60, 0, 1, 0}, +{ 12, s_2_61, 0, 1, 0}, +{ 9, s_2_62, 0, 1, 0}, +{ 12, s_2_63, -1, 1, 0}, +{ 12, s_2_64, -2, 1, 0}, +{ 15, s_2_65, -1, 1, 0}, +{ 12, s_2_66, -4, 1, 0}, +{ 12, s_2_67, -5, 1, 0}, +{ 9, s_2_68, 0, 1, 0}, +{ 12, s_2_69, -1, 1, 0}, +{ 9, s_2_70, 0, 1, 0}, +{ 3, s_2_71, 0, 1, 0}, +{ 6, s_2_72, -1, 1, 0}, +{ 6, s_2_73, -2, 1, 0}, +{ 9, s_2_74, -1, 1, 0}, +{ 15, s_2_75, -1, 1, 0}, +{ 15, s_2_76, -5, 1, 0}, +{ 12, s_2_77, -6, 1, 0}, +{ 12, s_2_78, -7, 1, 0}, +{ 6, s_2_79, -8, 1, 0}, +{ 6, s_2_80, -9, 1, 0}, +{ 9, s_2_81, 0, 1, 0}, +{ 12, s_2_82, -1, 1, 0}, +{ 9, s_2_83, 0, 1, 0}, +{ 12, s_2_84, -1, 1, 0}, +{ 12, s_2_85, -2, 1, 0}, +{ 6, s_2_86, 0, 1, 0}, +{ 9, s_2_87, -1, 1, 0}, +{ 9, s_2_88, -2, 1, 0}, +{ 12, s_2_89, 0, 1, 0}, +{ 12, s_2_90, 0, 1, 0} +}; + +static const symbol s_0[] = { 0xE0, 0xA4, 0x8F }; +static const symbol s_1[] = { 0xE0, 0xA5, 0x87 }; +static const symbol s_2[] = { 0xE0, 0xA4, 0xAF, 0xE0, 0xA5, 0x8C }; +static const symbol s_3[] = { 0xE0, 0xA4, 0x9B, 0xE0, 0xA5, 0x8C }; +static const symbol s_4[] = { 0xE0, 0xA4, 0xA8, 0xE0, 0xA5, 0x8C }; +static const symbol s_5[] = { 0xE0, 0xA4, 0xA5, 0xE0, 0xA5, 0x87 }; +static const symbol s_6[] = { 0xE0, 0xA4, 0xA4, 0xE0, 0xA5, 0x8D, 0xE0, 0xA4, 0xB0 }; + +static int r_remove_category_1(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_0, 17); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 3, s_0))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 3, s_1))) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_1; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab0: + break; + } + return 1; +} + +static int r_remove_category_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 4 || !((262 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 6, s_2))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 6, s_3))) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_1; + if (!(eq_s_b(z, 6, s_4))) goto lab3; + goto lab0; + lab3: + z->c = z->l - v_1; + if (!(eq_s_b(z, 6, s_5))) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (!(eq_s_b(z, 9, s_6))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_remove_category_3(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_2, 91)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int nepali_UTF_8_stem(struct SN_env * z) { + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_remove_category_1(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + while (1) { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_remove_category_2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int ret = r_remove_category_3(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + continue; + lab0: + z->c = z->l - v_2; + break; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * nepali_UTF_8_create_env(void) { return SN_create_env(0, 0); } + +extern void nepali_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_nepali.h b/contrib/libs/snowball/src_c/stem_UTF_8_nepali.h new file mode 100644 index 000000000000..32961035f4c2 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_nepali.h @@ -0,0 +1,15 @@ +/* Generated from nepali.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * nepali_UTF_8_create_env(void); +extern void nepali_UTF_8_close_env(struct SN_env * z); + +extern int nepali_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.c b/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.c new file mode 100644 index 000000000000..7cbc9a6fac28 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.c @@ -0,0 +1,350 @@ +/* Generated from norwegian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int norwegian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * norwegian_UTF_8_create_env(void); +extern void norwegian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[3] = { 'i', 'n', 'd' }; +static const symbol s_0_2[2] = { 'k', 'k' }; +static const symbol s_0_3[2] = { 'n', 'k' }; +static const symbol s_0_4[3] = { 'a', 'm', 'm' }; +static const symbol s_0_5[3] = { 'o', 'm', 'm' }; +static const symbol s_0_6[3] = { 'k', 'a', 'p' }; +static const symbol s_0_7[4] = { 's', 'k', 'a', 'p' }; +static const symbol s_0_8[2] = { 'p', 'p' }; +static const symbol s_0_9[2] = { 'l', 't' }; +static const symbol s_0_10[3] = { 'a', 's', 't' }; +static const symbol s_0_11[4] = { 0xC3, 0xB8, 's', 't' }; +static const symbol s_0_12[1] = { 'v' }; +static const symbol s_0_13[3] = { 'h', 'a', 'v' }; +static const symbol s_0_14[3] = { 'g', 'i', 'v' }; +static const struct among a_0[15] = { +{ 0, 0, 0, 1, 0}, +{ 3, s_0_1, -1, -1, 0}, +{ 2, s_0_2, -2, -1, 0}, +{ 2, s_0_3, -3, -1, 0}, +{ 3, s_0_4, -4, -1, 0}, +{ 3, s_0_5, -5, -1, 0}, +{ 3, s_0_6, -6, -1, 0}, +{ 4, s_0_7, -1, 1, 0}, +{ 2, s_0_8, -8, -1, 0}, +{ 2, s_0_9, -9, -1, 0}, +{ 3, s_0_10, -10, -1, 0}, +{ 4, s_0_11, -11, -1, 0}, +{ 1, s_0_12, -12, -1, 0}, +{ 3, s_0_13, -1, 1, 0}, +{ 3, s_0_14, -2, 1, 0} +}; + +static const symbol s_1_0[1] = { 'a' }; +static const symbol s_1_1[1] = { 'e' }; +static const symbol s_1_2[3] = { 'e', 'd', 'e' }; +static const symbol s_1_3[4] = { 'a', 'n', 'd', 'e' }; +static const symbol s_1_4[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_1_5[3] = { 'a', 'n', 'e' }; +static const symbol s_1_6[3] = { 'e', 'n', 'e' }; +static const symbol s_1_7[6] = { 'h', 'e', 't', 'e', 'n', 'e' }; +static const symbol s_1_8[4] = { 'e', 'r', 't', 'e' }; +static const symbol s_1_9[2] = { 'e', 'n' }; +static const symbol s_1_10[5] = { 'h', 'e', 't', 'e', 'n' }; +static const symbol s_1_11[2] = { 'a', 'r' }; +static const symbol s_1_12[2] = { 'e', 'r' }; +static const symbol s_1_13[5] = { 'h', 'e', 't', 'e', 'r' }; +static const symbol s_1_14[1] = { 's' }; +static const symbol s_1_15[2] = { 'a', 's' }; +static const symbol s_1_16[2] = { 'e', 's' }; +static const symbol s_1_17[4] = { 'e', 'd', 'e', 's' }; +static const symbol s_1_18[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_1_19[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_1_20[7] = { 'h', 'e', 't', 'e', 'n', 'e', 's' }; +static const symbol s_1_21[3] = { 'e', 'n', 's' }; +static const symbol s_1_22[6] = { 'h', 'e', 't', 'e', 'n', 's' }; +static const symbol s_1_23[3] = { 'e', 'r', 's' }; +static const symbol s_1_24[3] = { 'e', 't', 's' }; +static const symbol s_1_25[2] = { 'e', 't' }; +static const symbol s_1_26[3] = { 'h', 'e', 't' }; +static const symbol s_1_27[3] = { 'e', 'r', 't' }; +static const symbol s_1_28[3] = { 'a', 's', 't' }; +static const struct among a_1[29] = { +{ 1, s_1_0, 0, 1, 0}, +{ 1, s_1_1, 0, 1, 0}, +{ 3, s_1_2, -1, 1, 0}, +{ 4, s_1_3, -2, 1, 0}, +{ 4, s_1_4, -3, 1, 0}, +{ 3, s_1_5, -4, 1, 0}, +{ 3, s_1_6, -5, 1, 0}, +{ 6, s_1_7, -1, 1, 0}, +{ 4, s_1_8, -7, 4, 0}, +{ 2, s_1_9, 0, 1, 0}, +{ 5, s_1_10, -1, 1, 0}, +{ 2, s_1_11, 0, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 5, s_1_13, -1, 1, 0}, +{ 1, s_1_14, 0, 3, 0}, +{ 2, s_1_15, -1, 1, 0}, +{ 2, s_1_16, -2, 1, 0}, +{ 4, s_1_17, -1, 1, 0}, +{ 5, s_1_18, -2, 1, 0}, +{ 4, s_1_19, -3, 1, 0}, +{ 7, s_1_20, -1, 1, 0}, +{ 3, s_1_21, -7, 1, 0}, +{ 6, s_1_22, -1, 1, 0}, +{ 3, s_1_23, -9, 2, 0}, +{ 3, s_1_24, -10, 1, 0}, +{ 2, s_1_25, 0, 1, 0}, +{ 3, s_1_26, -1, 1, 0}, +{ 3, s_1_27, 0, 4, 0}, +{ 3, s_1_28, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 't' }; +static const symbol s_2_1[2] = { 'v', 't' }; +static const struct among a_2[2] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0} +}; + +static const symbol s_3_0[3] = { 'l', 'e', 'g' }; +static const symbol s_3_1[4] = { 'e', 'l', 'e', 'g' }; +static const symbol s_3_2[2] = { 'i', 'g' }; +static const symbol s_3_3[3] = { 'e', 'i', 'g' }; +static const symbol s_3_4[3] = { 'l', 'i', 'g' }; +static const symbol s_3_5[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_3_6[3] = { 'e', 'l', 's' }; +static const symbol s_3_7[3] = { 'l', 'o', 'v' }; +static const symbol s_3_8[4] = { 'e', 'l', 'o', 'v' }; +static const symbol s_3_9[4] = { 's', 'l', 'o', 'v' }; +static const symbol s_3_10[7] = { 'h', 'e', 't', 's', 'l', 'o', 'v' }; +static const struct among a_3[11] = { +{ 3, s_3_0, 0, 1, 0}, +{ 4, s_3_1, -1, 1, 0}, +{ 2, s_3_2, 0, 1, 0}, +{ 3, s_3_3, -1, 1, 0}, +{ 3, s_3_4, -2, 1, 0}, +{ 4, s_3_5, -1, 1, 0}, +{ 3, s_3_6, 0, 1, 0}, +{ 3, s_3_7, 0, 1, 0}, +{ 4, s_3_8, -1, 1, 0}, +{ 4, s_3_9, -2, 1, 0}, +{ 7, s_3_10, -1, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 2, 142 }; + +static const unsigned char g_s_ending[] = { 119, 125, 148, 1 }; + +static const symbol s_0[] = { 'e', 'r' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping_U(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851426 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_1, 29); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((5318672 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 1; else + among_var = find_among_b(z, a_0, 15); + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + break; + case 3: + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_s_ending, 98, 122, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'r') goto lab2; + z->c--; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab3; + z->c--; + goto lab2; + lab3: + z->c = z->l - v_3; + } + goto lab0; + lab2: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'k') return 0; + z->c--; + if (out_grouping_b_U(z, g_v, 97, 248, 0)) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { + int v_1 = z->l - z->c; + + { + int v_2; + if (z->c < z->I[1]) return 0; + v_2 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) { z->lb = v_2; return 0; } + if (!find_among_b(z, a_2, 2)) { z->lb = v_2; return 0; } + z->bra = z->c; + z->lb = v_2; + } + z->c = z->l - v_1; + } + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718720 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_3, 11)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int norwegian_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * norwegian_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void norwegian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.h b/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.h new file mode 100644 index 000000000000..568f194c8cd8 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_norwegian.h @@ -0,0 +1,15 @@ +/* Generated from norwegian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_UTF_8_create_env(void); +extern void norwegian_UTF_8_close_env(struct SN_env * z); + +extern int norwegian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_porter.c b/contrib/libs/snowball/src_c/stem_UTF_8_porter.c new file mode 100644 index 000000000000..0798f313c846 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_porter.c @@ -0,0 +1,770 @@ +/* Generated from porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int porter_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_Step_5b(struct SN_env * z); +static int r_Step_5a(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * porter_UTF_8_create_env(void); +extern void porter_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 's' }; +static const symbol s_0_1[3] = { 'i', 'e', 's' }; +static const symbol s_0_2[4] = { 's', 's', 'e', 's' }; +static const symbol s_0_3[2] = { 's', 's' }; +static const struct among a_0[4] = { +{ 1, s_0_0, 0, 3, 0}, +{ 3, s_0_1, -1, 2, 0}, +{ 4, s_0_2, -2, 1, 0}, +{ 2, s_0_3, -3, -1, 0} +}; + +static const symbol s_1_1[2] = { 'b', 'b' }; +static const symbol s_1_2[2] = { 'd', 'd' }; +static const symbol s_1_3[2] = { 'f', 'f' }; +static const symbol s_1_4[2] = { 'g', 'g' }; +static const symbol s_1_5[2] = { 'b', 'l' }; +static const symbol s_1_6[2] = { 'm', 'm' }; +static const symbol s_1_7[2] = { 'n', 'n' }; +static const symbol s_1_8[2] = { 'p', 'p' }; +static const symbol s_1_9[2] = { 'r', 'r' }; +static const symbol s_1_10[2] = { 'a', 't' }; +static const symbol s_1_11[2] = { 't', 't' }; +static const symbol s_1_12[2] = { 'i', 'z' }; +static const struct among a_1[13] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_1_1, -1, 2, 0}, +{ 2, s_1_2, -2, 2, 0}, +{ 2, s_1_3, -3, 2, 0}, +{ 2, s_1_4, -4, 2, 0}, +{ 2, s_1_5, -5, 1, 0}, +{ 2, s_1_6, -6, 2, 0}, +{ 2, s_1_7, -7, 2, 0}, +{ 2, s_1_8, -8, 2, 0}, +{ 2, s_1_9, -9, 2, 0}, +{ 2, s_1_10, -10, 1, 0}, +{ 2, s_1_11, -11, 2, 0}, +{ 2, s_1_12, -12, 1, 0} +}; + +static const symbol s_2_0[2] = { 'e', 'd' }; +static const symbol s_2_1[3] = { 'e', 'e', 'd' }; +static const symbol s_2_2[3] = { 'i', 'n', 'g' }; +static const struct among a_2[3] = { +{ 2, s_2_0, 0, 2, 0}, +{ 3, s_2_1, -1, 1, 0}, +{ 3, s_2_2, 0, 2, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_3_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_3_2[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_3_3[3] = { 'e', 'l', 'i' }; +static const symbol s_3_4[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_3_5[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_3_6[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_3_7[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_3_8[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_3_9[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_3_10[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_11[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_12[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_3_13[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_14[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_15[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_3_16[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_3_17[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_3_18[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_3_19[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; +static const struct among a_3[20] = { +{ 4, s_3_0, 0, 3, 0}, +{ 4, s_3_1, 0, 2, 0}, +{ 4, s_3_2, 0, 4, 0}, +{ 3, s_3_3, 0, 6, 0}, +{ 4, s_3_4, 0, 9, 0}, +{ 5, s_3_5, 0, 11, 0}, +{ 5, s_3_6, 0, 5, 0}, +{ 5, s_3_7, 0, 9, 0}, +{ 6, s_3_8, 0, 13, 0}, +{ 5, s_3_9, 0, 12, 0}, +{ 6, s_3_10, 0, 1, 0}, +{ 7, s_3_11, -1, 8, 0}, +{ 5, s_3_12, 0, 9, 0}, +{ 5, s_3_13, 0, 8, 0}, +{ 7, s_3_14, -1, 7, 0}, +{ 4, s_3_15, 0, 7, 0}, +{ 4, s_3_16, 0, 8, 0}, +{ 7, s_3_17, 0, 12, 0}, +{ 7, s_3_18, 0, 10, 0}, +{ 7, s_3_19, 0, 11, 0} +}; + +static const symbol s_4_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_4_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_4_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_4_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_4_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_4_5[3] = { 'f', 'u', 'l' }; +static const symbol s_4_6[4] = { 'n', 'e', 's', 's' }; +static const struct among a_4[7] = { +{ 5, s_4_0, 0, 2, 0}, +{ 5, s_4_1, 0, 3, 0}, +{ 5, s_4_2, 0, 1, 0}, +{ 5, s_4_3, 0, 2, 0}, +{ 4, s_4_4, 0, 2, 0}, +{ 3, s_4_5, 0, 3, 0}, +{ 4, s_4_6, 0, 3, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_5_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_5_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_5_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_5_5[3] = { 'a', 't', 'e' }; +static const symbol s_5_6[3] = { 'i', 'v', 'e' }; +static const symbol s_5_7[3] = { 'i', 'z', 'e' }; +static const symbol s_5_8[3] = { 'i', 't', 'i' }; +static const symbol s_5_9[2] = { 'a', 'l' }; +static const symbol s_5_10[3] = { 'i', 's', 'm' }; +static const symbol s_5_11[3] = { 'i', 'o', 'n' }; +static const symbol s_5_12[2] = { 'e', 'r' }; +static const symbol s_5_13[3] = { 'o', 'u', 's' }; +static const symbol s_5_14[3] = { 'a', 'n', 't' }; +static const symbol s_5_15[3] = { 'e', 'n', 't' }; +static const symbol s_5_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_5_17[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_5_18[2] = { 'o', 'u' }; +static const struct among a_5[19] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 4, s_5_2, 0, 1, 0}, +{ 4, s_5_3, 0, 1, 0}, +{ 4, s_5_4, 0, 1, 0}, +{ 3, s_5_5, 0, 1, 0}, +{ 3, s_5_6, 0, 1, 0}, +{ 3, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 1, 0}, +{ 2, s_5_9, 0, 1, 0}, +{ 3, s_5_10, 0, 1, 0}, +{ 3, s_5_11, 0, 2, 0}, +{ 2, s_5_12, 0, 1, 0}, +{ 3, s_5_13, 0, 1, 0}, +{ 3, s_5_14, 0, 1, 0}, +{ 3, s_5_15, 0, 1, 0}, +{ 4, s_5_16, -1, 1, 0}, +{ 5, s_5_17, -1, 1, 0}, +{ 2, s_5_18, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const symbol s_0[] = { 's', 's' }; +static const symbol s_1[] = { 'i' }; +static const symbol s_2[] = { 'e', 'e' }; +static const symbol s_3[] = { 'e' }; +static const symbol s_4[] = { 'e' }; +static const symbol s_5[] = { 'i' }; +static const symbol s_6[] = { 't', 'i', 'o', 'n' }; +static const symbol s_7[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_8[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_9[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_10[] = { 'e', 'n', 't' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'i', 'z', 'e' }; +static const symbol s_13[] = { 'a', 't', 'e' }; +static const symbol s_14[] = { 'a', 'l' }; +static const symbol s_15[] = { 'f', 'u', 'l' }; +static const symbol s_16[] = { 'o', 'u', 's' }; +static const symbol s_17[] = { 'i', 'v', 'e' }; +static const symbol s_18[] = { 'b', 'l', 'e' }; +static const symbol s_19[] = { 'a', 'l' }; +static const symbol s_20[] = { 'i', 'c' }; +static const symbol s_21[] = { 'Y' }; +static const symbol s_22[] = { 'Y' }; +static const symbol s_23[] = { 'y' }; + +static int r_shortv(struct SN_env * z) { + if (out_grouping_b_U(z, g_v_WXY, 89, 121, 0)) return 0; + if (in_grouping_b_U(z, g_v, 97, 121, 0)) return 0; + if (out_grouping_b_U(z, g_v, 97, 121, 0)) return 0; + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 115) return 0; + among_var = find_among_b(z, a_0, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 103)) return 0; + among_var = find_among_b(z, a_2, 3); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + { + int ret = out_grouping_b_U(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - v_1; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_1, 13); + z->c = z->l - v_2; + } + switch (among_var) { + case 1: + { + int saved_c = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_3); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + case 2: + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + if (z->c != z->I[1]) return 0; + { + int v_3 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret <= 0) return ret; + } + z->c = z->l - v_3; + } + { + int saved_c = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_4); + z->c = saved_c; + if (ret < 0) return ret; + } + break; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'Y') return 0; + z->c--; + } +lab0: + z->bra = z->c; + { + int ret = out_grouping_b_U(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((815616 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 20); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_7); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_8); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_9); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_10); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_12); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 3, s_13); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 3, s_15); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 3, s_16); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 3, s_17); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 3, s_18); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_4, 7); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_19); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_20); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((3961384 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 19); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 't') return 0; + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5a(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + goto lab0; +lab1: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + { + int ret = r_shortv(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - v_1; + } +lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_5b(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'l') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int porter_UTF_8_stem(struct SN_env * z) { + z->I[2] = 0; + { + int v_1 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab0; + z->c++; + z->ket = z->c; + { + int ret = slice_from_s(z, 1, s_21); + if (ret < 0) return ret; + } + z->I[2] = 1; + lab0: + z->c = v_1; + } + { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + while (1) { + int v_4 = z->c; + if (in_grouping_U(z, g_v, 97, 121, 0)) goto lab3; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'y') goto lab3; + z->c++; + z->ket = z->c; + z->c = v_4; + break; + lab3: + z->c = v_4; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + } + { + int ret = slice_from_s(z, 1, s_22); + if (ret < 0) return ret; + } + z->I[2] = 1; + continue; + lab2: + z->c = v_3; + break; + } + z->c = v_2; + } + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[0] = z->c; + lab4: + z->c = v_5; + } + z->lb = z->c; z->c = z->l; + { + int v_6 = z->l - z->c; + { + int ret = r_Step_1a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + { + int v_7 = z->l - z->c; + { + int ret = r_Step_1b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + { + int ret = r_Step_1c(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret < 0) return ret; + } + z->c = z->l - v_9; + } + { + int v_10 = z->l - z->c; + { + int ret = r_Step_3(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + { + int v_11 = z->l - z->c; + { + int ret = r_Step_4(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + } + { + int v_12 = z->l - z->c; + { + int ret = r_Step_5a(z); + if (ret < 0) return ret; + } + z->c = z->l - v_12; + } + { + int v_13 = z->l - z->c; + { + int ret = r_Step_5b(z); + if (ret < 0) return ret; + } + z->c = z->l - v_13; + } + z->c = z->lb; + { + int v_14 = z->c; + if (!(z->I[2])) goto lab5; + while (1) { + int v_15 = z->c; + while (1) { + int v_16 = z->c; + z->bra = z->c; + if (z->c == z->l || z->p[z->c] != 'Y') goto lab7; + z->c++; + z->ket = z->c; + z->c = v_16; + break; + lab7: + z->c = v_16; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab6; + z->c = ret; + } + } + { + int ret = slice_from_s(z, 1, s_23); + if (ret < 0) return ret; + } + continue; + lab6: + z->c = v_15; + break; + } + lab5: + z->c = v_14; + } + return 1; +} + +extern struct SN_env * porter_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void porter_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_porter.h b/contrib/libs/snowball/src_c/stem_UTF_8_porter.h new file mode 100644 index 000000000000..d5e02a166dce --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_porter.h @@ -0,0 +1,15 @@ +/* Generated from porter.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_UTF_8_create_env(void); +extern void porter_UTF_8_close_env(struct SN_env * z); + +extern int porter_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.c b/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.c new file mode 100644 index 000000000000..492e558254db --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.c @@ -0,0 +1,1016 @@ +/* Generated from portuguese.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int portuguese_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_form(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * portuguese_UTF_8_create_env(void); +extern void portuguese_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 0xC3, 0xA3 }; +static const symbol s_0_2[2] = { 0xC3, 0xB5 }; +static const struct among a_0[3] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_0_1, -1, 1, 0}, +{ 2, s_0_2, -2, 2, 0} +}; + +static const symbol s_1_1[2] = { 'a', '~' }; +static const symbol s_1_2[2] = { 'o', '~' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 2, s_1_1, -1, 1, 0}, +{ 2, s_1_2, -2, 2, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'c' }; +static const symbol s_2_1[2] = { 'a', 'd' }; +static const symbol s_2_2[2] = { 'o', 's' }; +static const symbol s_2_3[2] = { 'i', 'v' }; +static const struct among a_2[4] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, 1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_3_1[4] = { 'a', 'v', 'e', 'l' }; +static const symbol s_3_2[5] = { 0xC3, 0xAD, 'v', 'e', 'l' }; +static const struct among a_3[3] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0}, +{ 5, s_3_2, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'i', 'v' }; +static const struct among a_4[3] = { +{ 2, s_4_0, 0, 1, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 2, s_4_2, 0, 1, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'c', 'a' }; +static const symbol s_5_1[6] = { 0xC3, 0xA2, 'n', 'c', 'i', 'a' }; +static const symbol s_5_2[6] = { 0xC3, 0xAA, 'n', 'c', 'i', 'a' }; +static const symbol s_5_3[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_5_4[3] = { 'i', 'r', 'a' }; +static const symbol s_5_5[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_5_6[3] = { 'o', 's', 'a' }; +static const symbol s_5_7[4] = { 'i', 's', 't', 'a' }; +static const symbol s_5_8[3] = { 'i', 'v', 'a' }; +static const symbol s_5_9[3] = { 'e', 'z', 'a' }; +static const symbol s_5_10[5] = { 'i', 'd', 'a', 'd', 'e' }; +static const symbol s_5_11[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_5_12[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_13[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_14[5] = { 0xC3, 0xA1, 'v', 'e', 'l' }; +static const symbol s_5_15[5] = { 0xC3, 0xAD, 'v', 'e', 'l' }; +static const symbol s_5_16[3] = { 'i', 'c', 'o' }; +static const symbol s_5_17[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_5_18[3] = { 'o', 's', 'o' }; +static const symbol s_5_19[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_20[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_21[3] = { 'i', 'v', 'o' }; +static const symbol s_5_22[6] = { 'a', 0xC3, 0xA7, 'a', '~', 'o' }; +static const symbol s_5_23[6] = { 'u', 0xC3, 0xA7, 'a', '~', 'o' }; +static const symbol s_5_24[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_5_25[4] = { 'i', 'c', 'a', 's' }; +static const symbol s_5_26[7] = { 0xC3, 0xAA, 'n', 'c', 'i', 'a', 's' }; +static const symbol s_5_27[6] = { 'l', 'o', 'g', 'i', 'a', 's' }; +static const symbol s_5_28[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_29[6] = { 'a', 'd', 'o', 'r', 'a', 's' }; +static const symbol s_5_30[4] = { 'o', 's', 'a', 's' }; +static const symbol s_5_31[5] = { 'i', 's', 't', 'a', 's' }; +static const symbol s_5_32[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_5_33[4] = { 'e', 'z', 'a', 's' }; +static const symbol s_5_34[6] = { 'i', 'd', 'a', 'd', 'e', 's' }; +static const symbol s_5_35[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_5_36[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_37[7] = { 'a', 0xC3, 0xA7, 'o', '~', 'e', 's' }; +static const symbol s_5_38[7] = { 'u', 0xC3, 0xA7, 'o', '~', 'e', 's' }; +static const symbol s_5_39[4] = { 'i', 'c', 'o', 's' }; +static const symbol s_5_40[5] = { 'i', 's', 'm', 'o', 's' }; +static const symbol s_5_41[4] = { 'o', 's', 'o', 's' }; +static const symbol s_5_42[7] = { 'a', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_43[7] = { 'i', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_44[4] = { 'i', 'v', 'o', 's' }; +static const struct among a_5[45] = { +{ 3, s_5_0, 0, 1, 0}, +{ 6, s_5_1, 0, 1, 0}, +{ 6, s_5_2, 0, 4, 0}, +{ 5, s_5_3, 0, 2, 0}, +{ 3, s_5_4, 0, 9, 0}, +{ 5, s_5_5, 0, 1, 0}, +{ 3, s_5_6, 0, 1, 0}, +{ 4, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 8, 0}, +{ 3, s_5_9, 0, 1, 0}, +{ 5, s_5_10, 0, 7, 0}, +{ 4, s_5_11, 0, 1, 0}, +{ 5, s_5_12, 0, 6, 0}, +{ 6, s_5_13, -1, 5, 0}, +{ 5, s_5_14, 0, 1, 0}, +{ 5, s_5_15, 0, 1, 0}, +{ 3, s_5_16, 0, 1, 0}, +{ 4, s_5_17, 0, 1, 0}, +{ 3, s_5_18, 0, 1, 0}, +{ 6, s_5_19, 0, 1, 0}, +{ 6, s_5_20, 0, 1, 0}, +{ 3, s_5_21, 0, 8, 0}, +{ 6, s_5_22, 0, 1, 0}, +{ 6, s_5_23, 0, 3, 0}, +{ 4, s_5_24, 0, 1, 0}, +{ 4, s_5_25, 0, 1, 0}, +{ 7, s_5_26, 0, 4, 0}, +{ 6, s_5_27, 0, 2, 0}, +{ 4, s_5_28, 0, 9, 0}, +{ 6, s_5_29, 0, 1, 0}, +{ 4, s_5_30, 0, 1, 0}, +{ 5, s_5_31, 0, 1, 0}, +{ 4, s_5_32, 0, 8, 0}, +{ 4, s_5_33, 0, 1, 0}, +{ 6, s_5_34, 0, 7, 0}, +{ 6, s_5_35, 0, 1, 0}, +{ 5, s_5_36, 0, 1, 0}, +{ 7, s_5_37, 0, 1, 0}, +{ 7, s_5_38, 0, 3, 0}, +{ 4, s_5_39, 0, 1, 0}, +{ 5, s_5_40, 0, 1, 0}, +{ 4, s_5_41, 0, 1, 0}, +{ 7, s_5_42, 0, 1, 0}, +{ 7, s_5_43, 0, 1, 0}, +{ 4, s_5_44, 0, 8, 0} +}; + +static const symbol s_6_0[3] = { 'a', 'd', 'a' }; +static const symbol s_6_1[3] = { 'i', 'd', 'a' }; +static const symbol s_6_2[2] = { 'i', 'a' }; +static const symbol s_6_3[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_6_4[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_6_5[4] = { 'i', 'r', 'i', 'a' }; +static const symbol s_6_6[3] = { 'a', 'r', 'a' }; +static const symbol s_6_7[3] = { 'e', 'r', 'a' }; +static const symbol s_6_8[3] = { 'i', 'r', 'a' }; +static const symbol s_6_9[3] = { 'a', 'v', 'a' }; +static const symbol s_6_10[4] = { 'a', 's', 's', 'e' }; +static const symbol s_6_11[4] = { 'e', 's', 's', 'e' }; +static const symbol s_6_12[4] = { 'i', 's', 's', 'e' }; +static const symbol s_6_13[4] = { 'a', 's', 't', 'e' }; +static const symbol s_6_14[4] = { 'e', 's', 't', 'e' }; +static const symbol s_6_15[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_16[2] = { 'e', 'i' }; +static const symbol s_6_17[4] = { 'a', 'r', 'e', 'i' }; +static const symbol s_6_18[4] = { 'e', 'r', 'e', 'i' }; +static const symbol s_6_19[4] = { 'i', 'r', 'e', 'i' }; +static const symbol s_6_20[2] = { 'a', 'm' }; +static const symbol s_6_21[3] = { 'i', 'a', 'm' }; +static const symbol s_6_22[5] = { 'a', 'r', 'i', 'a', 'm' }; +static const symbol s_6_23[5] = { 'e', 'r', 'i', 'a', 'm' }; +static const symbol s_6_24[5] = { 'i', 'r', 'i', 'a', 'm' }; +static const symbol s_6_25[4] = { 'a', 'r', 'a', 'm' }; +static const symbol s_6_26[4] = { 'e', 'r', 'a', 'm' }; +static const symbol s_6_27[4] = { 'i', 'r', 'a', 'm' }; +static const symbol s_6_28[4] = { 'a', 'v', 'a', 'm' }; +static const symbol s_6_29[2] = { 'e', 'm' }; +static const symbol s_6_30[4] = { 'a', 'r', 'e', 'm' }; +static const symbol s_6_31[4] = { 'e', 'r', 'e', 'm' }; +static const symbol s_6_32[4] = { 'i', 'r', 'e', 'm' }; +static const symbol s_6_33[5] = { 'a', 's', 's', 'e', 'm' }; +static const symbol s_6_34[5] = { 'e', 's', 's', 'e', 'm' }; +static const symbol s_6_35[5] = { 'i', 's', 's', 'e', 'm' }; +static const symbol s_6_36[3] = { 'a', 'd', 'o' }; +static const symbol s_6_37[3] = { 'i', 'd', 'o' }; +static const symbol s_6_38[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_6_39[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_6_40[4] = { 'i', 'n', 'd', 'o' }; +static const symbol s_6_41[5] = { 'a', 'r', 'a', '~', 'o' }; +static const symbol s_6_42[5] = { 'e', 'r', 'a', '~', 'o' }; +static const symbol s_6_43[5] = { 'i', 'r', 'a', '~', 'o' }; +static const symbol s_6_44[2] = { 'a', 'r' }; +static const symbol s_6_45[2] = { 'e', 'r' }; +static const symbol s_6_46[2] = { 'i', 'r' }; +static const symbol s_6_47[2] = { 'a', 's' }; +static const symbol s_6_48[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_6_49[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_6_50[3] = { 'i', 'a', 's' }; +static const symbol s_6_51[5] = { 'a', 'r', 'i', 'a', 's' }; +static const symbol s_6_52[5] = { 'e', 'r', 'i', 'a', 's' }; +static const symbol s_6_53[5] = { 'i', 'r', 'i', 'a', 's' }; +static const symbol s_6_54[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_6_55[4] = { 'e', 'r', 'a', 's' }; +static const symbol s_6_56[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_6_57[4] = { 'a', 'v', 'a', 's' }; +static const symbol s_6_58[2] = { 'e', 's' }; +static const symbol s_6_59[5] = { 'a', 'r', 'd', 'e', 's' }; +static const symbol s_6_60[5] = { 'e', 'r', 'd', 'e', 's' }; +static const symbol s_6_61[5] = { 'i', 'r', 'd', 'e', 's' }; +static const symbol s_6_62[4] = { 'a', 'r', 'e', 's' }; +static const symbol s_6_63[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_6_64[4] = { 'i', 'r', 'e', 's' }; +static const symbol s_6_65[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_6_66[5] = { 'e', 's', 's', 'e', 's' }; +static const symbol s_6_67[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_6_68[5] = { 'a', 's', 't', 'e', 's' }; +static const symbol s_6_69[5] = { 'e', 's', 't', 'e', 's' }; +static const symbol s_6_70[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_6_71[2] = { 'i', 's' }; +static const symbol s_6_72[3] = { 'a', 'i', 's' }; +static const symbol s_6_73[3] = { 'e', 'i', 's' }; +static const symbol s_6_74[5] = { 'a', 'r', 'e', 'i', 's' }; +static const symbol s_6_75[5] = { 'e', 'r', 'e', 'i', 's' }; +static const symbol s_6_76[5] = { 'i', 'r', 'e', 'i', 's' }; +static const symbol s_6_77[6] = { 0xC3, 0xA1, 'r', 'e', 'i', 's' }; +static const symbol s_6_78[6] = { 0xC3, 0xA9, 'r', 'e', 'i', 's' }; +static const symbol s_6_79[6] = { 0xC3, 0xAD, 'r', 'e', 'i', 's' }; +static const symbol s_6_80[7] = { 0xC3, 0xA1, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_81[7] = { 0xC3, 0xA9, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_82[7] = { 0xC3, 0xAD, 's', 's', 'e', 'i', 's' }; +static const symbol s_6_83[6] = { 0xC3, 0xA1, 'v', 'e', 'i', 's' }; +static const symbol s_6_84[5] = { 0xC3, 0xAD, 'e', 'i', 's' }; +static const symbol s_6_85[7] = { 'a', 'r', 0xC3, 0xAD, 'e', 'i', 's' }; +static const symbol s_6_86[7] = { 'e', 'r', 0xC3, 0xAD, 'e', 'i', 's' }; +static const symbol s_6_87[7] = { 'i', 'r', 0xC3, 0xAD, 'e', 'i', 's' }; +static const symbol s_6_88[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_6_89[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_6_90[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_6_91[7] = { 0xC3, 0xA1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_92[7] = { 0xC3, 0xA9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_93[7] = { 0xC3, 0xAD, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_6_94[7] = { 0xC3, 0xA1, 'v', 'a', 'm', 'o', 's' }; +static const symbol s_6_95[6] = { 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_6_96[8] = { 'a', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_6_97[8] = { 'e', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_6_98[8] = { 'i', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_6_99[4] = { 'e', 'm', 'o', 's' }; +static const symbol s_6_100[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_101[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_102[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_6_103[8] = { 0xC3, 0xA1, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_104[8] = { 0xC3, 0xAA, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_105[8] = { 0xC3, 0xAD, 's', 's', 'e', 'm', 'o', 's' }; +static const symbol s_6_106[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_6_107[5] = { 'a', 'r', 'm', 'o', 's' }; +static const symbol s_6_108[5] = { 'e', 'r', 'm', 'o', 's' }; +static const symbol s_6_109[5] = { 'i', 'r', 'm', 'o', 's' }; +static const symbol s_6_110[5] = { 0xC3, 0xA1, 'm', 'o', 's' }; +static const symbol s_6_111[5] = { 'a', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_6_112[5] = { 'e', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_6_113[5] = { 'i', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_6_114[2] = { 'e', 'u' }; +static const symbol s_6_115[2] = { 'i', 'u' }; +static const symbol s_6_116[2] = { 'o', 'u' }; +static const symbol s_6_117[4] = { 'a', 'r', 0xC3, 0xA1 }; +static const symbol s_6_118[4] = { 'e', 'r', 0xC3, 0xA1 }; +static const symbol s_6_119[4] = { 'i', 'r', 0xC3, 0xA1 }; +static const struct among a_6[120] = { +{ 3, s_6_0, 0, 1, 0}, +{ 3, s_6_1, 0, 1, 0}, +{ 2, s_6_2, 0, 1, 0}, +{ 4, s_6_3, -1, 1, 0}, +{ 4, s_6_4, -2, 1, 0}, +{ 4, s_6_5, -3, 1, 0}, +{ 3, s_6_6, 0, 1, 0}, +{ 3, s_6_7, 0, 1, 0}, +{ 3, s_6_8, 0, 1, 0}, +{ 3, s_6_9, 0, 1, 0}, +{ 4, s_6_10, 0, 1, 0}, +{ 4, s_6_11, 0, 1, 0}, +{ 4, s_6_12, 0, 1, 0}, +{ 4, s_6_13, 0, 1, 0}, +{ 4, s_6_14, 0, 1, 0}, +{ 4, s_6_15, 0, 1, 0}, +{ 2, s_6_16, 0, 1, 0}, +{ 4, s_6_17, -1, 1, 0}, +{ 4, s_6_18, -2, 1, 0}, +{ 4, s_6_19, -3, 1, 0}, +{ 2, s_6_20, 0, 1, 0}, +{ 3, s_6_21, -1, 1, 0}, +{ 5, s_6_22, -1, 1, 0}, +{ 5, s_6_23, -2, 1, 0}, +{ 5, s_6_24, -3, 1, 0}, +{ 4, s_6_25, -5, 1, 0}, +{ 4, s_6_26, -6, 1, 0}, +{ 4, s_6_27, -7, 1, 0}, +{ 4, s_6_28, -8, 1, 0}, +{ 2, s_6_29, 0, 1, 0}, +{ 4, s_6_30, -1, 1, 0}, +{ 4, s_6_31, -2, 1, 0}, +{ 4, s_6_32, -3, 1, 0}, +{ 5, s_6_33, -4, 1, 0}, +{ 5, s_6_34, -5, 1, 0}, +{ 5, s_6_35, -6, 1, 0}, +{ 3, s_6_36, 0, 1, 0}, +{ 3, s_6_37, 0, 1, 0}, +{ 4, s_6_38, 0, 1, 0}, +{ 4, s_6_39, 0, 1, 0}, +{ 4, s_6_40, 0, 1, 0}, +{ 5, s_6_41, 0, 1, 0}, +{ 5, s_6_42, 0, 1, 0}, +{ 5, s_6_43, 0, 1, 0}, +{ 2, s_6_44, 0, 1, 0}, +{ 2, s_6_45, 0, 1, 0}, +{ 2, s_6_46, 0, 1, 0}, +{ 2, s_6_47, 0, 1, 0}, +{ 4, s_6_48, -1, 1, 0}, +{ 4, s_6_49, -2, 1, 0}, +{ 3, s_6_50, -3, 1, 0}, +{ 5, s_6_51, -1, 1, 0}, +{ 5, s_6_52, -2, 1, 0}, +{ 5, s_6_53, -3, 1, 0}, +{ 4, s_6_54, -7, 1, 0}, +{ 4, s_6_55, -8, 1, 0}, +{ 4, s_6_56, -9, 1, 0}, +{ 4, s_6_57, -10, 1, 0}, +{ 2, s_6_58, 0, 1, 0}, +{ 5, s_6_59, -1, 1, 0}, +{ 5, s_6_60, -2, 1, 0}, +{ 5, s_6_61, -3, 1, 0}, +{ 4, s_6_62, -4, 1, 0}, +{ 4, s_6_63, -5, 1, 0}, +{ 4, s_6_64, -6, 1, 0}, +{ 5, s_6_65, -7, 1, 0}, +{ 5, s_6_66, -8, 1, 0}, +{ 5, s_6_67, -9, 1, 0}, +{ 5, s_6_68, -10, 1, 0}, +{ 5, s_6_69, -11, 1, 0}, +{ 5, s_6_70, -12, 1, 0}, +{ 2, s_6_71, 0, 1, 0}, +{ 3, s_6_72, -1, 1, 0}, +{ 3, s_6_73, -2, 1, 0}, +{ 5, s_6_74, -1, 1, 0}, +{ 5, s_6_75, -2, 1, 0}, +{ 5, s_6_76, -3, 1, 0}, +{ 6, s_6_77, -4, 1, 0}, +{ 6, s_6_78, -5, 1, 0}, +{ 6, s_6_79, -6, 1, 0}, +{ 7, s_6_80, -7, 1, 0}, +{ 7, s_6_81, -8, 1, 0}, +{ 7, s_6_82, -9, 1, 0}, +{ 6, s_6_83, -10, 1, 0}, +{ 5, s_6_84, -11, 1, 0}, +{ 7, s_6_85, -1, 1, 0}, +{ 7, s_6_86, -2, 1, 0}, +{ 7, s_6_87, -3, 1, 0}, +{ 4, s_6_88, 0, 1, 0}, +{ 4, s_6_89, 0, 1, 0}, +{ 4, s_6_90, 0, 1, 0}, +{ 7, s_6_91, -1, 1, 0}, +{ 7, s_6_92, -2, 1, 0}, +{ 7, s_6_93, -3, 1, 0}, +{ 7, s_6_94, -4, 1, 0}, +{ 6, s_6_95, -5, 1, 0}, +{ 8, s_6_96, -1, 1, 0}, +{ 8, s_6_97, -2, 1, 0}, +{ 8, s_6_98, -3, 1, 0}, +{ 4, s_6_99, 0, 1, 0}, +{ 6, s_6_100, -1, 1, 0}, +{ 6, s_6_101, -2, 1, 0}, +{ 6, s_6_102, -3, 1, 0}, +{ 8, s_6_103, -4, 1, 0}, +{ 8, s_6_104, -5, 1, 0}, +{ 8, s_6_105, -6, 1, 0}, +{ 4, s_6_106, 0, 1, 0}, +{ 5, s_6_107, 0, 1, 0}, +{ 5, s_6_108, 0, 1, 0}, +{ 5, s_6_109, 0, 1, 0}, +{ 5, s_6_110, 0, 1, 0}, +{ 5, s_6_111, 0, 1, 0}, +{ 5, s_6_112, 0, 1, 0}, +{ 5, s_6_113, 0, 1, 0}, +{ 2, s_6_114, 0, 1, 0}, +{ 2, s_6_115, 0, 1, 0}, +{ 2, s_6_116, 0, 1, 0}, +{ 4, s_6_117, 0, 1, 0}, +{ 4, s_6_118, 0, 1, 0}, +{ 4, s_6_119, 0, 1, 0} +}; + +static const symbol s_7_0[1] = { 'a' }; +static const symbol s_7_1[1] = { 'i' }; +static const symbol s_7_2[1] = { 'o' }; +static const symbol s_7_3[2] = { 'o', 's' }; +static const symbol s_7_4[2] = { 0xC3, 0xA1 }; +static const symbol s_7_5[2] = { 0xC3, 0xAD }; +static const symbol s_7_6[2] = { 0xC3, 0xB3 }; +static const struct among a_7[7] = { +{ 1, s_7_0, 0, 1, 0}, +{ 1, s_7_1, 0, 1, 0}, +{ 1, s_7_2, 0, 1, 0}, +{ 2, s_7_3, 0, 1, 0}, +{ 2, s_7_4, 0, 1, 0}, +{ 2, s_7_5, 0, 1, 0}, +{ 2, s_7_6, 0, 1, 0} +}; + +static const symbol s_8_0[1] = { 'e' }; +static const symbol s_8_1[2] = { 0xC3, 0xA7 }; +static const symbol s_8_2[2] = { 0xC3, 0xA9 }; +static const symbol s_8_3[2] = { 0xC3, 0xAA }; +static const struct among a_8[4] = { +{ 1, s_8_0, 0, 1, 0}, +{ 2, s_8_1, 0, 2, 0}, +{ 2, s_8_2, 0, 1, 0}, +{ 2, s_8_3, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2 }; + +static const symbol s_0[] = { 'a', '~' }; +static const symbol s_1[] = { 'o', '~' }; +static const symbol s_2[] = { 0xC3, 0xA3 }; +static const symbol s_3[] = { 0xC3, 0xB5 }; +static const symbol s_4[] = { 'l', 'o', 'g' }; +static const symbol s_5[] = { 'u' }; +static const symbol s_6[] = { 'e', 'n', 't', 'e' }; +static const symbol s_7[] = { 'a', 't' }; +static const symbol s_8[] = { 'a', 't' }; +static const symbol s_9[] = { 'i', 'r' }; +static const symbol s_10[] = { 'c' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 163 && z->p[z->c + 1] != 181)) among_var = 3; else + among_var = find_among(z, a_0, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 250, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping_U(z, g_v, 97, 250, 0)) goto lab4; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping_U(z, g_v, 97, 250, 0)) goto lab2; + { + int ret = in_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping_U(z, g_v, 97, 250, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping_U(z, g_v, 97, 250, 0)) goto lab6; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 250, 0)) goto lab0; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 250, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] != 126) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_2); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((823330 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 45); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_4); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718616 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_1; goto lab0; } + among_var = find_among_b(z, a_2, 4); + if (!among_var) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_7))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + ; + } + break; + case 6: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 101 && z->p[z->c - 1] != 108)) { z->c = z->l - v_2; goto lab1; } + if (!find_among_b(z, a_3, 3)) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab1: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_4, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_8))) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + case 9: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0; + z->c--; + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_6, 120)) { z->lb = v_1; return 0; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->lb = v_1; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_7, 7)) return 0; + z->bra = z->c; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_residual_form(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_8, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab1; + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') goto lab1; + z->c--; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0; + z->c--; + z->bra = z->c; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') return 0; + z->c--; + z->c = z->l - v_3; + } + } + lab0: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int portuguese_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = z->l - v_5; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + } + lab3: + z->c = z->l - v_4; + { + int v_6 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab5; + z->c--; + z->bra = z->c; + { + int v_7 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'c') goto lab5; + z->c--; + z->c = z->l - v_7; + } + { + int ret = r_RV(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab5: + z->c = z->l - v_6; + } + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_residual_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_8 = z->l - z->c; + { + int ret = r_residual_form(z); + if (ret < 0) return ret; + } + z->c = z->l - v_8; + } + z->c = z->lb; + { + int v_9 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_9; + } + return 1; +} + +extern struct SN_env * portuguese_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void portuguese_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.h b/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.h new file mode 100644 index 000000000000..6e6d80f6269f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_portuguese.h @@ -0,0 +1,15 @@ +/* Generated from portuguese.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_UTF_8_create_env(void); +extern void portuguese_UTF_8_close_env(struct SN_env * z); + +extern int portuguese_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_romanian.c b/contrib/libs/snowball/src_c/stem_UTF_8_romanian.c new file mode 100644 index 000000000000..62d96843835a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_romanian.c @@ -0,0 +1,1069 @@ +/* Generated from romanian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int romanian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_vowel_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_combo_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_step_0(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +static int r_norm(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * romanian_UTF_8_create_env(void); +extern void romanian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 0xC5, 0x9F }; +static const symbol s_0_1[2] = { 0xC5, 0xA3 }; +static const struct among a_0[2] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 2, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'U' }; +static const struct among a_1[3] = { +{ 0, 0, 0, 3, 0}, +{ 1, s_1_1, -1, 1, 0}, +{ 1, s_1_2, -2, 2, 0} +}; + +static const symbol s_2_0[2] = { 'e', 'a' }; +static const symbol s_2_1[5] = { 'a', 0xC8, 0x9B, 'i', 'a' }; +static const symbol s_2_2[3] = { 'a', 'u', 'a' }; +static const symbol s_2_3[3] = { 'i', 'u', 'a' }; +static const symbol s_2_4[5] = { 'a', 0xC8, 0x9B, 'i', 'e' }; +static const symbol s_2_5[3] = { 'e', 'l', 'e' }; +static const symbol s_2_6[3] = { 'i', 'l', 'e' }; +static const symbol s_2_7[4] = { 'i', 'i', 'l', 'e' }; +static const symbol s_2_8[3] = { 'i', 'e', 'i' }; +static const symbol s_2_9[4] = { 'a', 't', 'e', 'i' }; +static const symbol s_2_10[2] = { 'i', 'i' }; +static const symbol s_2_11[4] = { 'u', 'l', 'u', 'i' }; +static const symbol s_2_12[2] = { 'u', 'l' }; +static const symbol s_2_13[4] = { 'e', 'l', 'o', 'r' }; +static const symbol s_2_14[4] = { 'i', 'l', 'o', 'r' }; +static const symbol s_2_15[5] = { 'i', 'i', 'l', 'o', 'r' }; +static const struct among a_2[16] = { +{ 2, s_2_0, 0, 3, 0}, +{ 5, s_2_1, 0, 7, 0}, +{ 3, s_2_2, 0, 2, 0}, +{ 3, s_2_3, 0, 4, 0}, +{ 5, s_2_4, 0, 7, 0}, +{ 3, s_2_5, 0, 3, 0}, +{ 3, s_2_6, 0, 5, 0}, +{ 4, s_2_7, -1, 4, 0}, +{ 3, s_2_8, 0, 4, 0}, +{ 4, s_2_9, 0, 6, 0}, +{ 2, s_2_10, 0, 4, 0}, +{ 4, s_2_11, 0, 1, 0}, +{ 2, s_2_12, 0, 1, 0}, +{ 4, s_2_13, 0, 3, 0}, +{ 4, s_2_14, 0, 4, 0}, +{ 5, s_2_15, -1, 4, 0} +}; + +static const symbol s_3_0[5] = { 'i', 'c', 'a', 'l', 'a' }; +static const symbol s_3_1[5] = { 'i', 'c', 'i', 'v', 'a' }; +static const symbol s_3_2[5] = { 'a', 't', 'i', 'v', 'a' }; +static const symbol s_3_3[5] = { 'i', 't', 'i', 'v', 'a' }; +static const symbol s_3_4[5] = { 'i', 'c', 'a', 'l', 'e' }; +static const symbol s_3_5[7] = { 'a', 0xC8, 0x9B, 'i', 'u', 'n', 'e' }; +static const symbol s_3_6[7] = { 'i', 0xC8, 0x9B, 'i', 'u', 'n', 'e' }; +static const symbol s_3_7[6] = { 'a', 't', 'o', 'a', 'r', 'e' }; +static const symbol s_3_8[6] = { 'i', 't', 'o', 'a', 'r', 'e' }; +static const symbol s_3_9[7] = { 0xC4, 0x83, 't', 'o', 'a', 'r', 'e' }; +static const symbol s_3_10[7] = { 'i', 'c', 'i', 't', 'a', 't', 'e' }; +static const symbol s_3_11[9] = { 'a', 'b', 'i', 'l', 'i', 't', 'a', 't', 'e' }; +static const symbol s_3_12[9] = { 'i', 'b', 'i', 'l', 'i', 't', 'a', 't', 'e' }; +static const symbol s_3_13[7] = { 'i', 'v', 'i', 't', 'a', 't', 'e' }; +static const symbol s_3_14[5] = { 'i', 'c', 'i', 'v', 'e' }; +static const symbol s_3_15[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_3_16[5] = { 'i', 't', 'i', 'v', 'e' }; +static const symbol s_3_17[5] = { 'i', 'c', 'a', 'l', 'i' }; +static const symbol s_3_18[5] = { 'a', 't', 'o', 'r', 'i' }; +static const symbol s_3_19[7] = { 'i', 'c', 'a', 't', 'o', 'r', 'i' }; +static const symbol s_3_20[5] = { 'i', 't', 'o', 'r', 'i' }; +static const symbol s_3_21[6] = { 0xC4, 0x83, 't', 'o', 'r', 'i' }; +static const symbol s_3_22[7] = { 'i', 'c', 'i', 't', 'a', 't', 'i' }; +static const symbol s_3_23[9] = { 'a', 'b', 'i', 'l', 'i', 't', 'a', 't', 'i' }; +static const symbol s_3_24[7] = { 'i', 'v', 'i', 't', 'a', 't', 'i' }; +static const symbol s_3_25[5] = { 'i', 'c', 'i', 'v', 'i' }; +static const symbol s_3_26[5] = { 'a', 't', 'i', 'v', 'i' }; +static const symbol s_3_27[5] = { 'i', 't', 'i', 'v', 'i' }; +static const symbol s_3_28[7] = { 'i', 'c', 'i', 't', 0xC4, 0x83, 'i' }; +static const symbol s_3_29[9] = { 'a', 'b', 'i', 'l', 'i', 't', 0xC4, 0x83, 'i' }; +static const symbol s_3_30[7] = { 'i', 'v', 'i', 't', 0xC4, 0x83, 'i' }; +static const symbol s_3_31[9] = { 'i', 'c', 'i', 't', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_3_32[11] = { 'a', 'b', 'i', 'l', 'i', 't', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_3_33[9] = { 'i', 'v', 'i', 't', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_3_34[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_3_35[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_3_36[6] = { 'i', 'c', 'a', 't', 'o', 'r' }; +static const symbol s_3_37[4] = { 'i', 't', 'o', 'r' }; +static const symbol s_3_38[5] = { 0xC4, 0x83, 't', 'o', 'r' }; +static const symbol s_3_39[4] = { 'i', 'c', 'i', 'v' }; +static const symbol s_3_40[4] = { 'a', 't', 'i', 'v' }; +static const symbol s_3_41[4] = { 'i', 't', 'i', 'v' }; +static const symbol s_3_42[6] = { 'i', 'c', 'a', 'l', 0xC4, 0x83 }; +static const symbol s_3_43[6] = { 'i', 'c', 'i', 'v', 0xC4, 0x83 }; +static const symbol s_3_44[6] = { 'a', 't', 'i', 'v', 0xC4, 0x83 }; +static const symbol s_3_45[6] = { 'i', 't', 'i', 'v', 0xC4, 0x83 }; +static const struct among a_3[46] = { +{ 5, s_3_0, 0, 4, 0}, +{ 5, s_3_1, 0, 4, 0}, +{ 5, s_3_2, 0, 5, 0}, +{ 5, s_3_3, 0, 6, 0}, +{ 5, s_3_4, 0, 4, 0}, +{ 7, s_3_5, 0, 5, 0}, +{ 7, s_3_6, 0, 6, 0}, +{ 6, s_3_7, 0, 5, 0}, +{ 6, s_3_8, 0, 6, 0}, +{ 7, s_3_9, 0, 5, 0}, +{ 7, s_3_10, 0, 4, 0}, +{ 9, s_3_11, 0, 1, 0}, +{ 9, s_3_12, 0, 2, 0}, +{ 7, s_3_13, 0, 3, 0}, +{ 5, s_3_14, 0, 4, 0}, +{ 5, s_3_15, 0, 5, 0}, +{ 5, s_3_16, 0, 6, 0}, +{ 5, s_3_17, 0, 4, 0}, +{ 5, s_3_18, 0, 5, 0}, +{ 7, s_3_19, -1, 4, 0}, +{ 5, s_3_20, 0, 6, 0}, +{ 6, s_3_21, 0, 5, 0}, +{ 7, s_3_22, 0, 4, 0}, +{ 9, s_3_23, 0, 1, 0}, +{ 7, s_3_24, 0, 3, 0}, +{ 5, s_3_25, 0, 4, 0}, +{ 5, s_3_26, 0, 5, 0}, +{ 5, s_3_27, 0, 6, 0}, +{ 7, s_3_28, 0, 4, 0}, +{ 9, s_3_29, 0, 1, 0}, +{ 7, s_3_30, 0, 3, 0}, +{ 9, s_3_31, 0, 4, 0}, +{ 11, s_3_32, 0, 1, 0}, +{ 9, s_3_33, 0, 3, 0}, +{ 4, s_3_34, 0, 4, 0}, +{ 4, s_3_35, 0, 5, 0}, +{ 6, s_3_36, -1, 4, 0}, +{ 4, s_3_37, 0, 6, 0}, +{ 5, s_3_38, 0, 5, 0}, +{ 4, s_3_39, 0, 4, 0}, +{ 4, s_3_40, 0, 5, 0}, +{ 4, s_3_41, 0, 6, 0}, +{ 6, s_3_42, 0, 4, 0}, +{ 6, s_3_43, 0, 4, 0}, +{ 6, s_3_44, 0, 5, 0}, +{ 6, s_3_45, 0, 6, 0} +}; + +static const symbol s_4_0[3] = { 'i', 'c', 'a' }; +static const symbol s_4_1[5] = { 'a', 'b', 'i', 'l', 'a' }; +static const symbol s_4_2[5] = { 'i', 'b', 'i', 'l', 'a' }; +static const symbol s_4_3[4] = { 'o', 'a', 's', 'a' }; +static const symbol s_4_4[3] = { 'a', 't', 'a' }; +static const symbol s_4_5[3] = { 'i', 't', 'a' }; +static const symbol s_4_6[4] = { 'a', 'n', 't', 'a' }; +static const symbol s_4_7[4] = { 'i', 's', 't', 'a' }; +static const symbol s_4_8[3] = { 'u', 't', 'a' }; +static const symbol s_4_9[3] = { 'i', 'v', 'a' }; +static const symbol s_4_10[2] = { 'i', 'c' }; +static const symbol s_4_11[3] = { 'i', 'c', 'e' }; +static const symbol s_4_12[5] = { 'a', 'b', 'i', 'l', 'e' }; +static const symbol s_4_13[5] = { 'i', 'b', 'i', 'l', 'e' }; +static const symbol s_4_14[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_4_15[4] = { 'i', 'u', 'n', 'e' }; +static const symbol s_4_16[4] = { 'o', 'a', 's', 'e' }; +static const symbol s_4_17[3] = { 'a', 't', 'e' }; +static const symbol s_4_18[5] = { 'i', 't', 'a', 't', 'e' }; +static const symbol s_4_19[3] = { 'i', 't', 'e' }; +static const symbol s_4_20[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_4_21[4] = { 'i', 's', 't', 'e' }; +static const symbol s_4_22[3] = { 'u', 't', 'e' }; +static const symbol s_4_23[3] = { 'i', 'v', 'e' }; +static const symbol s_4_24[3] = { 'i', 'c', 'i' }; +static const symbol s_4_25[5] = { 'a', 'b', 'i', 'l', 'i' }; +static const symbol s_4_26[5] = { 'i', 'b', 'i', 'l', 'i' }; +static const symbol s_4_27[4] = { 'i', 'u', 'n', 'i' }; +static const symbol s_4_28[5] = { 'a', 't', 'o', 'r', 'i' }; +static const symbol s_4_29[3] = { 'o', 's', 'i' }; +static const symbol s_4_30[3] = { 'a', 't', 'i' }; +static const symbol s_4_31[5] = { 'i', 't', 'a', 't', 'i' }; +static const symbol s_4_32[3] = { 'i', 't', 'i' }; +static const symbol s_4_33[4] = { 'a', 'n', 't', 'i' }; +static const symbol s_4_34[4] = { 'i', 's', 't', 'i' }; +static const symbol s_4_35[3] = { 'u', 't', 'i' }; +static const symbol s_4_36[5] = { 'i', 0xC8, 0x99, 't', 'i' }; +static const symbol s_4_37[3] = { 'i', 'v', 'i' }; +static const symbol s_4_38[5] = { 'i', 't', 0xC4, 0x83, 'i' }; +static const symbol s_4_39[4] = { 'o', 0xC8, 0x99, 'i' }; +static const symbol s_4_40[7] = { 'i', 't', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_4_41[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_42[4] = { 'i', 'b', 'i', 'l' }; +static const symbol s_4_43[3] = { 'i', 's', 'm' }; +static const symbol s_4_44[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_4_45[2] = { 'o', 's' }; +static const symbol s_4_46[2] = { 'a', 't' }; +static const symbol s_4_47[2] = { 'i', 't' }; +static const symbol s_4_48[3] = { 'a', 'n', 't' }; +static const symbol s_4_49[3] = { 'i', 's', 't' }; +static const symbol s_4_50[2] = { 'u', 't' }; +static const symbol s_4_51[2] = { 'i', 'v' }; +static const symbol s_4_52[4] = { 'i', 'c', 0xC4, 0x83 }; +static const symbol s_4_53[6] = { 'a', 'b', 'i', 'l', 0xC4, 0x83 }; +static const symbol s_4_54[6] = { 'i', 'b', 'i', 'l', 0xC4, 0x83 }; +static const symbol s_4_55[5] = { 'o', 'a', 's', 0xC4, 0x83 }; +static const symbol s_4_56[4] = { 'a', 't', 0xC4, 0x83 }; +static const symbol s_4_57[4] = { 'i', 't', 0xC4, 0x83 }; +static const symbol s_4_58[5] = { 'a', 'n', 't', 0xC4, 0x83 }; +static const symbol s_4_59[5] = { 'i', 's', 't', 0xC4, 0x83 }; +static const symbol s_4_60[4] = { 'u', 't', 0xC4, 0x83 }; +static const symbol s_4_61[4] = { 'i', 'v', 0xC4, 0x83 }; +static const struct among a_4[62] = { +{ 3, s_4_0, 0, 1, 0}, +{ 5, s_4_1, 0, 1, 0}, +{ 5, s_4_2, 0, 1, 0}, +{ 4, s_4_3, 0, 1, 0}, +{ 3, s_4_4, 0, 1, 0}, +{ 3, s_4_5, 0, 1, 0}, +{ 4, s_4_6, 0, 1, 0}, +{ 4, s_4_7, 0, 3, 0}, +{ 3, s_4_8, 0, 1, 0}, +{ 3, s_4_9, 0, 1, 0}, +{ 2, s_4_10, 0, 1, 0}, +{ 3, s_4_11, 0, 1, 0}, +{ 5, s_4_12, 0, 1, 0}, +{ 5, s_4_13, 0, 1, 0}, +{ 4, s_4_14, 0, 3, 0}, +{ 4, s_4_15, 0, 2, 0}, +{ 4, s_4_16, 0, 1, 0}, +{ 3, s_4_17, 0, 1, 0}, +{ 5, s_4_18, -1, 1, 0}, +{ 3, s_4_19, 0, 1, 0}, +{ 4, s_4_20, 0, 1, 0}, +{ 4, s_4_21, 0, 3, 0}, +{ 3, s_4_22, 0, 1, 0}, +{ 3, s_4_23, 0, 1, 0}, +{ 3, s_4_24, 0, 1, 0}, +{ 5, s_4_25, 0, 1, 0}, +{ 5, s_4_26, 0, 1, 0}, +{ 4, s_4_27, 0, 2, 0}, +{ 5, s_4_28, 0, 1, 0}, +{ 3, s_4_29, 0, 1, 0}, +{ 3, s_4_30, 0, 1, 0}, +{ 5, s_4_31, -1, 1, 0}, +{ 3, s_4_32, 0, 1, 0}, +{ 4, s_4_33, 0, 1, 0}, +{ 4, s_4_34, 0, 3, 0}, +{ 3, s_4_35, 0, 1, 0}, +{ 5, s_4_36, 0, 3, 0}, +{ 3, s_4_37, 0, 1, 0}, +{ 5, s_4_38, 0, 1, 0}, +{ 4, s_4_39, 0, 1, 0}, +{ 7, s_4_40, 0, 1, 0}, +{ 4, s_4_41, 0, 1, 0}, +{ 4, s_4_42, 0, 1, 0}, +{ 3, s_4_43, 0, 3, 0}, +{ 4, s_4_44, 0, 1, 0}, +{ 2, s_4_45, 0, 1, 0}, +{ 2, s_4_46, 0, 1, 0}, +{ 2, s_4_47, 0, 1, 0}, +{ 3, s_4_48, 0, 1, 0}, +{ 3, s_4_49, 0, 3, 0}, +{ 2, s_4_50, 0, 1, 0}, +{ 2, s_4_51, 0, 1, 0}, +{ 4, s_4_52, 0, 1, 0}, +{ 6, s_4_53, 0, 1, 0}, +{ 6, s_4_54, 0, 1, 0}, +{ 5, s_4_55, 0, 1, 0}, +{ 4, s_4_56, 0, 1, 0}, +{ 4, s_4_57, 0, 1, 0}, +{ 5, s_4_58, 0, 1, 0}, +{ 5, s_4_59, 0, 3, 0}, +{ 4, s_4_60, 0, 1, 0}, +{ 4, s_4_61, 0, 1, 0} +}; + +static const symbol s_5_0[2] = { 'e', 'a' }; +static const symbol s_5_1[2] = { 'i', 'a' }; +static const symbol s_5_2[3] = { 'e', 's', 'c' }; +static const symbol s_5_3[4] = { 0xC4, 0x83, 's', 'c' }; +static const symbol s_5_4[3] = { 'i', 'n', 'd' }; +static const symbol s_5_5[4] = { 0xC3, 0xA2, 'n', 'd' }; +static const symbol s_5_6[3] = { 'a', 'r', 'e' }; +static const symbol s_5_7[3] = { 'e', 'r', 'e' }; +static const symbol s_5_8[3] = { 'i', 'r', 'e' }; +static const symbol s_5_9[4] = { 0xC3, 0xA2, 'r', 'e' }; +static const symbol s_5_10[2] = { 's', 'e' }; +static const symbol s_5_11[3] = { 'a', 's', 'e' }; +static const symbol s_5_12[4] = { 's', 'e', 's', 'e' }; +static const symbol s_5_13[3] = { 'i', 's', 'e' }; +static const symbol s_5_14[3] = { 'u', 's', 'e' }; +static const symbol s_5_15[4] = { 0xC3, 0xA2, 's', 'e' }; +static const symbol s_5_16[5] = { 'e', 0xC8, 0x99, 't', 'e' }; +static const symbol s_5_17[6] = { 0xC4, 0x83, 0xC8, 0x99, 't', 'e' }; +static const symbol s_5_18[3] = { 'e', 'z', 'e' }; +static const symbol s_5_19[2] = { 'a', 'i' }; +static const symbol s_5_20[3] = { 'e', 'a', 'i' }; +static const symbol s_5_21[3] = { 'i', 'a', 'i' }; +static const symbol s_5_22[3] = { 's', 'e', 'i' }; +static const symbol s_5_23[5] = { 'e', 0xC8, 0x99, 't', 'i' }; +static const symbol s_5_24[6] = { 0xC4, 0x83, 0xC8, 0x99, 't', 'i' }; +static const symbol s_5_25[2] = { 'u', 'i' }; +static const symbol s_5_26[3] = { 'e', 'z', 'i' }; +static const symbol s_5_27[4] = { 'a', 0xC8, 0x99, 'i' }; +static const symbol s_5_28[5] = { 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_29[6] = { 'a', 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_30[7] = { 's', 'e', 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_31[6] = { 'i', 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_32[6] = { 'u', 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_33[7] = { 0xC3, 0xA2, 's', 'e', 0xC8, 0x99, 'i' }; +static const symbol s_5_34[4] = { 'i', 0xC8, 0x99, 'i' }; +static const symbol s_5_35[4] = { 'u', 0xC8, 0x99, 'i' }; +static const symbol s_5_36[5] = { 0xC3, 0xA2, 0xC8, 0x99, 'i' }; +static const symbol s_5_37[4] = { 'a', 0xC8, 0x9B, 'i' }; +static const symbol s_5_38[5] = { 'e', 'a', 0xC8, 0x9B, 'i' }; +static const symbol s_5_39[5] = { 'i', 'a', 0xC8, 0x9B, 'i' }; +static const symbol s_5_40[4] = { 'e', 0xC8, 0x9B, 'i' }; +static const symbol s_5_41[4] = { 'i', 0xC8, 0x9B, 'i' }; +static const symbol s_5_42[7] = { 'a', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_43[8] = { 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_44[9] = { 'a', 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_45[10] = { 's', 'e', 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_46[9] = { 'i', 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_47[9] = { 'u', 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_48[10] = { 0xC3, 0xA2, 's', 'e', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_49[7] = { 'i', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_50[7] = { 'u', 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_51[8] = { 0xC3, 0xA2, 'r', 0xC4, 0x83, 0xC8, 0x9B, 'i' }; +static const symbol s_5_52[5] = { 0xC3, 0xA2, 0xC8, 0x9B, 'i' }; +static const symbol s_5_53[3] = { 0xC3, 0xA2, 'i' }; +static const symbol s_5_54[2] = { 'a', 'm' }; +static const symbol s_5_55[3] = { 'e', 'a', 'm' }; +static const symbol s_5_56[3] = { 'i', 'a', 'm' }; +static const symbol s_5_57[2] = { 'e', 'm' }; +static const symbol s_5_58[4] = { 'a', 's', 'e', 'm' }; +static const symbol s_5_59[5] = { 's', 'e', 's', 'e', 'm' }; +static const symbol s_5_60[4] = { 'i', 's', 'e', 'm' }; +static const symbol s_5_61[4] = { 'u', 's', 'e', 'm' }; +static const symbol s_5_62[5] = { 0xC3, 0xA2, 's', 'e', 'm' }; +static const symbol s_5_63[2] = { 'i', 'm' }; +static const symbol s_5_64[3] = { 0xC4, 0x83, 'm' }; +static const symbol s_5_65[5] = { 'a', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_66[6] = { 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_67[7] = { 'a', 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_68[8] = { 's', 'e', 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_69[7] = { 'i', 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_70[7] = { 'u', 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_71[8] = { 0xC3, 0xA2, 's', 'e', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_72[5] = { 'i', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_73[5] = { 'u', 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_74[6] = { 0xC3, 0xA2, 'r', 0xC4, 0x83, 'm' }; +static const symbol s_5_75[3] = { 0xC3, 0xA2, 'm' }; +static const symbol s_5_76[2] = { 'a', 'u' }; +static const symbol s_5_77[3] = { 'e', 'a', 'u' }; +static const symbol s_5_78[3] = { 'i', 'a', 'u' }; +static const symbol s_5_79[4] = { 'i', 'n', 'd', 'u' }; +static const symbol s_5_80[5] = { 0xC3, 0xA2, 'n', 'd', 'u' }; +static const symbol s_5_81[2] = { 'e', 'z' }; +static const symbol s_5_82[6] = { 'e', 'a', 's', 'c', 0xC4, 0x83 }; +static const symbol s_5_83[4] = { 'a', 'r', 0xC4, 0x83 }; +static const symbol s_5_84[5] = { 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_85[6] = { 'a', 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_86[7] = { 's', 'e', 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_87[6] = { 'i', 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_88[6] = { 'u', 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_89[7] = { 0xC3, 0xA2, 's', 'e', 'r', 0xC4, 0x83 }; +static const symbol s_5_90[4] = { 'i', 'r', 0xC4, 0x83 }; +static const symbol s_5_91[4] = { 'u', 'r', 0xC4, 0x83 }; +static const symbol s_5_92[5] = { 0xC3, 0xA2, 'r', 0xC4, 0x83 }; +static const symbol s_5_93[5] = { 'e', 'a', 'z', 0xC4, 0x83 }; +static const struct among a_5[94] = { +{ 2, s_5_0, 0, 1, 0}, +{ 2, s_5_1, 0, 1, 0}, +{ 3, s_5_2, 0, 1, 0}, +{ 4, s_5_3, 0, 1, 0}, +{ 3, s_5_4, 0, 1, 0}, +{ 4, s_5_5, 0, 1, 0}, +{ 3, s_5_6, 0, 1, 0}, +{ 3, s_5_7, 0, 1, 0}, +{ 3, s_5_8, 0, 1, 0}, +{ 4, s_5_9, 0, 1, 0}, +{ 2, s_5_10, 0, 2, 0}, +{ 3, s_5_11, -1, 1, 0}, +{ 4, s_5_12, -2, 2, 0}, +{ 3, s_5_13, -3, 1, 0}, +{ 3, s_5_14, -4, 1, 0}, +{ 4, s_5_15, -5, 1, 0}, +{ 5, s_5_16, 0, 1, 0}, +{ 6, s_5_17, 0, 1, 0}, +{ 3, s_5_18, 0, 1, 0}, +{ 2, s_5_19, 0, 1, 0}, +{ 3, s_5_20, -1, 1, 0}, +{ 3, s_5_21, -2, 1, 0}, +{ 3, s_5_22, 0, 2, 0}, +{ 5, s_5_23, 0, 1, 0}, +{ 6, s_5_24, 0, 1, 0}, +{ 2, s_5_25, 0, 1, 0}, +{ 3, s_5_26, 0, 1, 0}, +{ 4, s_5_27, 0, 1, 0}, +{ 5, s_5_28, 0, 2, 0}, +{ 6, s_5_29, -1, 1, 0}, +{ 7, s_5_30, -2, 2, 0}, +{ 6, s_5_31, -3, 1, 0}, +{ 6, s_5_32, -4, 1, 0}, +{ 7, s_5_33, -5, 1, 0}, +{ 4, s_5_34, 0, 1, 0}, +{ 4, s_5_35, 0, 1, 0}, +{ 5, s_5_36, 0, 1, 0}, +{ 4, s_5_37, 0, 2, 0}, +{ 5, s_5_38, -1, 1, 0}, +{ 5, s_5_39, -2, 1, 0}, +{ 4, s_5_40, 0, 2, 0}, +{ 4, s_5_41, 0, 2, 0}, +{ 7, s_5_42, 0, 1, 0}, +{ 8, s_5_43, 0, 2, 0}, +{ 9, s_5_44, -1, 1, 0}, +{ 10, s_5_45, -2, 2, 0}, +{ 9, s_5_46, -3, 1, 0}, +{ 9, s_5_47, -4, 1, 0}, +{ 10, s_5_48, -5, 1, 0}, +{ 7, s_5_49, 0, 1, 0}, +{ 7, s_5_50, 0, 1, 0}, +{ 8, s_5_51, 0, 1, 0}, +{ 5, s_5_52, 0, 2, 0}, +{ 3, s_5_53, 0, 1, 0}, +{ 2, s_5_54, 0, 1, 0}, +{ 3, s_5_55, -1, 1, 0}, +{ 3, s_5_56, -2, 1, 0}, +{ 2, s_5_57, 0, 2, 0}, +{ 4, s_5_58, -1, 1, 0}, +{ 5, s_5_59, -2, 2, 0}, +{ 4, s_5_60, -3, 1, 0}, +{ 4, s_5_61, -4, 1, 0}, +{ 5, s_5_62, -5, 1, 0}, +{ 2, s_5_63, 0, 2, 0}, +{ 3, s_5_64, 0, 2, 0}, +{ 5, s_5_65, -1, 1, 0}, +{ 6, s_5_66, -2, 2, 0}, +{ 7, s_5_67, -1, 1, 0}, +{ 8, s_5_68, -2, 2, 0}, +{ 7, s_5_69, -3, 1, 0}, +{ 7, s_5_70, -4, 1, 0}, +{ 8, s_5_71, -5, 1, 0}, +{ 5, s_5_72, -8, 1, 0}, +{ 5, s_5_73, -9, 1, 0}, +{ 6, s_5_74, -10, 1, 0}, +{ 3, s_5_75, 0, 2, 0}, +{ 2, s_5_76, 0, 1, 0}, +{ 3, s_5_77, -1, 1, 0}, +{ 3, s_5_78, -2, 1, 0}, +{ 4, s_5_79, 0, 1, 0}, +{ 5, s_5_80, 0, 1, 0}, +{ 2, s_5_81, 0, 1, 0}, +{ 6, s_5_82, 0, 1, 0}, +{ 4, s_5_83, 0, 1, 0}, +{ 5, s_5_84, 0, 2, 0}, +{ 6, s_5_85, -1, 1, 0}, +{ 7, s_5_86, -2, 2, 0}, +{ 6, s_5_87, -3, 1, 0}, +{ 6, s_5_88, -4, 1, 0}, +{ 7, s_5_89, -5, 1, 0}, +{ 4, s_5_90, 0, 1, 0}, +{ 4, s_5_91, 0, 1, 0}, +{ 5, s_5_92, 0, 1, 0}, +{ 5, s_5_93, 0, 1, 0} +}; + +static const symbol s_6_0[1] = { 'a' }; +static const symbol s_6_1[1] = { 'e' }; +static const symbol s_6_2[2] = { 'i', 'e' }; +static const symbol s_6_3[1] = { 'i' }; +static const symbol s_6_4[2] = { 0xC4, 0x83 }; +static const struct among a_6[5] = { +{ 1, s_6_0, 0, 1, 0}, +{ 1, s_6_1, 0, 1, 0}, +{ 2, s_6_2, -1, 1, 0}, +{ 1, s_6_3, 0, 1, 0}, +{ 2, s_6_4, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 4 }; + +static const symbol s_0[] = { 0xC8, 0x99 }; +static const symbol s_1[] = { 0xC8, 0x9B }; +static const symbol s_2[] = { 'U' }; +static const symbol s_3[] = { 'I' }; +static const symbol s_4[] = { 'i' }; +static const symbol s_5[] = { 'u' }; +static const symbol s_6[] = { 'a' }; +static const symbol s_7[] = { 'e' }; +static const symbol s_8[] = { 'i' }; +static const symbol s_9[] = { 'a', 'b' }; +static const symbol s_10[] = { 'i' }; +static const symbol s_11[] = { 'a', 't' }; +static const symbol s_12[] = { 'a', 0xC8, 0x9B, 'i' }; +static const symbol s_13[] = { 'a', 'b', 'i', 'l' }; +static const symbol s_14[] = { 'i', 'b', 'i', 'l' }; +static const symbol s_15[] = { 'i', 'v' }; +static const symbol s_16[] = { 'i', 'c' }; +static const symbol s_17[] = { 'a', 't' }; +static const symbol s_18[] = { 'i', 't' }; +static const symbol s_19[] = { 0xC8, 0x9B }; +static const symbol s_20[] = { 't' }; +static const symbol s_21[] = { 'i', 's', 't' }; + +static int r_norm(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || (z->p[z->c + 1] != 159 && z->p[z->c + 1] != 163)) goto lab2; + among_var = find_among(z, a_0, 2); + if (!among_var) goto lab2; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + } + z->c = v_3; + break; + lab2: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + return 1; +} + +static int r_prelude(struct SN_env * z) { + while (1) { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab1; + z->bra = z->c; + { + int v_3 = z->c; + if (z->c == z->l || z->p[z->c] != 'u') goto lab3; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab3; + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = v_3; + if (z->c == z->l || z->p[z->c] != 'i') goto lab1; + z->c++; + z->ket = z->c; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab1; + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + } + lab2: + z->c = v_2; + break; + lab1: + z->c = v_2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping_U(z, g_v, 97, 259, 0)) goto lab4; + { + int ret = out_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab2; + { + int ret = in_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping_U(z, g_v, 97, 259, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping_U(z, g_v, 97, 259, 0)) goto lab6; + { + int ret = out_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 259, 0)) goto lab0; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 259, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 85)) among_var = 3; else + among_var = find_among(z, a_1, 3); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_step_0(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((266786 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_2, 16); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 5: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 2, s_9))) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_11); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 4, s_12); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_combo_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_3, 46); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 4, s_14); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 2, s_15); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_16); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_17); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_18); + if (ret < 0) return ret; + } + break; + } + z->I[3] = 1; + z->c = z->l - v_1; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->I[3] = 0; + while (1) { + int v_1 = z->l - z->c; + { + int ret = r_combo_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + continue; + lab0: + z->c = z->l - v_1; + break; + } + z->ket = z->c; + among_var = find_among_b(z, a_4, 62); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (!(eq_s_b(z, 2, s_19))) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 1, s_20); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + break; + } + z->I[3] = 1; + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + among_var = find_among_b(z, a_5, 94); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (out_grouping_b_U(z, g_v, 97, 259, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') { z->lb = v_1; return 0; } + z->c--; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->lb = v_1; + } + return 1; +} + +static int r_vowel_suffix(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_6, 5)) return 0; + z->bra = z->c; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +extern int romanian_UTF_8_stem(struct SN_env * z) { + { + int ret = r_norm(z); + if (ret < 0) return ret; + } + { + int v_1 = z->c; + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_step_0(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + if (!(z->I[3])) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_5; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_4; + } + { + int v_6 = z->l - z->c; + { + int ret = r_vowel_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + z->c = z->lb; + { + int v_7 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_7; + } + return 1; +} + +extern struct SN_env * romanian_UTF_8_create_env(void) { return SN_create_env(0, 4); } + +extern void romanian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_romanian.h b/contrib/libs/snowball/src_c/stem_UTF_8_romanian.h new file mode 100644 index 000000000000..f4318579080a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_romanian.h @@ -0,0 +1,15 @@ +/* Generated from romanian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * romanian_UTF_8_create_env(void); +extern void romanian_UTF_8_close_env(struct SN_env * z); + +extern int romanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_russian.c b/contrib/libs/snowball/src_c/stem_UTF_8_russian.c new file mode 100644 index 000000000000..c1efd04b956f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_russian.c @@ -0,0 +1,700 @@ +/* Generated from russian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int russian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_tidy_up(struct SN_env * z); +static int r_derivational(struct SN_env * z); +static int r_noun(struct SN_env * z); +static int r_verb(struct SN_env * z); +static int r_reflexive(struct SN_env * z); +static int r_adjectival(struct SN_env * z); +static int r_adjective(struct SN_env * z); +static int r_perfective_gerund(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * russian_UTF_8_create_env(void); +extern void russian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[10] = { 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8, 0xD1, 0x81, 0xD1, 0x8C }; +static const symbol s_0_1[12] = { 0xD1, 0x8B, 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8, 0xD1, 0x81, 0xD1, 0x8C }; +static const symbol s_0_2[12] = { 0xD0, 0xB8, 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8, 0xD1, 0x81, 0xD1, 0x8C }; +static const symbol s_0_3[2] = { 0xD0, 0xB2 }; +static const symbol s_0_4[4] = { 0xD1, 0x8B, 0xD0, 0xB2 }; +static const symbol s_0_5[4] = { 0xD0, 0xB8, 0xD0, 0xB2 }; +static const symbol s_0_6[6] = { 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8 }; +static const symbol s_0_7[8] = { 0xD1, 0x8B, 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8 }; +static const symbol s_0_8[8] = { 0xD0, 0xB8, 0xD0, 0xB2, 0xD1, 0x88, 0xD0, 0xB8 }; +static const struct among a_0[9] = { +{ 10, s_0_0, 0, 1, 0}, +{ 12, s_0_1, -1, 2, 0}, +{ 12, s_0_2, -2, 2, 0}, +{ 2, s_0_3, 0, 1, 0}, +{ 4, s_0_4, -1, 2, 0}, +{ 4, s_0_5, -2, 2, 0}, +{ 6, s_0_6, 0, 1, 0}, +{ 8, s_0_7, -1, 2, 0}, +{ 8, s_0_8, -2, 2, 0} +}; + +static const symbol s_1_0[6] = { 0xD0, 0xB5, 0xD0, 0xBC, 0xD1, 0x83 }; +static const symbol s_1_1[6] = { 0xD0, 0xBE, 0xD0, 0xBC, 0xD1, 0x83 }; +static const symbol s_1_2[4] = { 0xD1, 0x8B, 0xD1, 0x85 }; +static const symbol s_1_3[4] = { 0xD0, 0xB8, 0xD1, 0x85 }; +static const symbol s_1_4[4] = { 0xD1, 0x83, 0xD1, 0x8E }; +static const symbol s_1_5[4] = { 0xD1, 0x8E, 0xD1, 0x8E }; +static const symbol s_1_6[4] = { 0xD0, 0xB5, 0xD1, 0x8E }; +static const symbol s_1_7[4] = { 0xD0, 0xBE, 0xD1, 0x8E }; +static const symbol s_1_8[4] = { 0xD1, 0x8F, 0xD1, 0x8F }; +static const symbol s_1_9[4] = { 0xD0, 0xB0, 0xD1, 0x8F }; +static const symbol s_1_10[4] = { 0xD1, 0x8B, 0xD0, 0xB5 }; +static const symbol s_1_11[4] = { 0xD0, 0xB5, 0xD0, 0xB5 }; +static const symbol s_1_12[4] = { 0xD0, 0xB8, 0xD0, 0xB5 }; +static const symbol s_1_13[4] = { 0xD0, 0xBE, 0xD0, 0xB5 }; +static const symbol s_1_14[6] = { 0xD1, 0x8B, 0xD0, 0xBC, 0xD0, 0xB8 }; +static const symbol s_1_15[6] = { 0xD0, 0xB8, 0xD0, 0xBC, 0xD0, 0xB8 }; +static const symbol s_1_16[4] = { 0xD1, 0x8B, 0xD0, 0xB9 }; +static const symbol s_1_17[4] = { 0xD0, 0xB5, 0xD0, 0xB9 }; +static const symbol s_1_18[4] = { 0xD0, 0xB8, 0xD0, 0xB9 }; +static const symbol s_1_19[4] = { 0xD0, 0xBE, 0xD0, 0xB9 }; +static const symbol s_1_20[4] = { 0xD1, 0x8B, 0xD0, 0xBC }; +static const symbol s_1_21[4] = { 0xD0, 0xB5, 0xD0, 0xBC }; +static const symbol s_1_22[4] = { 0xD0, 0xB8, 0xD0, 0xBC }; +static const symbol s_1_23[4] = { 0xD0, 0xBE, 0xD0, 0xBC }; +static const symbol s_1_24[6] = { 0xD0, 0xB5, 0xD0, 0xB3, 0xD0, 0xBE }; +static const symbol s_1_25[6] = { 0xD0, 0xBE, 0xD0, 0xB3, 0xD0, 0xBE }; +static const struct among a_1[26] = { +{ 6, s_1_0, 0, 1, 0}, +{ 6, s_1_1, 0, 1, 0}, +{ 4, s_1_2, 0, 1, 0}, +{ 4, s_1_3, 0, 1, 0}, +{ 4, s_1_4, 0, 1, 0}, +{ 4, s_1_5, 0, 1, 0}, +{ 4, s_1_6, 0, 1, 0}, +{ 4, s_1_7, 0, 1, 0}, +{ 4, s_1_8, 0, 1, 0}, +{ 4, s_1_9, 0, 1, 0}, +{ 4, s_1_10, 0, 1, 0}, +{ 4, s_1_11, 0, 1, 0}, +{ 4, s_1_12, 0, 1, 0}, +{ 4, s_1_13, 0, 1, 0}, +{ 6, s_1_14, 0, 1, 0}, +{ 6, s_1_15, 0, 1, 0}, +{ 4, s_1_16, 0, 1, 0}, +{ 4, s_1_17, 0, 1, 0}, +{ 4, s_1_18, 0, 1, 0}, +{ 4, s_1_19, 0, 1, 0}, +{ 4, s_1_20, 0, 1, 0}, +{ 4, s_1_21, 0, 1, 0}, +{ 4, s_1_22, 0, 1, 0}, +{ 4, s_1_23, 0, 1, 0}, +{ 6, s_1_24, 0, 1, 0}, +{ 6, s_1_25, 0, 1, 0} +}; + +static const symbol s_2_0[4] = { 0xD0, 0xB2, 0xD1, 0x88 }; +static const symbol s_2_1[6] = { 0xD1, 0x8B, 0xD0, 0xB2, 0xD1, 0x88 }; +static const symbol s_2_2[6] = { 0xD0, 0xB8, 0xD0, 0xB2, 0xD1, 0x88 }; +static const symbol s_2_3[2] = { 0xD1, 0x89 }; +static const symbol s_2_4[4] = { 0xD1, 0x8E, 0xD1, 0x89 }; +static const symbol s_2_5[6] = { 0xD1, 0x83, 0xD1, 0x8E, 0xD1, 0x89 }; +static const symbol s_2_6[4] = { 0xD0, 0xB5, 0xD0, 0xBC }; +static const symbol s_2_7[4] = { 0xD0, 0xBD, 0xD0, 0xBD }; +static const struct among a_2[8] = { +{ 4, s_2_0, 0, 1, 0}, +{ 6, s_2_1, -1, 2, 0}, +{ 6, s_2_2, -2, 2, 0}, +{ 2, s_2_3, 0, 1, 0}, +{ 4, s_2_4, -1, 1, 0}, +{ 6, s_2_5, -1, 2, 0}, +{ 4, s_2_6, 0, 1, 0}, +{ 4, s_2_7, 0, 1, 0} +}; + +static const symbol s_3_0[4] = { 0xD1, 0x81, 0xD1, 0x8C }; +static const symbol s_3_1[4] = { 0xD1, 0x81, 0xD1, 0x8F }; +static const struct among a_3[2] = { +{ 4, s_3_0, 0, 1, 0}, +{ 4, s_3_1, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 0xD1, 0x8B, 0xD1, 0x82 }; +static const symbol s_4_1[4] = { 0xD1, 0x8E, 0xD1, 0x82 }; +static const symbol s_4_2[6] = { 0xD1, 0x83, 0xD1, 0x8E, 0xD1, 0x82 }; +static const symbol s_4_3[4] = { 0xD1, 0x8F, 0xD1, 0x82 }; +static const symbol s_4_4[4] = { 0xD0, 0xB5, 0xD1, 0x82 }; +static const symbol s_4_5[6] = { 0xD1, 0x83, 0xD0, 0xB5, 0xD1, 0x82 }; +static const symbol s_4_6[4] = { 0xD0, 0xB8, 0xD1, 0x82 }; +static const symbol s_4_7[4] = { 0xD0, 0xBD, 0xD1, 0x8B }; +static const symbol s_4_8[6] = { 0xD0, 0xB5, 0xD0, 0xBD, 0xD1, 0x8B }; +static const symbol s_4_9[4] = { 0xD1, 0x82, 0xD1, 0x8C }; +static const symbol s_4_10[6] = { 0xD1, 0x8B, 0xD1, 0x82, 0xD1, 0x8C }; +static const symbol s_4_11[6] = { 0xD0, 0xB8, 0xD1, 0x82, 0xD1, 0x8C }; +static const symbol s_4_12[6] = { 0xD0, 0xB5, 0xD1, 0x88, 0xD1, 0x8C }; +static const symbol s_4_13[6] = { 0xD0, 0xB8, 0xD1, 0x88, 0xD1, 0x8C }; +static const symbol s_4_14[2] = { 0xD1, 0x8E }; +static const symbol s_4_15[4] = { 0xD1, 0x83, 0xD1, 0x8E }; +static const symbol s_4_16[4] = { 0xD0, 0xBB, 0xD0, 0xB0 }; +static const symbol s_4_17[6] = { 0xD1, 0x8B, 0xD0, 0xBB, 0xD0, 0xB0 }; +static const symbol s_4_18[6] = { 0xD0, 0xB8, 0xD0, 0xBB, 0xD0, 0xB0 }; +static const symbol s_4_19[4] = { 0xD0, 0xBD, 0xD0, 0xB0 }; +static const symbol s_4_20[6] = { 0xD0, 0xB5, 0xD0, 0xBD, 0xD0, 0xB0 }; +static const symbol s_4_21[6] = { 0xD0, 0xB5, 0xD1, 0x82, 0xD0, 0xB5 }; +static const symbol s_4_22[6] = { 0xD0, 0xB8, 0xD1, 0x82, 0xD0, 0xB5 }; +static const symbol s_4_23[6] = { 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5 }; +static const symbol s_4_24[8] = { 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5 }; +static const symbol s_4_25[8] = { 0xD0, 0xB5, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5 }; +static const symbol s_4_26[4] = { 0xD0, 0xBB, 0xD0, 0xB8 }; +static const symbol s_4_27[6] = { 0xD1, 0x8B, 0xD0, 0xBB, 0xD0, 0xB8 }; +static const symbol s_4_28[6] = { 0xD0, 0xB8, 0xD0, 0xBB, 0xD0, 0xB8 }; +static const symbol s_4_29[2] = { 0xD0, 0xB9 }; +static const symbol s_4_30[4] = { 0xD1, 0x83, 0xD0, 0xB9 }; +static const symbol s_4_31[4] = { 0xD0, 0xB5, 0xD0, 0xB9 }; +static const symbol s_4_32[2] = { 0xD0, 0xBB }; +static const symbol s_4_33[4] = { 0xD1, 0x8B, 0xD0, 0xBB }; +static const symbol s_4_34[4] = { 0xD0, 0xB8, 0xD0, 0xBB }; +static const symbol s_4_35[4] = { 0xD1, 0x8B, 0xD0, 0xBC }; +static const symbol s_4_36[4] = { 0xD0, 0xB5, 0xD0, 0xBC }; +static const symbol s_4_37[4] = { 0xD0, 0xB8, 0xD0, 0xBC }; +static const symbol s_4_38[2] = { 0xD0, 0xBD }; +static const symbol s_4_39[4] = { 0xD0, 0xB5, 0xD0, 0xBD }; +static const symbol s_4_40[4] = { 0xD0, 0xBB, 0xD0, 0xBE }; +static const symbol s_4_41[6] = { 0xD1, 0x8B, 0xD0, 0xBB, 0xD0, 0xBE }; +static const symbol s_4_42[6] = { 0xD0, 0xB8, 0xD0, 0xBB, 0xD0, 0xBE }; +static const symbol s_4_43[4] = { 0xD0, 0xBD, 0xD0, 0xBE }; +static const symbol s_4_44[6] = { 0xD0, 0xB5, 0xD0, 0xBD, 0xD0, 0xBE }; +static const symbol s_4_45[6] = { 0xD0, 0xBD, 0xD0, 0xBD, 0xD0, 0xBE }; +static const struct among a_4[46] = { +{ 4, s_4_0, 0, 2, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 6, s_4_2, -1, 2, 0}, +{ 4, s_4_3, 0, 2, 0}, +{ 4, s_4_4, 0, 1, 0}, +{ 6, s_4_5, -1, 2, 0}, +{ 4, s_4_6, 0, 2, 0}, +{ 4, s_4_7, 0, 1, 0}, +{ 6, s_4_8, -1, 2, 0}, +{ 4, s_4_9, 0, 1, 0}, +{ 6, s_4_10, -1, 2, 0}, +{ 6, s_4_11, -2, 2, 0}, +{ 6, s_4_12, 0, 1, 0}, +{ 6, s_4_13, 0, 2, 0}, +{ 2, s_4_14, 0, 2, 0}, +{ 4, s_4_15, -1, 2, 0}, +{ 4, s_4_16, 0, 1, 0}, +{ 6, s_4_17, -1, 2, 0}, +{ 6, s_4_18, -2, 2, 0}, +{ 4, s_4_19, 0, 1, 0}, +{ 6, s_4_20, -1, 2, 0}, +{ 6, s_4_21, 0, 1, 0}, +{ 6, s_4_22, 0, 2, 0}, +{ 6, s_4_23, 0, 1, 0}, +{ 8, s_4_24, -1, 2, 0}, +{ 8, s_4_25, -2, 2, 0}, +{ 4, s_4_26, 0, 1, 0}, +{ 6, s_4_27, -1, 2, 0}, +{ 6, s_4_28, -2, 2, 0}, +{ 2, s_4_29, 0, 1, 0}, +{ 4, s_4_30, -1, 2, 0}, +{ 4, s_4_31, -2, 2, 0}, +{ 2, s_4_32, 0, 1, 0}, +{ 4, s_4_33, -1, 2, 0}, +{ 4, s_4_34, -2, 2, 0}, +{ 4, s_4_35, 0, 2, 0}, +{ 4, s_4_36, 0, 1, 0}, +{ 4, s_4_37, 0, 2, 0}, +{ 2, s_4_38, 0, 1, 0}, +{ 4, s_4_39, -1, 2, 0}, +{ 4, s_4_40, 0, 1, 0}, +{ 6, s_4_41, -1, 2, 0}, +{ 6, s_4_42, -2, 2, 0}, +{ 4, s_4_43, 0, 1, 0}, +{ 6, s_4_44, -1, 2, 0}, +{ 6, s_4_45, -2, 1, 0} +}; + +static const symbol s_5_0[2] = { 0xD1, 0x83 }; +static const symbol s_5_1[4] = { 0xD1, 0x8F, 0xD1, 0x85 }; +static const symbol s_5_2[6] = { 0xD0, 0xB8, 0xD1, 0x8F, 0xD1, 0x85 }; +static const symbol s_5_3[4] = { 0xD0, 0xB0, 0xD1, 0x85 }; +static const symbol s_5_4[2] = { 0xD1, 0x8B }; +static const symbol s_5_5[2] = { 0xD1, 0x8C }; +static const symbol s_5_6[2] = { 0xD1, 0x8E }; +static const symbol s_5_7[4] = { 0xD1, 0x8C, 0xD1, 0x8E }; +static const symbol s_5_8[4] = { 0xD0, 0xB8, 0xD1, 0x8E }; +static const symbol s_5_9[2] = { 0xD1, 0x8F }; +static const symbol s_5_10[4] = { 0xD1, 0x8C, 0xD1, 0x8F }; +static const symbol s_5_11[4] = { 0xD0, 0xB8, 0xD1, 0x8F }; +static const symbol s_5_12[2] = { 0xD0, 0xB0 }; +static const symbol s_5_13[4] = { 0xD0, 0xB5, 0xD0, 0xB2 }; +static const symbol s_5_14[4] = { 0xD0, 0xBE, 0xD0, 0xB2 }; +static const symbol s_5_15[2] = { 0xD0, 0xB5 }; +static const symbol s_5_16[4] = { 0xD1, 0x8C, 0xD0, 0xB5 }; +static const symbol s_5_17[4] = { 0xD0, 0xB8, 0xD0, 0xB5 }; +static const symbol s_5_18[2] = { 0xD0, 0xB8 }; +static const symbol s_5_19[4] = { 0xD0, 0xB5, 0xD0, 0xB8 }; +static const symbol s_5_20[4] = { 0xD0, 0xB8, 0xD0, 0xB8 }; +static const symbol s_5_21[6] = { 0xD1, 0x8F, 0xD0, 0xBC, 0xD0, 0xB8 }; +static const symbol s_5_22[8] = { 0xD0, 0xB8, 0xD1, 0x8F, 0xD0, 0xBC, 0xD0, 0xB8 }; +static const symbol s_5_23[6] = { 0xD0, 0xB0, 0xD0, 0xBC, 0xD0, 0xB8 }; +static const symbol s_5_24[2] = { 0xD0, 0xB9 }; +static const symbol s_5_25[4] = { 0xD0, 0xB5, 0xD0, 0xB9 }; +static const symbol s_5_26[6] = { 0xD0, 0xB8, 0xD0, 0xB5, 0xD0, 0xB9 }; +static const symbol s_5_27[4] = { 0xD0, 0xB8, 0xD0, 0xB9 }; +static const symbol s_5_28[4] = { 0xD0, 0xBE, 0xD0, 0xB9 }; +static const symbol s_5_29[4] = { 0xD1, 0x8F, 0xD0, 0xBC }; +static const symbol s_5_30[6] = { 0xD0, 0xB8, 0xD1, 0x8F, 0xD0, 0xBC }; +static const symbol s_5_31[4] = { 0xD0, 0xB0, 0xD0, 0xBC }; +static const symbol s_5_32[4] = { 0xD0, 0xB5, 0xD0, 0xBC }; +static const symbol s_5_33[6] = { 0xD0, 0xB8, 0xD0, 0xB5, 0xD0, 0xBC }; +static const symbol s_5_34[4] = { 0xD0, 0xBE, 0xD0, 0xBC }; +static const symbol s_5_35[2] = { 0xD0, 0xBE }; +static const struct among a_5[36] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 6, s_5_2, -1, 1, 0}, +{ 4, s_5_3, 0, 1, 0}, +{ 2, s_5_4, 0, 1, 0}, +{ 2, s_5_5, 0, 1, 0}, +{ 2, s_5_6, 0, 1, 0}, +{ 4, s_5_7, -1, 1, 0}, +{ 4, s_5_8, -2, 1, 0}, +{ 2, s_5_9, 0, 1, 0}, +{ 4, s_5_10, -1, 1, 0}, +{ 4, s_5_11, -2, 1, 0}, +{ 2, s_5_12, 0, 1, 0}, +{ 4, s_5_13, 0, 1, 0}, +{ 4, s_5_14, 0, 1, 0}, +{ 2, s_5_15, 0, 1, 0}, +{ 4, s_5_16, -1, 1, 0}, +{ 4, s_5_17, -2, 1, 0}, +{ 2, s_5_18, 0, 1, 0}, +{ 4, s_5_19, -1, 1, 0}, +{ 4, s_5_20, -2, 1, 0}, +{ 6, s_5_21, -3, 1, 0}, +{ 8, s_5_22, -1, 1, 0}, +{ 6, s_5_23, -5, 1, 0}, +{ 2, s_5_24, 0, 1, 0}, +{ 4, s_5_25, -1, 1, 0}, +{ 6, s_5_26, -1, 1, 0}, +{ 4, s_5_27, -3, 1, 0}, +{ 4, s_5_28, -4, 1, 0}, +{ 4, s_5_29, 0, 1, 0}, +{ 6, s_5_30, -1, 1, 0}, +{ 4, s_5_31, 0, 1, 0}, +{ 4, s_5_32, 0, 1, 0}, +{ 6, s_5_33, -1, 1, 0}, +{ 4, s_5_34, 0, 1, 0}, +{ 2, s_5_35, 0, 1, 0} +}; + +static const symbol s_6_0[6] = { 0xD0, 0xBE, 0xD1, 0x81, 0xD1, 0x82 }; +static const symbol s_6_1[8] = { 0xD0, 0xBE, 0xD1, 0x81, 0xD1, 0x82, 0xD1, 0x8C }; +static const struct among a_6[2] = { +{ 6, s_6_0, 0, 1, 0}, +{ 8, s_6_1, 0, 1, 0} +}; + +static const symbol s_7_0[6] = { 0xD0, 0xB5, 0xD0, 0xB9, 0xD1, 0x88 }; +static const symbol s_7_1[2] = { 0xD1, 0x8C }; +static const symbol s_7_2[8] = { 0xD0, 0xB5, 0xD0, 0xB9, 0xD1, 0x88, 0xD0, 0xB5 }; +static const symbol s_7_3[2] = { 0xD0, 0xBD }; +static const struct among a_7[4] = { +{ 6, s_7_0, 0, 1, 0}, +{ 2, s_7_1, 0, 3, 0}, +{ 8, s_7_2, 0, 1, 0}, +{ 2, s_7_3, 0, 2, 0} +}; + +static const unsigned char g_v[] = { 33, 65, 8, 232 }; + +static const symbol s_0[] = { 0xD0, 0xB0 }; +static const symbol s_1[] = { 0xD1, 0x8F }; +static const symbol s_2[] = { 0xD0, 0xB0 }; +static const symbol s_3[] = { 0xD1, 0x8F }; +static const symbol s_4[] = { 0xD0, 0xB0 }; +static const symbol s_5[] = { 0xD1, 0x8F }; +static const symbol s_6[] = { 0xD0, 0xBD }; +static const symbol s_7[] = { 0xD0, 0xBD }; +static const symbol s_8[] = { 0xD0, 0xBD }; +static const symbol s_9[] = { 0xD1, 0x91 }; +static const symbol s_10[] = { 0xD0, 0xB5 }; +static const symbol s_11[] = { 0xD0, 0xB8 }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int ret = out_grouping_U(z, g_v, 1072, 1103, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = in_grouping_U(z, g_v, 1072, 1103, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = out_grouping_U(z, g_v, 1072, 1103, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 1072, 1103, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[0] = z->c; + lab0: + z->c = v_1; + } + return 1; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_perfective_gerund(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_0, 9); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 2, s_0))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_1))) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_adjective(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_1, 26)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_adjectival(struct SN_env * z) { + int among_var; + { + int ret = r_adjective(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_2, 8); + if (!among_var) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_2))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_3))) { z->c = z->l - v_1; goto lab0; } + } + lab1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab0: + ; + } + return 1; +} + +static int r_reflexive(struct SN_env * z) { + z->ket = z->c; + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 140 && z->p[z->c - 1] != 143)) return 0; + if (!find_among_b(z, a_3, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_verb(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_4, 46); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 2, s_4))) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_1; + if (!(eq_s_b(z, 2, s_5))) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_noun(struct SN_env * z) { + z->ket = z->c; + if (!find_among_b(z, a_5, 36)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_derivational(struct SN_env * z) { + z->ket = z->c; + if (z->c - 5 <= z->lb || (z->p[z->c - 1] != 130 && z->p[z->c - 1] != 140)) return 0; + if (!find_among_b(z, a_6, 2)) return 0; + z->bra = z->c; + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_tidy_up(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_7, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + if (!(eq_s_b(z, 2, s_6))) return 0; + z->bra = z->c; + if (!(eq_s_b(z, 2, s_7))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (!(eq_s_b(z, 2, s_8))) return 0; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int russian_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + z->bra = z->c; + if (!(eq_s(z, 2, s_9))) goto lab2; + z->ket = z->c; + z->c = v_3; + break; + lab2: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + + { + int v_4; + if (z->c < z->I[1]) return 0; + v_4 = z->lb; z->lb = z->I[1]; + { + int v_5 = z->l - z->c; + { + int v_6 = z->l - z->c; + { + int ret = r_perfective_gerund(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_6; + { + int v_7 = z->l - z->c; + { + int ret = r_reflexive(z); + if (ret == 0) { z->c = z->l - v_7; goto lab6; } + if (ret < 0) return ret; + } + lab6: + ; + } + { + int v_8 = z->l - z->c; + { + int ret = r_adjectival(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_8; + { + int ret = r_verb(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + goto lab7; + lab9: + z->c = z->l - v_8; + { + int ret = r_noun(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + } + lab7: + ; + } + lab4: + lab3: + z->c = z->l - v_5; + } + { + int v_9 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_11))) { z->c = z->l - v_9; goto lab10; } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab10: + ; + } + { + int v_10 = z->l - z->c; + { + int ret = r_derivational(z); + if (ret < 0) return ret; + } + z->c = z->l - v_10; + } + { + int v_11 = z->l - z->c; + { + int ret = r_tidy_up(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + } + z->lb = v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * russian_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void russian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_russian.h b/contrib/libs/snowball/src_c/stem_UTF_8_russian.h new file mode 100644 index 000000000000..3856027d68e0 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_russian.h @@ -0,0 +1,15 @@ +/* Generated from russian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_UTF_8_create_env(void); +extern void russian_UTF_8_close_env(struct SN_env * z); + +extern int russian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_serbian.c b/contrib/libs/snowball/src_c/stem_UTF_8_serbian.c new file mode 100644 index 000000000000..23edf07b160e --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_serbian.c @@ -0,0 +1,6843 @@ +/* Generated from serbian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int serbian_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_prelude(struct SN_env * z); +static int r_cyr_to_lat(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * serbian_UTF_8_create_env(void); +extern void serbian_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 0xD0, 0xB0 }; +static const symbol s_0_1[2] = { 0xD0, 0xB1 }; +static const symbol s_0_2[2] = { 0xD0, 0xB2 }; +static const symbol s_0_3[2] = { 0xD0, 0xB3 }; +static const symbol s_0_4[2] = { 0xD0, 0xB4 }; +static const symbol s_0_5[2] = { 0xD0, 0xB5 }; +static const symbol s_0_6[2] = { 0xD0, 0xB6 }; +static const symbol s_0_7[2] = { 0xD0, 0xB7 }; +static const symbol s_0_8[2] = { 0xD0, 0xB8 }; +static const symbol s_0_9[2] = { 0xD0, 0xBA }; +static const symbol s_0_10[2] = { 0xD0, 0xBB }; +static const symbol s_0_11[2] = { 0xD0, 0xBC }; +static const symbol s_0_12[2] = { 0xD0, 0xBD }; +static const symbol s_0_13[2] = { 0xD0, 0xBE }; +static const symbol s_0_14[2] = { 0xD0, 0xBF }; +static const symbol s_0_15[2] = { 0xD1, 0x80 }; +static const symbol s_0_16[2] = { 0xD1, 0x81 }; +static const symbol s_0_17[2] = { 0xD1, 0x82 }; +static const symbol s_0_18[2] = { 0xD1, 0x83 }; +static const symbol s_0_19[2] = { 0xD1, 0x84 }; +static const symbol s_0_20[2] = { 0xD1, 0x85 }; +static const symbol s_0_21[2] = { 0xD1, 0x86 }; +static const symbol s_0_22[2] = { 0xD1, 0x87 }; +static const symbol s_0_23[2] = { 0xD1, 0x88 }; +static const symbol s_0_24[2] = { 0xD1, 0x92 }; +static const symbol s_0_25[2] = { 0xD1, 0x98 }; +static const symbol s_0_26[2] = { 0xD1, 0x99 }; +static const symbol s_0_27[2] = { 0xD1, 0x9A }; +static const symbol s_0_28[2] = { 0xD1, 0x9B }; +static const symbol s_0_29[2] = { 0xD1, 0x9F }; +static const struct among a_0[30] = { +{ 2, s_0_0, 0, 1, 0}, +{ 2, s_0_1, 0, 2, 0}, +{ 2, s_0_2, 0, 3, 0}, +{ 2, s_0_3, 0, 4, 0}, +{ 2, s_0_4, 0, 5, 0}, +{ 2, s_0_5, 0, 7, 0}, +{ 2, s_0_6, 0, 8, 0}, +{ 2, s_0_7, 0, 9, 0}, +{ 2, s_0_8, 0, 10, 0}, +{ 2, s_0_9, 0, 12, 0}, +{ 2, s_0_10, 0, 13, 0}, +{ 2, s_0_11, 0, 15, 0}, +{ 2, s_0_12, 0, 16, 0}, +{ 2, s_0_13, 0, 18, 0}, +{ 2, s_0_14, 0, 19, 0}, +{ 2, s_0_15, 0, 20, 0}, +{ 2, s_0_16, 0, 21, 0}, +{ 2, s_0_17, 0, 22, 0}, +{ 2, s_0_18, 0, 24, 0}, +{ 2, s_0_19, 0, 25, 0}, +{ 2, s_0_20, 0, 26, 0}, +{ 2, s_0_21, 0, 27, 0}, +{ 2, s_0_22, 0, 28, 0}, +{ 2, s_0_23, 0, 30, 0}, +{ 2, s_0_24, 0, 6, 0}, +{ 2, s_0_25, 0, 11, 0}, +{ 2, s_0_26, 0, 14, 0}, +{ 2, s_0_27, 0, 17, 0}, +{ 2, s_0_28, 0, 23, 0}, +{ 2, s_0_29, 0, 29, 0} +}; + +static const symbol s_1_0[4] = { 'd', 'a', 'b', 'a' }; +static const symbol s_1_1[5] = { 'a', 'j', 'a', 'c', 'a' }; +static const symbol s_1_2[5] = { 'e', 'j', 'a', 'c', 'a' }; +static const symbol s_1_3[5] = { 'l', 'j', 'a', 'c', 'a' }; +static const symbol s_1_4[5] = { 'n', 'j', 'a', 'c', 'a' }; +static const symbol s_1_5[5] = { 'o', 'j', 'a', 'c', 'a' }; +static const symbol s_1_6[5] = { 'a', 'l', 'a', 'c', 'a' }; +static const symbol s_1_7[5] = { 'e', 'l', 'a', 'c', 'a' }; +static const symbol s_1_8[5] = { 'o', 'l', 'a', 'c', 'a' }; +static const symbol s_1_9[4] = { 'm', 'a', 'c', 'a' }; +static const symbol s_1_10[4] = { 'n', 'a', 'c', 'a' }; +static const symbol s_1_11[4] = { 'r', 'a', 'c', 'a' }; +static const symbol s_1_12[4] = { 's', 'a', 'c', 'a' }; +static const symbol s_1_13[4] = { 'v', 'a', 'c', 'a' }; +static const symbol s_1_14[5] = { 0xC5, 0xA1, 'a', 'c', 'a' }; +static const symbol s_1_15[4] = { 'a', 'o', 'c', 'a' }; +static const symbol s_1_16[5] = { 'a', 'c', 'a', 'k', 'a' }; +static const symbol s_1_17[5] = { 'a', 'j', 'a', 'k', 'a' }; +static const symbol s_1_18[5] = { 'o', 'j', 'a', 'k', 'a' }; +static const symbol s_1_19[5] = { 'a', 'n', 'a', 'k', 'a' }; +static const symbol s_1_20[5] = { 'a', 't', 'a', 'k', 'a' }; +static const symbol s_1_21[5] = { 'e', 't', 'a', 'k', 'a' }; +static const symbol s_1_22[5] = { 'i', 't', 'a', 'k', 'a' }; +static const symbol s_1_23[5] = { 'o', 't', 'a', 'k', 'a' }; +static const symbol s_1_24[5] = { 'u', 't', 'a', 'k', 'a' }; +static const symbol s_1_25[6] = { 'a', 0xC4, 0x8D, 'a', 'k', 'a' }; +static const symbol s_1_26[5] = { 'e', 's', 'a', 'm', 'a' }; +static const symbol s_1_27[5] = { 'i', 'z', 'a', 'm', 'a' }; +static const symbol s_1_28[6] = { 'j', 'a', 'c', 'i', 'm', 'a' }; +static const symbol s_1_29[6] = { 'n', 'i', 'c', 'i', 'm', 'a' }; +static const symbol s_1_30[6] = { 't', 'i', 'c', 'i', 'm', 'a' }; +static const symbol s_1_31[8] = { 't', 'e', 't', 'i', 'c', 'i', 'm', 'a' }; +static const symbol s_1_32[6] = { 'z', 'i', 'c', 'i', 'm', 'a' }; +static const symbol s_1_33[6] = { 'a', 't', 'c', 'i', 'm', 'a' }; +static const symbol s_1_34[6] = { 'u', 't', 'c', 'i', 'm', 'a' }; +static const symbol s_1_35[6] = { 0xC4, 0x8D, 'c', 'i', 'm', 'a' }; +static const symbol s_1_36[6] = { 'p', 'e', 's', 'i', 'm', 'a' }; +static const symbol s_1_37[6] = { 'i', 'n', 'z', 'i', 'm', 'a' }; +static const symbol s_1_38[6] = { 'l', 'o', 'z', 'i', 'm', 'a' }; +static const symbol s_1_39[6] = { 'm', 'e', 't', 'a', 'r', 'a' }; +static const symbol s_1_40[7] = { 'c', 'e', 'n', 't', 'a', 'r', 'a' }; +static const symbol s_1_41[6] = { 'i', 's', 't', 'a', 'r', 'a' }; +static const symbol s_1_42[5] = { 'e', 'k', 'a', 't', 'a' }; +static const symbol s_1_43[5] = { 'a', 'n', 'a', 't', 'a' }; +static const symbol s_1_44[6] = { 'n', 's', 't', 'a', 'v', 'a' }; +static const symbol s_1_45[7] = { 'k', 'u', 's', 't', 'a', 'v', 'a' }; +static const symbol s_1_46[4] = { 'a', 'j', 'a', 'c' }; +static const symbol s_1_47[4] = { 'e', 'j', 'a', 'c' }; +static const symbol s_1_48[4] = { 'l', 'j', 'a', 'c' }; +static const symbol s_1_49[4] = { 'n', 'j', 'a', 'c' }; +static const symbol s_1_50[5] = { 'a', 'n', 'j', 'a', 'c' }; +static const symbol s_1_51[4] = { 'o', 'j', 'a', 'c' }; +static const symbol s_1_52[4] = { 'a', 'l', 'a', 'c' }; +static const symbol s_1_53[4] = { 'e', 'l', 'a', 'c' }; +static const symbol s_1_54[4] = { 'o', 'l', 'a', 'c' }; +static const symbol s_1_55[3] = { 'm', 'a', 'c' }; +static const symbol s_1_56[3] = { 'n', 'a', 'c' }; +static const symbol s_1_57[3] = { 'r', 'a', 'c' }; +static const symbol s_1_58[3] = { 's', 'a', 'c' }; +static const symbol s_1_59[3] = { 'v', 'a', 'c' }; +static const symbol s_1_60[4] = { 0xC5, 0xA1, 'a', 'c' }; +static const symbol s_1_61[4] = { 'j', 'e', 'b', 'e' }; +static const symbol s_1_62[4] = { 'o', 'l', 'c', 'e' }; +static const symbol s_1_63[4] = { 'k', 'u', 's', 'e' }; +static const symbol s_1_64[4] = { 'r', 'a', 'v', 'e' }; +static const symbol s_1_65[4] = { 's', 'a', 'v', 'e' }; +static const symbol s_1_66[5] = { 0xC5, 0xA1, 'a', 'v', 'e' }; +static const symbol s_1_67[4] = { 'b', 'a', 'c', 'i' }; +static const symbol s_1_68[4] = { 'j', 'a', 'c', 'i' }; +static const symbol s_1_69[7] = { 't', 'v', 'e', 'n', 'i', 'c', 'i' }; +static const symbol s_1_70[5] = { 's', 'n', 'i', 'c', 'i' }; +static const symbol s_1_71[6] = { 't', 'e', 't', 'i', 'c', 'i' }; +static const symbol s_1_72[5] = { 'b', 'o', 'j', 'c', 'i' }; +static const symbol s_1_73[5] = { 'v', 'o', 'j', 'c', 'i' }; +static const symbol s_1_74[5] = { 'o', 'j', 's', 'c', 'i' }; +static const symbol s_1_75[4] = { 'a', 't', 'c', 'i' }; +static const symbol s_1_76[4] = { 'i', 't', 'c', 'i' }; +static const symbol s_1_77[4] = { 'u', 't', 'c', 'i' }; +static const symbol s_1_78[4] = { 0xC4, 0x8D, 'c', 'i' }; +static const symbol s_1_79[4] = { 'p', 'e', 's', 'i' }; +static const symbol s_1_80[4] = { 'i', 'n', 'z', 'i' }; +static const symbol s_1_81[4] = { 'l', 'o', 'z', 'i' }; +static const symbol s_1_82[4] = { 'a', 'c', 'a', 'k' }; +static const symbol s_1_83[4] = { 'u', 's', 'a', 'k' }; +static const symbol s_1_84[4] = { 'a', 't', 'a', 'k' }; +static const symbol s_1_85[4] = { 'e', 't', 'a', 'k' }; +static const symbol s_1_86[4] = { 'i', 't', 'a', 'k' }; +static const symbol s_1_87[4] = { 'o', 't', 'a', 'k' }; +static const symbol s_1_88[4] = { 'u', 't', 'a', 'k' }; +static const symbol s_1_89[5] = { 'a', 0xC4, 0x8D, 'a', 'k' }; +static const symbol s_1_90[5] = { 'u', 0xC5, 0xA1, 'a', 'k' }; +static const symbol s_1_91[4] = { 'i', 'z', 'a', 'm' }; +static const symbol s_1_92[5] = { 't', 'i', 'c', 'a', 'n' }; +static const symbol s_1_93[5] = { 'c', 'a', 'j', 'a', 'n' }; +static const symbol s_1_94[6] = { 0xC4, 0x8D, 'a', 'j', 'a', 'n' }; +static const symbol s_1_95[6] = { 'v', 'o', 'l', 'j', 'a', 'n' }; +static const symbol s_1_96[5] = { 'e', 's', 'k', 'a', 'n' }; +static const symbol s_1_97[4] = { 'a', 'l', 'a', 'n' }; +static const symbol s_1_98[5] = { 'b', 'i', 'l', 'a', 'n' }; +static const symbol s_1_99[5] = { 'g', 'i', 'l', 'a', 'n' }; +static const symbol s_1_100[5] = { 'n', 'i', 'l', 'a', 'n' }; +static const symbol s_1_101[5] = { 'r', 'i', 'l', 'a', 'n' }; +static const symbol s_1_102[5] = { 's', 'i', 'l', 'a', 'n' }; +static const symbol s_1_103[5] = { 't', 'i', 'l', 'a', 'n' }; +static const symbol s_1_104[6] = { 'a', 'v', 'i', 'l', 'a', 'n' }; +static const symbol s_1_105[5] = { 'l', 'a', 'r', 'a', 'n' }; +static const symbol s_1_106[4] = { 'e', 'r', 'a', 'n' }; +static const symbol s_1_107[4] = { 'a', 's', 'a', 'n' }; +static const symbol s_1_108[4] = { 'e', 's', 'a', 'n' }; +static const symbol s_1_109[5] = { 'd', 'u', 's', 'a', 'n' }; +static const symbol s_1_110[5] = { 'k', 'u', 's', 'a', 'n' }; +static const symbol s_1_111[4] = { 'a', 't', 'a', 'n' }; +static const symbol s_1_112[6] = { 'p', 'l', 'e', 't', 'a', 'n' }; +static const symbol s_1_113[5] = { 't', 'e', 't', 'a', 'n' }; +static const symbol s_1_114[5] = { 'a', 'n', 't', 'a', 'n' }; +static const symbol s_1_115[6] = { 'p', 'r', 'a', 'v', 'a', 'n' }; +static const symbol s_1_116[6] = { 's', 't', 'a', 'v', 'a', 'n' }; +static const symbol s_1_117[5] = { 's', 'i', 'v', 'a', 'n' }; +static const symbol s_1_118[5] = { 't', 'i', 'v', 'a', 'n' }; +static const symbol s_1_119[4] = { 'o', 'z', 'a', 'n' }; +static const symbol s_1_120[6] = { 't', 'i', 0xC4, 0x8D, 'a', 'n' }; +static const symbol s_1_121[5] = { 'a', 0xC5, 0xA1, 'a', 'n' }; +static const symbol s_1_122[6] = { 'd', 'u', 0xC5, 0xA1, 'a', 'n' }; +static const symbol s_1_123[5] = { 'm', 'e', 't', 'a', 'r' }; +static const symbol s_1_124[6] = { 'c', 'e', 'n', 't', 'a', 'r' }; +static const symbol s_1_125[5] = { 'i', 's', 't', 'a', 'r' }; +static const symbol s_1_126[4] = { 'e', 'k', 'a', 't' }; +static const symbol s_1_127[4] = { 'e', 'n', 'a', 't' }; +static const symbol s_1_128[4] = { 'o', 's', 'c', 'u' }; +static const symbol s_1_129[6] = { 'o', 0xC5, 0xA1, 0xC4, 0x87, 'u' }; +static const struct among a_1[130] = { +{ 4, s_1_0, 0, 73, 0}, +{ 5, s_1_1, 0, 12, 0}, +{ 5, s_1_2, 0, 14, 0}, +{ 5, s_1_3, 0, 13, 0}, +{ 5, s_1_4, 0, 85, 0}, +{ 5, s_1_5, 0, 15, 0}, +{ 5, s_1_6, 0, 82, 0}, +{ 5, s_1_7, 0, 83, 0}, +{ 5, s_1_8, 0, 84, 0}, +{ 4, s_1_9, 0, 75, 0}, +{ 4, s_1_10, 0, 76, 0}, +{ 4, s_1_11, 0, 81, 0}, +{ 4, s_1_12, 0, 80, 0}, +{ 4, s_1_13, 0, 79, 0}, +{ 5, s_1_14, 0, 18, 0}, +{ 4, s_1_15, 0, 82, 0}, +{ 5, s_1_16, 0, 55, 0}, +{ 5, s_1_17, 0, 16, 0}, +{ 5, s_1_18, 0, 17, 0}, +{ 5, s_1_19, 0, 78, 0}, +{ 5, s_1_20, 0, 58, 0}, +{ 5, s_1_21, 0, 59, 0}, +{ 5, s_1_22, 0, 60, 0}, +{ 5, s_1_23, 0, 61, 0}, +{ 5, s_1_24, 0, 62, 0}, +{ 6, s_1_25, 0, 54, 0}, +{ 5, s_1_26, 0, 67, 0}, +{ 5, s_1_27, 0, 87, 0}, +{ 6, s_1_28, 0, 5, 0}, +{ 6, s_1_29, 0, 23, 0}, +{ 6, s_1_30, 0, 24, 0}, +{ 8, s_1_31, -1, 21, 0}, +{ 6, s_1_32, 0, 25, 0}, +{ 6, s_1_33, 0, 58, 0}, +{ 6, s_1_34, 0, 62, 0}, +{ 6, s_1_35, 0, 74, 0}, +{ 6, s_1_36, 0, 2, 0}, +{ 6, s_1_37, 0, 19, 0}, +{ 6, s_1_38, 0, 1, 0}, +{ 6, s_1_39, 0, 68, 0}, +{ 7, s_1_40, 0, 69, 0}, +{ 6, s_1_41, 0, 70, 0}, +{ 5, s_1_42, 0, 86, 0}, +{ 5, s_1_43, 0, 53, 0}, +{ 6, s_1_44, 0, 22, 0}, +{ 7, s_1_45, 0, 29, 0}, +{ 4, s_1_46, 0, 12, 0}, +{ 4, s_1_47, 0, 14, 0}, +{ 4, s_1_48, 0, 13, 0}, +{ 4, s_1_49, 0, 85, 0}, +{ 5, s_1_50, -1, 11, 0}, +{ 4, s_1_51, 0, 15, 0}, +{ 4, s_1_52, 0, 82, 0}, +{ 4, s_1_53, 0, 83, 0}, +{ 4, s_1_54, 0, 84, 0}, +{ 3, s_1_55, 0, 75, 0}, +{ 3, s_1_56, 0, 76, 0}, +{ 3, s_1_57, 0, 81, 0}, +{ 3, s_1_58, 0, 80, 0}, +{ 3, s_1_59, 0, 79, 0}, +{ 4, s_1_60, 0, 18, 0}, +{ 4, s_1_61, 0, 88, 0}, +{ 4, s_1_62, 0, 84, 0}, +{ 4, s_1_63, 0, 27, 0}, +{ 4, s_1_64, 0, 42, 0}, +{ 4, s_1_65, 0, 52, 0}, +{ 5, s_1_66, 0, 51, 0}, +{ 4, s_1_67, 0, 89, 0}, +{ 4, s_1_68, 0, 5, 0}, +{ 7, s_1_69, 0, 20, 0}, +{ 5, s_1_70, 0, 26, 0}, +{ 6, s_1_71, 0, 21, 0}, +{ 5, s_1_72, 0, 4, 0}, +{ 5, s_1_73, 0, 3, 0}, +{ 5, s_1_74, 0, 66, 0}, +{ 4, s_1_75, 0, 58, 0}, +{ 4, s_1_76, 0, 60, 0}, +{ 4, s_1_77, 0, 62, 0}, +{ 4, s_1_78, 0, 74, 0}, +{ 4, s_1_79, 0, 2, 0}, +{ 4, s_1_80, 0, 19, 0}, +{ 4, s_1_81, 0, 1, 0}, +{ 4, s_1_82, 0, 55, 0}, +{ 4, s_1_83, 0, 57, 0}, +{ 4, s_1_84, 0, 58, 0}, +{ 4, s_1_85, 0, 59, 0}, +{ 4, s_1_86, 0, 60, 0}, +{ 4, s_1_87, 0, 61, 0}, +{ 4, s_1_88, 0, 62, 0}, +{ 5, s_1_89, 0, 54, 0}, +{ 5, s_1_90, 0, 56, 0}, +{ 4, s_1_91, 0, 87, 0}, +{ 5, s_1_92, 0, 65, 0}, +{ 5, s_1_93, 0, 7, 0}, +{ 6, s_1_94, 0, 6, 0}, +{ 6, s_1_95, 0, 77, 0}, +{ 5, s_1_96, 0, 63, 0}, +{ 4, s_1_97, 0, 40, 0}, +{ 5, s_1_98, 0, 33, 0}, +{ 5, s_1_99, 0, 37, 0}, +{ 5, s_1_100, 0, 39, 0}, +{ 5, s_1_101, 0, 38, 0}, +{ 5, s_1_102, 0, 36, 0}, +{ 5, s_1_103, 0, 34, 0}, +{ 6, s_1_104, 0, 35, 0}, +{ 5, s_1_105, 0, 9, 0}, +{ 4, s_1_106, 0, 8, 0}, +{ 4, s_1_107, 0, 91, 0}, +{ 4, s_1_108, 0, 10, 0}, +{ 5, s_1_109, 0, 31, 0}, +{ 5, s_1_110, 0, 28, 0}, +{ 4, s_1_111, 0, 47, 0}, +{ 6, s_1_112, 0, 50, 0}, +{ 5, s_1_113, 0, 49, 0}, +{ 5, s_1_114, 0, 32, 0}, +{ 6, s_1_115, 0, 44, 0}, +{ 6, s_1_116, 0, 43, 0}, +{ 5, s_1_117, 0, 46, 0}, +{ 5, s_1_118, 0, 45, 0}, +{ 4, s_1_119, 0, 41, 0}, +{ 6, s_1_120, 0, 64, 0}, +{ 5, s_1_121, 0, 90, 0}, +{ 6, s_1_122, 0, 30, 0}, +{ 5, s_1_123, 0, 68, 0}, +{ 6, s_1_124, 0, 69, 0}, +{ 5, s_1_125, 0, 70, 0}, +{ 4, s_1_126, 0, 86, 0}, +{ 4, s_1_127, 0, 48, 0}, +{ 4, s_1_128, 0, 72, 0}, +{ 6, s_1_129, 0, 71, 0} +}; + +static const symbol s_2_0[3] = { 'a', 'c', 'a' }; +static const symbol s_2_1[3] = { 'e', 'c', 'a' }; +static const symbol s_2_2[3] = { 'u', 'c', 'a' }; +static const symbol s_2_3[2] = { 'g', 'a' }; +static const symbol s_2_4[5] = { 'a', 'c', 'e', 'g', 'a' }; +static const symbol s_2_5[5] = { 'e', 'c', 'e', 'g', 'a' }; +static const symbol s_2_6[5] = { 'u', 'c', 'e', 'g', 'a' }; +static const symbol s_2_7[8] = { 'a', 'n', 'j', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_8[8] = { 'e', 'n', 'j', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_9[8] = { 's', 'n', 'j', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_10[9] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_11[6] = { 'k', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_12[7] = { 's', 'k', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_13[8] = { 0xC5, 0xA1, 'k', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_14[7] = { 'e', 'l', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_15[6] = { 'n', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_16[7] = { 'o', 's', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_17[7] = { 'a', 't', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_18[9] = { 'e', 'v', 'i', 't', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_19[9] = { 'o', 'v', 'i', 't', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_20[8] = { 'a', 's', 't', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_21[7] = { 'a', 'v', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_22[7] = { 'e', 'v', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_23[7] = { 'i', 'v', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_24[7] = { 'o', 'v', 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_25[8] = { 'o', 0xC5, 0xA1, 'i', 'j', 'e', 'g', 'a' }; +static const symbol s_2_26[6] = { 'a', 'n', 'j', 'e', 'g', 'a' }; +static const symbol s_2_27[6] = { 'e', 'n', 'j', 'e', 'g', 'a' }; +static const symbol s_2_28[6] = { 's', 'n', 'j', 'e', 'g', 'a' }; +static const symbol s_2_29[7] = { 0xC5, 0xA1, 'n', 'j', 'e', 'g', 'a' }; +static const symbol s_2_30[4] = { 'k', 'e', 'g', 'a' }; +static const symbol s_2_31[5] = { 's', 'k', 'e', 'g', 'a' }; +static const symbol s_2_32[6] = { 0xC5, 0xA1, 'k', 'e', 'g', 'a' }; +static const symbol s_2_33[5] = { 'e', 'l', 'e', 'g', 'a' }; +static const symbol s_2_34[4] = { 'n', 'e', 'g', 'a' }; +static const symbol s_2_35[5] = { 'a', 'n', 'e', 'g', 'a' }; +static const symbol s_2_36[5] = { 'e', 'n', 'e', 'g', 'a' }; +static const symbol s_2_37[5] = { 's', 'n', 'e', 'g', 'a' }; +static const symbol s_2_38[6] = { 0xC5, 0xA1, 'n', 'e', 'g', 'a' }; +static const symbol s_2_39[5] = { 'o', 's', 'e', 'g', 'a' }; +static const symbol s_2_40[5] = { 'a', 't', 'e', 'g', 'a' }; +static const symbol s_2_41[7] = { 'e', 'v', 'i', 't', 'e', 'g', 'a' }; +static const symbol s_2_42[7] = { 'o', 'v', 'i', 't', 'e', 'g', 'a' }; +static const symbol s_2_43[6] = { 'a', 's', 't', 'e', 'g', 'a' }; +static const symbol s_2_44[5] = { 'a', 'v', 'e', 'g', 'a' }; +static const symbol s_2_45[5] = { 'e', 'v', 'e', 'g', 'a' }; +static const symbol s_2_46[5] = { 'i', 'v', 'e', 'g', 'a' }; +static const symbol s_2_47[5] = { 'o', 'v', 'e', 'g', 'a' }; +static const symbol s_2_48[6] = { 'a', 0xC4, 0x87, 'e', 'g', 'a' }; +static const symbol s_2_49[6] = { 'e', 0xC4, 0x87, 'e', 'g', 'a' }; +static const symbol s_2_50[6] = { 'u', 0xC4, 0x87, 'e', 'g', 'a' }; +static const symbol s_2_51[6] = { 'o', 0xC5, 0xA1, 'e', 'g', 'a' }; +static const symbol s_2_52[5] = { 'a', 'c', 'o', 'g', 'a' }; +static const symbol s_2_53[5] = { 'e', 'c', 'o', 'g', 'a' }; +static const symbol s_2_54[5] = { 'u', 'c', 'o', 'g', 'a' }; +static const symbol s_2_55[6] = { 'a', 'n', 'j', 'o', 'g', 'a' }; +static const symbol s_2_56[6] = { 'e', 'n', 'j', 'o', 'g', 'a' }; +static const symbol s_2_57[6] = { 's', 'n', 'j', 'o', 'g', 'a' }; +static const symbol s_2_58[7] = { 0xC5, 0xA1, 'n', 'j', 'o', 'g', 'a' }; +static const symbol s_2_59[4] = { 'k', 'o', 'g', 'a' }; +static const symbol s_2_60[5] = { 's', 'k', 'o', 'g', 'a' }; +static const symbol s_2_61[6] = { 0xC5, 0xA1, 'k', 'o', 'g', 'a' }; +static const symbol s_2_62[4] = { 'l', 'o', 'g', 'a' }; +static const symbol s_2_63[5] = { 'e', 'l', 'o', 'g', 'a' }; +static const symbol s_2_64[4] = { 'n', 'o', 'g', 'a' }; +static const symbol s_2_65[6] = { 'c', 'i', 'n', 'o', 'g', 'a' }; +static const symbol s_2_66[7] = { 0xC4, 0x8D, 'i', 'n', 'o', 'g', 'a' }; +static const symbol s_2_67[5] = { 'o', 's', 'o', 'g', 'a' }; +static const symbol s_2_68[5] = { 'a', 't', 'o', 'g', 'a' }; +static const symbol s_2_69[7] = { 'e', 'v', 'i', 't', 'o', 'g', 'a' }; +static const symbol s_2_70[7] = { 'o', 'v', 'i', 't', 'o', 'g', 'a' }; +static const symbol s_2_71[6] = { 'a', 's', 't', 'o', 'g', 'a' }; +static const symbol s_2_72[5] = { 'a', 'v', 'o', 'g', 'a' }; +static const symbol s_2_73[5] = { 'e', 'v', 'o', 'g', 'a' }; +static const symbol s_2_74[5] = { 'i', 'v', 'o', 'g', 'a' }; +static const symbol s_2_75[5] = { 'o', 'v', 'o', 'g', 'a' }; +static const symbol s_2_76[6] = { 'a', 0xC4, 0x87, 'o', 'g', 'a' }; +static const symbol s_2_77[6] = { 'e', 0xC4, 0x87, 'o', 'g', 'a' }; +static const symbol s_2_78[6] = { 'u', 0xC4, 0x87, 'o', 'g', 'a' }; +static const symbol s_2_79[6] = { 'o', 0xC5, 0xA1, 'o', 'g', 'a' }; +static const symbol s_2_80[3] = { 'u', 'g', 'a' }; +static const symbol s_2_81[3] = { 'a', 'j', 'a' }; +static const symbol s_2_82[4] = { 'c', 'a', 'j', 'a' }; +static const symbol s_2_83[4] = { 'l', 'a', 'j', 'a' }; +static const symbol s_2_84[4] = { 'r', 'a', 'j', 'a' }; +static const symbol s_2_85[5] = { 0xC4, 0x87, 'a', 'j', 'a' }; +static const symbol s_2_86[5] = { 0xC4, 0x8D, 'a', 'j', 'a' }; +static const symbol s_2_87[5] = { 0xC4, 0x91, 'a', 'j', 'a' }; +static const symbol s_2_88[4] = { 'b', 'i', 'j', 'a' }; +static const symbol s_2_89[4] = { 'c', 'i', 'j', 'a' }; +static const symbol s_2_90[4] = { 'd', 'i', 'j', 'a' }; +static const symbol s_2_91[4] = { 'f', 'i', 'j', 'a' }; +static const symbol s_2_92[4] = { 'g', 'i', 'j', 'a' }; +static const symbol s_2_93[6] = { 'a', 'n', 'j', 'i', 'j', 'a' }; +static const symbol s_2_94[6] = { 'e', 'n', 'j', 'i', 'j', 'a' }; +static const symbol s_2_95[6] = { 's', 'n', 'j', 'i', 'j', 'a' }; +static const symbol s_2_96[7] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'a' }; +static const symbol s_2_97[4] = { 'k', 'i', 'j', 'a' }; +static const symbol s_2_98[5] = { 's', 'k', 'i', 'j', 'a' }; +static const symbol s_2_99[6] = { 0xC5, 0xA1, 'k', 'i', 'j', 'a' }; +static const symbol s_2_100[4] = { 'l', 'i', 'j', 'a' }; +static const symbol s_2_101[5] = { 'e', 'l', 'i', 'j', 'a' }; +static const symbol s_2_102[4] = { 'm', 'i', 'j', 'a' }; +static const symbol s_2_103[4] = { 'n', 'i', 'j', 'a' }; +static const symbol s_2_104[6] = { 'g', 'a', 'n', 'i', 'j', 'a' }; +static const symbol s_2_105[6] = { 'm', 'a', 'n', 'i', 'j', 'a' }; +static const symbol s_2_106[6] = { 'p', 'a', 'n', 'i', 'j', 'a' }; +static const symbol s_2_107[6] = { 'r', 'a', 'n', 'i', 'j', 'a' }; +static const symbol s_2_108[6] = { 't', 'a', 'n', 'i', 'j', 'a' }; +static const symbol s_2_109[4] = { 'p', 'i', 'j', 'a' }; +static const symbol s_2_110[4] = { 'r', 'i', 'j', 'a' }; +static const symbol s_2_111[6] = { 'r', 'a', 'r', 'i', 'j', 'a' }; +static const symbol s_2_112[4] = { 's', 'i', 'j', 'a' }; +static const symbol s_2_113[5] = { 'o', 's', 'i', 'j', 'a' }; +static const symbol s_2_114[4] = { 't', 'i', 'j', 'a' }; +static const symbol s_2_115[5] = { 'a', 't', 'i', 'j', 'a' }; +static const symbol s_2_116[7] = { 'e', 'v', 'i', 't', 'i', 'j', 'a' }; +static const symbol s_2_117[7] = { 'o', 'v', 'i', 't', 'i', 'j', 'a' }; +static const symbol s_2_118[5] = { 'o', 't', 'i', 'j', 'a' }; +static const symbol s_2_119[6] = { 'a', 's', 't', 'i', 'j', 'a' }; +static const symbol s_2_120[5] = { 'a', 'v', 'i', 'j', 'a' }; +static const symbol s_2_121[5] = { 'e', 'v', 'i', 'j', 'a' }; +static const symbol s_2_122[5] = { 'i', 'v', 'i', 'j', 'a' }; +static const symbol s_2_123[5] = { 'o', 'v', 'i', 'j', 'a' }; +static const symbol s_2_124[4] = { 'z', 'i', 'j', 'a' }; +static const symbol s_2_125[6] = { 'o', 0xC5, 0xA1, 'i', 'j', 'a' }; +static const symbol s_2_126[5] = { 0xC5, 0xBE, 'i', 'j', 'a' }; +static const symbol s_2_127[4] = { 'a', 'n', 'j', 'a' }; +static const symbol s_2_128[4] = { 'e', 'n', 'j', 'a' }; +static const symbol s_2_129[4] = { 's', 'n', 'j', 'a' }; +static const symbol s_2_130[5] = { 0xC5, 0xA1, 'n', 'j', 'a' }; +static const symbol s_2_131[2] = { 'k', 'a' }; +static const symbol s_2_132[3] = { 's', 'k', 'a' }; +static const symbol s_2_133[4] = { 0xC5, 0xA1, 'k', 'a' }; +static const symbol s_2_134[3] = { 'a', 'l', 'a' }; +static const symbol s_2_135[5] = { 'a', 'c', 'a', 'l', 'a' }; +static const symbol s_2_136[8] = { 'a', 's', 't', 'a', 'j', 'a', 'l', 'a' }; +static const symbol s_2_137[8] = { 'i', 's', 't', 'a', 'j', 'a', 'l', 'a' }; +static const symbol s_2_138[8] = { 'o', 's', 't', 'a', 'j', 'a', 'l', 'a' }; +static const symbol s_2_139[5] = { 'i', 'j', 'a', 'l', 'a' }; +static const symbol s_2_140[6] = { 'i', 'n', 'j', 'a', 'l', 'a' }; +static const symbol s_2_141[4] = { 'n', 'a', 'l', 'a' }; +static const symbol s_2_142[5] = { 'i', 'r', 'a', 'l', 'a' }; +static const symbol s_2_143[5] = { 'u', 'r', 'a', 'l', 'a' }; +static const symbol s_2_144[4] = { 't', 'a', 'l', 'a' }; +static const symbol s_2_145[6] = { 'a', 's', 't', 'a', 'l', 'a' }; +static const symbol s_2_146[6] = { 'i', 's', 't', 'a', 'l', 'a' }; +static const symbol s_2_147[6] = { 'o', 's', 't', 'a', 'l', 'a' }; +static const symbol s_2_148[5] = { 'a', 'v', 'a', 'l', 'a' }; +static const symbol s_2_149[5] = { 'e', 'v', 'a', 'l', 'a' }; +static const symbol s_2_150[5] = { 'i', 'v', 'a', 'l', 'a' }; +static const symbol s_2_151[5] = { 'o', 'v', 'a', 'l', 'a' }; +static const symbol s_2_152[5] = { 'u', 'v', 'a', 'l', 'a' }; +static const symbol s_2_153[6] = { 'a', 0xC4, 0x8D, 'a', 'l', 'a' }; +static const symbol s_2_154[3] = { 'e', 'l', 'a' }; +static const symbol s_2_155[3] = { 'i', 'l', 'a' }; +static const symbol s_2_156[5] = { 'a', 'c', 'i', 'l', 'a' }; +static const symbol s_2_157[6] = { 'l', 'u', 'c', 'i', 'l', 'a' }; +static const symbol s_2_158[4] = { 'n', 'i', 'l', 'a' }; +static const symbol s_2_159[8] = { 'a', 's', 't', 'a', 'n', 'i', 'l', 'a' }; +static const symbol s_2_160[8] = { 'i', 's', 't', 'a', 'n', 'i', 'l', 'a' }; +static const symbol s_2_161[8] = { 'o', 's', 't', 'a', 'n', 'i', 'l', 'a' }; +static const symbol s_2_162[6] = { 'r', 'o', 's', 'i', 'l', 'a' }; +static const symbol s_2_163[6] = { 'j', 'e', 't', 'i', 'l', 'a' }; +static const symbol s_2_164[5] = { 'o', 'z', 'i', 'l', 'a' }; +static const symbol s_2_165[6] = { 'a', 0xC4, 0x8D, 'i', 'l', 'a' }; +static const symbol s_2_166[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 'l', 'a' }; +static const symbol s_2_167[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 'l', 'a' }; +static const symbol s_2_168[3] = { 'o', 'l', 'a' }; +static const symbol s_2_169[4] = { 'a', 's', 'l', 'a' }; +static const symbol s_2_170[4] = { 'n', 'u', 'l', 'a' }; +static const symbol s_2_171[4] = { 'g', 'a', 'm', 'a' }; +static const symbol s_2_172[6] = { 'l', 'o', 'g', 'a', 'm', 'a' }; +static const symbol s_2_173[5] = { 'u', 'g', 'a', 'm', 'a' }; +static const symbol s_2_174[5] = { 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_175[6] = { 'c', 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_176[6] = { 'l', 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_177[6] = { 'r', 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_178[7] = { 0xC4, 0x87, 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_179[7] = { 0xC4, 0x8D, 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_180[7] = { 0xC4, 0x91, 'a', 'j', 'a', 'm', 'a' }; +static const symbol s_2_181[6] = { 'b', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_182[6] = { 'c', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_183[6] = { 'd', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_184[6] = { 'f', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_185[6] = { 'g', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_186[6] = { 'l', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_187[6] = { 'm', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_188[6] = { 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_189[8] = { 'g', 'a', 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_190[8] = { 'm', 'a', 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_191[8] = { 'p', 'a', 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_192[8] = { 'r', 'a', 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_193[8] = { 't', 'a', 'n', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_194[6] = { 'p', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_195[6] = { 'r', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_196[6] = { 's', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_197[6] = { 't', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_198[6] = { 'z', 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_199[7] = { 0xC5, 0xBE, 'i', 'j', 'a', 'm', 'a' }; +static const symbol s_2_200[5] = { 'a', 'l', 'a', 'm', 'a' }; +static const symbol s_2_201[7] = { 'i', 'j', 'a', 'l', 'a', 'm', 'a' }; +static const symbol s_2_202[6] = { 'n', 'a', 'l', 'a', 'm', 'a' }; +static const symbol s_2_203[5] = { 'e', 'l', 'a', 'm', 'a' }; +static const symbol s_2_204[5] = { 'i', 'l', 'a', 'm', 'a' }; +static const symbol s_2_205[6] = { 'r', 'a', 'm', 'a', 'm', 'a' }; +static const symbol s_2_206[6] = { 'l', 'e', 'm', 'a', 'm', 'a' }; +static const symbol s_2_207[5] = { 'i', 'n', 'a', 'm', 'a' }; +static const symbol s_2_208[6] = { 'c', 'i', 'n', 'a', 'm', 'a' }; +static const symbol s_2_209[7] = { 0xC4, 0x8D, 'i', 'n', 'a', 'm', 'a' }; +static const symbol s_2_210[4] = { 'r', 'a', 'm', 'a' }; +static const symbol s_2_211[5] = { 'a', 'r', 'a', 'm', 'a' }; +static const symbol s_2_212[5] = { 'd', 'r', 'a', 'm', 'a' }; +static const symbol s_2_213[5] = { 'e', 'r', 'a', 'm', 'a' }; +static const symbol s_2_214[5] = { 'o', 'r', 'a', 'm', 'a' }; +static const symbol s_2_215[6] = { 'b', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_216[6] = { 'g', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_217[6] = { 'j', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_218[6] = { 'k', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_219[6] = { 'n', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_220[6] = { 't', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_221[6] = { 'v', 'a', 's', 'a', 'm', 'a' }; +static const symbol s_2_222[5] = { 'e', 's', 'a', 'm', 'a' }; +static const symbol s_2_223[5] = { 'i', 's', 'a', 'm', 'a' }; +static const symbol s_2_224[5] = { 'e', 't', 'a', 'm', 'a' }; +static const symbol s_2_225[6] = { 'e', 's', 't', 'a', 'm', 'a' }; +static const symbol s_2_226[6] = { 'i', 's', 't', 'a', 'm', 'a' }; +static const symbol s_2_227[6] = { 'k', 's', 't', 'a', 'm', 'a' }; +static const symbol s_2_228[6] = { 'o', 's', 't', 'a', 'm', 'a' }; +static const symbol s_2_229[5] = { 'a', 'v', 'a', 'm', 'a' }; +static const symbol s_2_230[5] = { 'e', 'v', 'a', 'm', 'a' }; +static const symbol s_2_231[5] = { 'i', 'v', 'a', 'm', 'a' }; +static const symbol s_2_232[7] = { 'b', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_233[7] = { 'g', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_234[7] = { 'j', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_235[7] = { 'k', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_236[7] = { 'n', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_237[7] = { 't', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_238[7] = { 'v', 'a', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_239[6] = { 'e', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_240[6] = { 'i', 0xC5, 0xA1, 'a', 'm', 'a' }; +static const symbol s_2_241[4] = { 'l', 'e', 'm', 'a' }; +static const symbol s_2_242[5] = { 'a', 'c', 'i', 'm', 'a' }; +static const symbol s_2_243[5] = { 'e', 'c', 'i', 'm', 'a' }; +static const symbol s_2_244[5] = { 'u', 'c', 'i', 'm', 'a' }; +static const symbol s_2_245[5] = { 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_246[6] = { 'c', 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_247[6] = { 'l', 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_248[6] = { 'r', 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_249[7] = { 0xC4, 0x87, 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_250[7] = { 0xC4, 0x8D, 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_251[7] = { 0xC4, 0x91, 'a', 'j', 'i', 'm', 'a' }; +static const symbol s_2_252[6] = { 'b', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_253[6] = { 'c', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_254[6] = { 'd', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_255[6] = { 'f', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_256[6] = { 'g', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_257[8] = { 'a', 'n', 'j', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_258[8] = { 'e', 'n', 'j', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_259[8] = { 's', 'n', 'j', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_260[9] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_261[6] = { 'k', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_262[7] = { 's', 'k', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_263[8] = { 0xC5, 0xA1, 'k', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_264[6] = { 'l', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_265[7] = { 'e', 'l', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_266[6] = { 'm', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_267[6] = { 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_268[8] = { 'g', 'a', 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_269[8] = { 'm', 'a', 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_270[8] = { 'p', 'a', 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_271[8] = { 'r', 'a', 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_272[8] = { 't', 'a', 'n', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_273[6] = { 'p', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_274[6] = { 'r', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_275[6] = { 's', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_276[7] = { 'o', 's', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_277[6] = { 't', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_278[7] = { 'a', 't', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_279[9] = { 'e', 'v', 'i', 't', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_280[9] = { 'o', 'v', 'i', 't', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_281[8] = { 'a', 's', 't', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_282[7] = { 'a', 'v', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_283[7] = { 'e', 'v', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_284[7] = { 'i', 'v', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_285[7] = { 'o', 'v', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_286[6] = { 'z', 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_287[8] = { 'o', 0xC5, 0xA1, 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_288[7] = { 0xC5, 0xBE, 'i', 'j', 'i', 'm', 'a' }; +static const symbol s_2_289[6] = { 'a', 'n', 'j', 'i', 'm', 'a' }; +static const symbol s_2_290[6] = { 'e', 'n', 'j', 'i', 'm', 'a' }; +static const symbol s_2_291[6] = { 's', 'n', 'j', 'i', 'm', 'a' }; +static const symbol s_2_292[7] = { 0xC5, 0xA1, 'n', 'j', 'i', 'm', 'a' }; +static const symbol s_2_293[4] = { 'k', 'i', 'm', 'a' }; +static const symbol s_2_294[5] = { 's', 'k', 'i', 'm', 'a' }; +static const symbol s_2_295[6] = { 0xC5, 0xA1, 'k', 'i', 'm', 'a' }; +static const symbol s_2_296[5] = { 'a', 'l', 'i', 'm', 'a' }; +static const symbol s_2_297[7] = { 'i', 'j', 'a', 'l', 'i', 'm', 'a' }; +static const symbol s_2_298[6] = { 'n', 'a', 'l', 'i', 'm', 'a' }; +static const symbol s_2_299[5] = { 'e', 'l', 'i', 'm', 'a' }; +static const symbol s_2_300[5] = { 'i', 'l', 'i', 'm', 'a' }; +static const symbol s_2_301[7] = { 'o', 'z', 'i', 'l', 'i', 'm', 'a' }; +static const symbol s_2_302[5] = { 'o', 'l', 'i', 'm', 'a' }; +static const symbol s_2_303[6] = { 'l', 'e', 'm', 'i', 'm', 'a' }; +static const symbol s_2_304[4] = { 'n', 'i', 'm', 'a' }; +static const symbol s_2_305[5] = { 'a', 'n', 'i', 'm', 'a' }; +static const symbol s_2_306[5] = { 'i', 'n', 'i', 'm', 'a' }; +static const symbol s_2_307[6] = { 'c', 'i', 'n', 'i', 'm', 'a' }; +static const symbol s_2_308[7] = { 0xC4, 0x8D, 'i', 'n', 'i', 'm', 'a' }; +static const symbol s_2_309[5] = { 'o', 'n', 'i', 'm', 'a' }; +static const symbol s_2_310[5] = { 'a', 'r', 'i', 'm', 'a' }; +static const symbol s_2_311[5] = { 'd', 'r', 'i', 'm', 'a' }; +static const symbol s_2_312[5] = { 'e', 'r', 'i', 'm', 'a' }; +static const symbol s_2_313[5] = { 'o', 'r', 'i', 'm', 'a' }; +static const symbol s_2_314[6] = { 'b', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_315[6] = { 'g', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_316[6] = { 'j', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_317[6] = { 'k', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_318[6] = { 'n', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_319[6] = { 't', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_320[6] = { 'v', 'a', 's', 'i', 'm', 'a' }; +static const symbol s_2_321[5] = { 'e', 's', 'i', 'm', 'a' }; +static const symbol s_2_322[5] = { 'i', 's', 'i', 'm', 'a' }; +static const symbol s_2_323[5] = { 'o', 's', 'i', 'm', 'a' }; +static const symbol s_2_324[5] = { 'a', 't', 'i', 'm', 'a' }; +static const symbol s_2_325[7] = { 'i', 'k', 'a', 't', 'i', 'm', 'a' }; +static const symbol s_2_326[6] = { 'l', 'a', 't', 'i', 'm', 'a' }; +static const symbol s_2_327[5] = { 'e', 't', 'i', 'm', 'a' }; +static const symbol s_2_328[7] = { 'e', 'v', 'i', 't', 'i', 'm', 'a' }; +static const symbol s_2_329[7] = { 'o', 'v', 'i', 't', 'i', 'm', 'a' }; +static const symbol s_2_330[6] = { 'a', 's', 't', 'i', 'm', 'a' }; +static const symbol s_2_331[6] = { 'e', 's', 't', 'i', 'm', 'a' }; +static const symbol s_2_332[6] = { 'i', 's', 't', 'i', 'm', 'a' }; +static const symbol s_2_333[6] = { 'k', 's', 't', 'i', 'm', 'a' }; +static const symbol s_2_334[6] = { 'o', 's', 't', 'i', 'm', 'a' }; +static const symbol s_2_335[7] = { 'i', 0xC5, 0xA1, 't', 'i', 'm', 'a' }; +static const symbol s_2_336[5] = { 'a', 'v', 'i', 'm', 'a' }; +static const symbol s_2_337[5] = { 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_338[7] = { 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_339[8] = { 'c', 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_340[8] = { 'l', 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_341[8] = { 'r', 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_342[9] = { 0xC4, 0x87, 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_343[9] = { 0xC4, 0x8D, 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_344[9] = { 0xC4, 0x91, 'a', 'j', 'e', 'v', 'i', 'm', 'a' }; +static const symbol s_2_345[5] = { 'i', 'v', 'i', 'm', 'a' }; +static const symbol s_2_346[5] = { 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_347[6] = { 'g', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_348[7] = { 'u', 'g', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_349[6] = { 'l', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_350[7] = { 'o', 'l', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_351[6] = { 'm', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_352[7] = { 'o', 'n', 'o', 'v', 'i', 'm', 'a' }; +static const symbol s_2_353[6] = { 's', 't', 'v', 'i', 'm', 'a' }; +static const symbol s_2_354[7] = { 0xC5, 0xA1, 't', 'v', 'i', 'm', 'a' }; +static const symbol s_2_355[6] = { 'a', 0xC4, 0x87, 'i', 'm', 'a' }; +static const symbol s_2_356[6] = { 'e', 0xC4, 0x87, 'i', 'm', 'a' }; +static const symbol s_2_357[6] = { 'u', 0xC4, 0x87, 'i', 'm', 'a' }; +static const symbol s_2_358[7] = { 'b', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_359[7] = { 'g', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_360[7] = { 'j', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_361[7] = { 'k', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_362[7] = { 'n', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_363[7] = { 't', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_364[7] = { 'v', 'a', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_365[6] = { 'e', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_366[6] = { 'i', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_367[6] = { 'o', 0xC5, 0xA1, 'i', 'm', 'a' }; +static const symbol s_2_368[2] = { 'n', 'a' }; +static const symbol s_2_369[3] = { 'a', 'n', 'a' }; +static const symbol s_2_370[5] = { 'a', 'c', 'a', 'n', 'a' }; +static const symbol s_2_371[5] = { 'u', 'r', 'a', 'n', 'a' }; +static const symbol s_2_372[4] = { 't', 'a', 'n', 'a' }; +static const symbol s_2_373[5] = { 'a', 'v', 'a', 'n', 'a' }; +static const symbol s_2_374[5] = { 'e', 'v', 'a', 'n', 'a' }; +static const symbol s_2_375[5] = { 'i', 'v', 'a', 'n', 'a' }; +static const symbol s_2_376[5] = { 'u', 'v', 'a', 'n', 'a' }; +static const symbol s_2_377[6] = { 'a', 0xC4, 0x8D, 'a', 'n', 'a' }; +static const symbol s_2_378[5] = { 'a', 'c', 'e', 'n', 'a' }; +static const symbol s_2_379[6] = { 'l', 'u', 'c', 'e', 'n', 'a' }; +static const symbol s_2_380[6] = { 'a', 0xC4, 0x8D, 'e', 'n', 'a' }; +static const symbol s_2_381[7] = { 'l', 'u', 0xC4, 0x8D, 'e', 'n', 'a' }; +static const symbol s_2_382[3] = { 'i', 'n', 'a' }; +static const symbol s_2_383[4] = { 'c', 'i', 'n', 'a' }; +static const symbol s_2_384[5] = { 'a', 'n', 'i', 'n', 'a' }; +static const symbol s_2_385[5] = { 0xC4, 0x8D, 'i', 'n', 'a' }; +static const symbol s_2_386[3] = { 'o', 'n', 'a' }; +static const symbol s_2_387[3] = { 'a', 'r', 'a' }; +static const symbol s_2_388[3] = { 'd', 'r', 'a' }; +static const symbol s_2_389[3] = { 'e', 'r', 'a' }; +static const symbol s_2_390[3] = { 'o', 'r', 'a' }; +static const symbol s_2_391[4] = { 'b', 'a', 's', 'a' }; +static const symbol s_2_392[4] = { 'g', 'a', 's', 'a' }; +static const symbol s_2_393[4] = { 'j', 'a', 's', 'a' }; +static const symbol s_2_394[4] = { 'k', 'a', 's', 'a' }; +static const symbol s_2_395[4] = { 'n', 'a', 's', 'a' }; +static const symbol s_2_396[4] = { 't', 'a', 's', 'a' }; +static const symbol s_2_397[4] = { 'v', 'a', 's', 'a' }; +static const symbol s_2_398[3] = { 'e', 's', 'a' }; +static const symbol s_2_399[3] = { 'i', 's', 'a' }; +static const symbol s_2_400[3] = { 'o', 's', 'a' }; +static const symbol s_2_401[3] = { 'a', 't', 'a' }; +static const symbol s_2_402[5] = { 'i', 'k', 'a', 't', 'a' }; +static const symbol s_2_403[4] = { 'l', 'a', 't', 'a' }; +static const symbol s_2_404[3] = { 'e', 't', 'a' }; +static const symbol s_2_405[5] = { 'e', 'v', 'i', 't', 'a' }; +static const symbol s_2_406[5] = { 'o', 'v', 'i', 't', 'a' }; +static const symbol s_2_407[4] = { 'a', 's', 't', 'a' }; +static const symbol s_2_408[4] = { 'e', 's', 't', 'a' }; +static const symbol s_2_409[4] = { 'i', 's', 't', 'a' }; +static const symbol s_2_410[4] = { 'k', 's', 't', 'a' }; +static const symbol s_2_411[4] = { 'o', 's', 't', 'a' }; +static const symbol s_2_412[4] = { 'n', 'u', 't', 'a' }; +static const symbol s_2_413[5] = { 'i', 0xC5, 0xA1, 't', 'a' }; +static const symbol s_2_414[3] = { 'a', 'v', 'a' }; +static const symbol s_2_415[3] = { 'e', 'v', 'a' }; +static const symbol s_2_416[5] = { 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_417[6] = { 'c', 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_418[6] = { 'l', 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_419[6] = { 'r', 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_420[7] = { 0xC4, 0x87, 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_421[7] = { 0xC4, 0x8D, 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_422[7] = { 0xC4, 0x91, 'a', 'j', 'e', 'v', 'a' }; +static const symbol s_2_423[3] = { 'i', 'v', 'a' }; +static const symbol s_2_424[3] = { 'o', 'v', 'a' }; +static const symbol s_2_425[4] = { 'g', 'o', 'v', 'a' }; +static const symbol s_2_426[5] = { 'u', 'g', 'o', 'v', 'a' }; +static const symbol s_2_427[4] = { 'l', 'o', 'v', 'a' }; +static const symbol s_2_428[5] = { 'o', 'l', 'o', 'v', 'a' }; +static const symbol s_2_429[4] = { 'm', 'o', 'v', 'a' }; +static const symbol s_2_430[5] = { 'o', 'n', 'o', 'v', 'a' }; +static const symbol s_2_431[4] = { 's', 't', 'v', 'a' }; +static const symbol s_2_432[5] = { 0xC5, 0xA1, 't', 'v', 'a' }; +static const symbol s_2_433[4] = { 'a', 0xC4, 0x87, 'a' }; +static const symbol s_2_434[4] = { 'e', 0xC4, 0x87, 'a' }; +static const symbol s_2_435[4] = { 'u', 0xC4, 0x87, 'a' }; +static const symbol s_2_436[5] = { 'b', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_437[5] = { 'g', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_438[5] = { 'j', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_439[5] = { 'k', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_440[5] = { 'n', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_441[5] = { 't', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_442[5] = { 'v', 'a', 0xC5, 0xA1, 'a' }; +static const symbol s_2_443[4] = { 'e', 0xC5, 0xA1, 'a' }; +static const symbol s_2_444[4] = { 'i', 0xC5, 0xA1, 'a' }; +static const symbol s_2_445[4] = { 'o', 0xC5, 0xA1, 'a' }; +static const symbol s_2_446[3] = { 'a', 'c', 'e' }; +static const symbol s_2_447[3] = { 'e', 'c', 'e' }; +static const symbol s_2_448[3] = { 'u', 'c', 'e' }; +static const symbol s_2_449[4] = { 'l', 'u', 'c', 'e' }; +static const symbol s_2_450[6] = { 'a', 's', 't', 'a', 'd', 'e' }; +static const symbol s_2_451[6] = { 'i', 's', 't', 'a', 'd', 'e' }; +static const symbol s_2_452[6] = { 'o', 's', 't', 'a', 'd', 'e' }; +static const symbol s_2_453[2] = { 'g', 'e' }; +static const symbol s_2_454[4] = { 'l', 'o', 'g', 'e' }; +static const symbol s_2_455[3] = { 'u', 'g', 'e' }; +static const symbol s_2_456[3] = { 'a', 'j', 'e' }; +static const symbol s_2_457[4] = { 'c', 'a', 'j', 'e' }; +static const symbol s_2_458[4] = { 'l', 'a', 'j', 'e' }; +static const symbol s_2_459[4] = { 'r', 'a', 'j', 'e' }; +static const symbol s_2_460[6] = { 'a', 's', 't', 'a', 'j', 'e' }; +static const symbol s_2_461[6] = { 'i', 's', 't', 'a', 'j', 'e' }; +static const symbol s_2_462[6] = { 'o', 's', 't', 'a', 'j', 'e' }; +static const symbol s_2_463[5] = { 0xC4, 0x87, 'a', 'j', 'e' }; +static const symbol s_2_464[5] = { 0xC4, 0x8D, 'a', 'j', 'e' }; +static const symbol s_2_465[5] = { 0xC4, 0x91, 'a', 'j', 'e' }; +static const symbol s_2_466[3] = { 'i', 'j', 'e' }; +static const symbol s_2_467[4] = { 'b', 'i', 'j', 'e' }; +static const symbol s_2_468[4] = { 'c', 'i', 'j', 'e' }; +static const symbol s_2_469[4] = { 'd', 'i', 'j', 'e' }; +static const symbol s_2_470[4] = { 'f', 'i', 'j', 'e' }; +static const symbol s_2_471[4] = { 'g', 'i', 'j', 'e' }; +static const symbol s_2_472[6] = { 'a', 'n', 'j', 'i', 'j', 'e' }; +static const symbol s_2_473[6] = { 'e', 'n', 'j', 'i', 'j', 'e' }; +static const symbol s_2_474[6] = { 's', 'n', 'j', 'i', 'j', 'e' }; +static const symbol s_2_475[7] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'e' }; +static const symbol s_2_476[4] = { 'k', 'i', 'j', 'e' }; +static const symbol s_2_477[5] = { 's', 'k', 'i', 'j', 'e' }; +static const symbol s_2_478[6] = { 0xC5, 0xA1, 'k', 'i', 'j', 'e' }; +static const symbol s_2_479[4] = { 'l', 'i', 'j', 'e' }; +static const symbol s_2_480[5] = { 'e', 'l', 'i', 'j', 'e' }; +static const symbol s_2_481[4] = { 'm', 'i', 'j', 'e' }; +static const symbol s_2_482[4] = { 'n', 'i', 'j', 'e' }; +static const symbol s_2_483[6] = { 'g', 'a', 'n', 'i', 'j', 'e' }; +static const symbol s_2_484[6] = { 'm', 'a', 'n', 'i', 'j', 'e' }; +static const symbol s_2_485[6] = { 'p', 'a', 'n', 'i', 'j', 'e' }; +static const symbol s_2_486[6] = { 'r', 'a', 'n', 'i', 'j', 'e' }; +static const symbol s_2_487[6] = { 't', 'a', 'n', 'i', 'j', 'e' }; +static const symbol s_2_488[4] = { 'p', 'i', 'j', 'e' }; +static const symbol s_2_489[4] = { 'r', 'i', 'j', 'e' }; +static const symbol s_2_490[4] = { 's', 'i', 'j', 'e' }; +static const symbol s_2_491[5] = { 'o', 's', 'i', 'j', 'e' }; +static const symbol s_2_492[4] = { 't', 'i', 'j', 'e' }; +static const symbol s_2_493[5] = { 'a', 't', 'i', 'j', 'e' }; +static const symbol s_2_494[7] = { 'e', 'v', 'i', 't', 'i', 'j', 'e' }; +static const symbol s_2_495[7] = { 'o', 'v', 'i', 't', 'i', 'j', 'e' }; +static const symbol s_2_496[6] = { 'a', 's', 't', 'i', 'j', 'e' }; +static const symbol s_2_497[5] = { 'a', 'v', 'i', 'j', 'e' }; +static const symbol s_2_498[5] = { 'e', 'v', 'i', 'j', 'e' }; +static const symbol s_2_499[5] = { 'i', 'v', 'i', 'j', 'e' }; +static const symbol s_2_500[5] = { 'o', 'v', 'i', 'j', 'e' }; +static const symbol s_2_501[4] = { 'z', 'i', 'j', 'e' }; +static const symbol s_2_502[6] = { 'o', 0xC5, 0xA1, 'i', 'j', 'e' }; +static const symbol s_2_503[5] = { 0xC5, 0xBE, 'i', 'j', 'e' }; +static const symbol s_2_504[4] = { 'a', 'n', 'j', 'e' }; +static const symbol s_2_505[4] = { 'e', 'n', 'j', 'e' }; +static const symbol s_2_506[4] = { 's', 'n', 'j', 'e' }; +static const symbol s_2_507[5] = { 0xC5, 0xA1, 'n', 'j', 'e' }; +static const symbol s_2_508[3] = { 'u', 'j', 'e' }; +static const symbol s_2_509[6] = { 'l', 'u', 'c', 'u', 'j', 'e' }; +static const symbol s_2_510[5] = { 'i', 'r', 'u', 'j', 'e' }; +static const symbol s_2_511[7] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'e' }; +static const symbol s_2_512[2] = { 'k', 'e' }; +static const symbol s_2_513[3] = { 's', 'k', 'e' }; +static const symbol s_2_514[4] = { 0xC5, 0xA1, 'k', 'e' }; +static const symbol s_2_515[3] = { 'a', 'l', 'e' }; +static const symbol s_2_516[5] = { 'a', 'c', 'a', 'l', 'e' }; +static const symbol s_2_517[8] = { 'a', 's', 't', 'a', 'j', 'a', 'l', 'e' }; +static const symbol s_2_518[8] = { 'i', 's', 't', 'a', 'j', 'a', 'l', 'e' }; +static const symbol s_2_519[8] = { 'o', 's', 't', 'a', 'j', 'a', 'l', 'e' }; +static const symbol s_2_520[5] = { 'i', 'j', 'a', 'l', 'e' }; +static const symbol s_2_521[6] = { 'i', 'n', 'j', 'a', 'l', 'e' }; +static const symbol s_2_522[4] = { 'n', 'a', 'l', 'e' }; +static const symbol s_2_523[5] = { 'i', 'r', 'a', 'l', 'e' }; +static const symbol s_2_524[5] = { 'u', 'r', 'a', 'l', 'e' }; +static const symbol s_2_525[4] = { 't', 'a', 'l', 'e' }; +static const symbol s_2_526[6] = { 'a', 's', 't', 'a', 'l', 'e' }; +static const symbol s_2_527[6] = { 'i', 's', 't', 'a', 'l', 'e' }; +static const symbol s_2_528[6] = { 'o', 's', 't', 'a', 'l', 'e' }; +static const symbol s_2_529[5] = { 'a', 'v', 'a', 'l', 'e' }; +static const symbol s_2_530[5] = { 'e', 'v', 'a', 'l', 'e' }; +static const symbol s_2_531[5] = { 'i', 'v', 'a', 'l', 'e' }; +static const symbol s_2_532[5] = { 'o', 'v', 'a', 'l', 'e' }; +static const symbol s_2_533[5] = { 'u', 'v', 'a', 'l', 'e' }; +static const symbol s_2_534[6] = { 'a', 0xC4, 0x8D, 'a', 'l', 'e' }; +static const symbol s_2_535[3] = { 'e', 'l', 'e' }; +static const symbol s_2_536[3] = { 'i', 'l', 'e' }; +static const symbol s_2_537[5] = { 'a', 'c', 'i', 'l', 'e' }; +static const symbol s_2_538[6] = { 'l', 'u', 'c', 'i', 'l', 'e' }; +static const symbol s_2_539[4] = { 'n', 'i', 'l', 'e' }; +static const symbol s_2_540[6] = { 'r', 'o', 's', 'i', 'l', 'e' }; +static const symbol s_2_541[6] = { 'j', 'e', 't', 'i', 'l', 'e' }; +static const symbol s_2_542[5] = { 'o', 'z', 'i', 'l', 'e' }; +static const symbol s_2_543[6] = { 'a', 0xC4, 0x8D, 'i', 'l', 'e' }; +static const symbol s_2_544[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 'l', 'e' }; +static const symbol s_2_545[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 'l', 'e' }; +static const symbol s_2_546[3] = { 'o', 'l', 'e' }; +static const symbol s_2_547[4] = { 'a', 's', 'l', 'e' }; +static const symbol s_2_548[4] = { 'n', 'u', 'l', 'e' }; +static const symbol s_2_549[4] = { 'r', 'a', 'm', 'e' }; +static const symbol s_2_550[4] = { 'l', 'e', 'm', 'e' }; +static const symbol s_2_551[5] = { 'a', 'c', 'o', 'm', 'e' }; +static const symbol s_2_552[5] = { 'e', 'c', 'o', 'm', 'e' }; +static const symbol s_2_553[5] = { 'u', 'c', 'o', 'm', 'e' }; +static const symbol s_2_554[6] = { 'a', 'n', 'j', 'o', 'm', 'e' }; +static const symbol s_2_555[6] = { 'e', 'n', 'j', 'o', 'm', 'e' }; +static const symbol s_2_556[6] = { 's', 'n', 'j', 'o', 'm', 'e' }; +static const symbol s_2_557[7] = { 0xC5, 0xA1, 'n', 'j', 'o', 'm', 'e' }; +static const symbol s_2_558[4] = { 'k', 'o', 'm', 'e' }; +static const symbol s_2_559[5] = { 's', 'k', 'o', 'm', 'e' }; +static const symbol s_2_560[6] = { 0xC5, 0xA1, 'k', 'o', 'm', 'e' }; +static const symbol s_2_561[5] = { 'e', 'l', 'o', 'm', 'e' }; +static const symbol s_2_562[4] = { 'n', 'o', 'm', 'e' }; +static const symbol s_2_563[6] = { 'c', 'i', 'n', 'o', 'm', 'e' }; +static const symbol s_2_564[7] = { 0xC4, 0x8D, 'i', 'n', 'o', 'm', 'e' }; +static const symbol s_2_565[5] = { 'o', 's', 'o', 'm', 'e' }; +static const symbol s_2_566[5] = { 'a', 't', 'o', 'm', 'e' }; +static const symbol s_2_567[7] = { 'e', 'v', 'i', 't', 'o', 'm', 'e' }; +static const symbol s_2_568[7] = { 'o', 'v', 'i', 't', 'o', 'm', 'e' }; +static const symbol s_2_569[6] = { 'a', 's', 't', 'o', 'm', 'e' }; +static const symbol s_2_570[5] = { 'a', 'v', 'o', 'm', 'e' }; +static const symbol s_2_571[5] = { 'e', 'v', 'o', 'm', 'e' }; +static const symbol s_2_572[5] = { 'i', 'v', 'o', 'm', 'e' }; +static const symbol s_2_573[5] = { 'o', 'v', 'o', 'm', 'e' }; +static const symbol s_2_574[6] = { 'a', 0xC4, 0x87, 'o', 'm', 'e' }; +static const symbol s_2_575[6] = { 'e', 0xC4, 0x87, 'o', 'm', 'e' }; +static const symbol s_2_576[6] = { 'u', 0xC4, 0x87, 'o', 'm', 'e' }; +static const symbol s_2_577[6] = { 'o', 0xC5, 0xA1, 'o', 'm', 'e' }; +static const symbol s_2_578[2] = { 'n', 'e' }; +static const symbol s_2_579[3] = { 'a', 'n', 'e' }; +static const symbol s_2_580[5] = { 'a', 'c', 'a', 'n', 'e' }; +static const symbol s_2_581[5] = { 'u', 'r', 'a', 'n', 'e' }; +static const symbol s_2_582[4] = { 't', 'a', 'n', 'e' }; +static const symbol s_2_583[6] = { 'a', 's', 't', 'a', 'n', 'e' }; +static const symbol s_2_584[6] = { 'i', 's', 't', 'a', 'n', 'e' }; +static const symbol s_2_585[6] = { 'o', 's', 't', 'a', 'n', 'e' }; +static const symbol s_2_586[5] = { 'a', 'v', 'a', 'n', 'e' }; +static const symbol s_2_587[5] = { 'e', 'v', 'a', 'n', 'e' }; +static const symbol s_2_588[5] = { 'i', 'v', 'a', 'n', 'e' }; +static const symbol s_2_589[5] = { 'u', 'v', 'a', 'n', 'e' }; +static const symbol s_2_590[6] = { 'a', 0xC4, 0x8D, 'a', 'n', 'e' }; +static const symbol s_2_591[5] = { 'a', 'c', 'e', 'n', 'e' }; +static const symbol s_2_592[6] = { 'l', 'u', 'c', 'e', 'n', 'e' }; +static const symbol s_2_593[6] = { 'a', 0xC4, 0x8D, 'e', 'n', 'e' }; +static const symbol s_2_594[7] = { 'l', 'u', 0xC4, 0x8D, 'e', 'n', 'e' }; +static const symbol s_2_595[3] = { 'i', 'n', 'e' }; +static const symbol s_2_596[4] = { 'c', 'i', 'n', 'e' }; +static const symbol s_2_597[5] = { 'a', 'n', 'i', 'n', 'e' }; +static const symbol s_2_598[5] = { 0xC4, 0x8D, 'i', 'n', 'e' }; +static const symbol s_2_599[3] = { 'o', 'n', 'e' }; +static const symbol s_2_600[3] = { 'a', 'r', 'e' }; +static const symbol s_2_601[3] = { 'd', 'r', 'e' }; +static const symbol s_2_602[3] = { 'e', 'r', 'e' }; +static const symbol s_2_603[3] = { 'o', 'r', 'e' }; +static const symbol s_2_604[3] = { 'a', 's', 'e' }; +static const symbol s_2_605[4] = { 'b', 'a', 's', 'e' }; +static const symbol s_2_606[5] = { 'a', 'c', 'a', 's', 'e' }; +static const symbol s_2_607[4] = { 'g', 'a', 's', 'e' }; +static const symbol s_2_608[4] = { 'j', 'a', 's', 'e' }; +static const symbol s_2_609[8] = { 'a', 's', 't', 'a', 'j', 'a', 's', 'e' }; +static const symbol s_2_610[8] = { 'i', 's', 't', 'a', 'j', 'a', 's', 'e' }; +static const symbol s_2_611[8] = { 'o', 's', 't', 'a', 'j', 'a', 's', 'e' }; +static const symbol s_2_612[6] = { 'i', 'n', 'j', 'a', 's', 'e' }; +static const symbol s_2_613[4] = { 'k', 'a', 's', 'e' }; +static const symbol s_2_614[4] = { 'n', 'a', 's', 'e' }; +static const symbol s_2_615[5] = { 'i', 'r', 'a', 's', 'e' }; +static const symbol s_2_616[5] = { 'u', 'r', 'a', 's', 'e' }; +static const symbol s_2_617[4] = { 't', 'a', 's', 'e' }; +static const symbol s_2_618[4] = { 'v', 'a', 's', 'e' }; +static const symbol s_2_619[5] = { 'a', 'v', 'a', 's', 'e' }; +static const symbol s_2_620[5] = { 'e', 'v', 'a', 's', 'e' }; +static const symbol s_2_621[5] = { 'i', 'v', 'a', 's', 'e' }; +static const symbol s_2_622[5] = { 'o', 'v', 'a', 's', 'e' }; +static const symbol s_2_623[5] = { 'u', 'v', 'a', 's', 'e' }; +static const symbol s_2_624[3] = { 'e', 's', 'e' }; +static const symbol s_2_625[3] = { 'i', 's', 'e' }; +static const symbol s_2_626[5] = { 'a', 'c', 'i', 's', 'e' }; +static const symbol s_2_627[6] = { 'l', 'u', 'c', 'i', 's', 'e' }; +static const symbol s_2_628[6] = { 'r', 'o', 's', 'i', 's', 'e' }; +static const symbol s_2_629[6] = { 'j', 'e', 't', 'i', 's', 'e' }; +static const symbol s_2_630[3] = { 'o', 's', 'e' }; +static const symbol s_2_631[8] = { 'a', 's', 't', 'a', 'd', 'o', 's', 'e' }; +static const symbol s_2_632[8] = { 'i', 's', 't', 'a', 'd', 'o', 's', 'e' }; +static const symbol s_2_633[8] = { 'o', 's', 't', 'a', 'd', 'o', 's', 'e' }; +static const symbol s_2_634[3] = { 'a', 't', 'e' }; +static const symbol s_2_635[5] = { 'a', 'c', 'a', 't', 'e' }; +static const symbol s_2_636[5] = { 'i', 'k', 'a', 't', 'e' }; +static const symbol s_2_637[4] = { 'l', 'a', 't', 'e' }; +static const symbol s_2_638[5] = { 'i', 'r', 'a', 't', 'e' }; +static const symbol s_2_639[5] = { 'u', 'r', 'a', 't', 'e' }; +static const symbol s_2_640[4] = { 't', 'a', 't', 'e' }; +static const symbol s_2_641[5] = { 'a', 'v', 'a', 't', 'e' }; +static const symbol s_2_642[5] = { 'e', 'v', 'a', 't', 'e' }; +static const symbol s_2_643[5] = { 'i', 'v', 'a', 't', 'e' }; +static const symbol s_2_644[5] = { 'u', 'v', 'a', 't', 'e' }; +static const symbol s_2_645[6] = { 'a', 0xC4, 0x8D, 'a', 't', 'e' }; +static const symbol s_2_646[3] = { 'e', 't', 'e' }; +static const symbol s_2_647[8] = { 'a', 's', 't', 'a', 'd', 'e', 't', 'e' }; +static const symbol s_2_648[8] = { 'i', 's', 't', 'a', 'd', 'e', 't', 'e' }; +static const symbol s_2_649[8] = { 'o', 's', 't', 'a', 'd', 'e', 't', 'e' }; +static const symbol s_2_650[8] = { 'a', 's', 't', 'a', 'j', 'e', 't', 'e' }; +static const symbol s_2_651[8] = { 'i', 's', 't', 'a', 'j', 'e', 't', 'e' }; +static const symbol s_2_652[8] = { 'o', 's', 't', 'a', 'j', 'e', 't', 'e' }; +static const symbol s_2_653[5] = { 'i', 'j', 'e', 't', 'e' }; +static const symbol s_2_654[6] = { 'i', 'n', 'j', 'e', 't', 'e' }; +static const symbol s_2_655[5] = { 'u', 'j', 'e', 't', 'e' }; +static const symbol s_2_656[8] = { 'l', 'u', 'c', 'u', 'j', 'e', 't', 'e' }; +static const symbol s_2_657[7] = { 'i', 'r', 'u', 'j', 'e', 't', 'e' }; +static const symbol s_2_658[9] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'e', 't', 'e' }; +static const symbol s_2_659[4] = { 'n', 'e', 't', 'e' }; +static const symbol s_2_660[8] = { 'a', 's', 't', 'a', 'n', 'e', 't', 'e' }; +static const symbol s_2_661[8] = { 'i', 's', 't', 'a', 'n', 'e', 't', 'e' }; +static const symbol s_2_662[8] = { 'o', 's', 't', 'a', 'n', 'e', 't', 'e' }; +static const symbol s_2_663[6] = { 'a', 's', 't', 'e', 't', 'e' }; +static const symbol s_2_664[3] = { 'i', 't', 'e' }; +static const symbol s_2_665[5] = { 'a', 'c', 'i', 't', 'e' }; +static const symbol s_2_666[6] = { 'l', 'u', 'c', 'i', 't', 'e' }; +static const symbol s_2_667[4] = { 'n', 'i', 't', 'e' }; +static const symbol s_2_668[8] = { 'a', 's', 't', 'a', 'n', 'i', 't', 'e' }; +static const symbol s_2_669[8] = { 'i', 's', 't', 'a', 'n', 'i', 't', 'e' }; +static const symbol s_2_670[8] = { 'o', 's', 't', 'a', 'n', 'i', 't', 'e' }; +static const symbol s_2_671[6] = { 'r', 'o', 's', 'i', 't', 'e' }; +static const symbol s_2_672[6] = { 'j', 'e', 't', 'i', 't', 'e' }; +static const symbol s_2_673[6] = { 'a', 's', 't', 'i', 't', 'e' }; +static const symbol s_2_674[5] = { 'e', 'v', 'i', 't', 'e' }; +static const symbol s_2_675[5] = { 'o', 'v', 'i', 't', 'e' }; +static const symbol s_2_676[6] = { 'a', 0xC4, 0x8D, 'i', 't', 'e' }; +static const symbol s_2_677[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 't', 'e' }; +static const symbol s_2_678[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 't', 'e' }; +static const symbol s_2_679[4] = { 'a', 'j', 't', 'e' }; +static const symbol s_2_680[6] = { 'u', 'r', 'a', 'j', 't', 'e' }; +static const symbol s_2_681[5] = { 't', 'a', 'j', 't', 'e' }; +static const symbol s_2_682[7] = { 'a', 's', 't', 'a', 'j', 't', 'e' }; +static const symbol s_2_683[7] = { 'i', 's', 't', 'a', 'j', 't', 'e' }; +static const symbol s_2_684[7] = { 'o', 's', 't', 'a', 'j', 't', 'e' }; +static const symbol s_2_685[6] = { 'a', 'v', 'a', 'j', 't', 'e' }; +static const symbol s_2_686[6] = { 'e', 'v', 'a', 'j', 't', 'e' }; +static const symbol s_2_687[6] = { 'i', 'v', 'a', 'j', 't', 'e' }; +static const symbol s_2_688[6] = { 'u', 'v', 'a', 'j', 't', 'e' }; +static const symbol s_2_689[4] = { 'i', 'j', 't', 'e' }; +static const symbol s_2_690[7] = { 'l', 'u', 'c', 'u', 'j', 't', 'e' }; +static const symbol s_2_691[6] = { 'i', 'r', 'u', 'j', 't', 'e' }; +static const symbol s_2_692[8] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 't', 'e' }; +static const symbol s_2_693[4] = { 'a', 's', 't', 'e' }; +static const symbol s_2_694[6] = { 'a', 'c', 'a', 's', 't', 'e' }; +static const symbol s_2_695[9] = { 'a', 's', 't', 'a', 'j', 'a', 's', 't', 'e' }; +static const symbol s_2_696[9] = { 'i', 's', 't', 'a', 'j', 'a', 's', 't', 'e' }; +static const symbol s_2_697[9] = { 'o', 's', 't', 'a', 'j', 'a', 's', 't', 'e' }; +static const symbol s_2_698[7] = { 'i', 'n', 'j', 'a', 's', 't', 'e' }; +static const symbol s_2_699[6] = { 'i', 'r', 'a', 's', 't', 'e' }; +static const symbol s_2_700[6] = { 'u', 'r', 'a', 's', 't', 'e' }; +static const symbol s_2_701[5] = { 't', 'a', 's', 't', 'e' }; +static const symbol s_2_702[6] = { 'a', 'v', 'a', 's', 't', 'e' }; +static const symbol s_2_703[6] = { 'e', 'v', 'a', 's', 't', 'e' }; +static const symbol s_2_704[6] = { 'i', 'v', 'a', 's', 't', 'e' }; +static const symbol s_2_705[6] = { 'o', 'v', 'a', 's', 't', 'e' }; +static const symbol s_2_706[6] = { 'u', 'v', 'a', 's', 't', 'e' }; +static const symbol s_2_707[7] = { 'a', 0xC4, 0x8D, 'a', 's', 't', 'e' }; +static const symbol s_2_708[4] = { 'e', 's', 't', 'e' }; +static const symbol s_2_709[4] = { 'i', 's', 't', 'e' }; +static const symbol s_2_710[6] = { 'a', 'c', 'i', 's', 't', 'e' }; +static const symbol s_2_711[7] = { 'l', 'u', 'c', 'i', 's', 't', 'e' }; +static const symbol s_2_712[5] = { 'n', 'i', 's', 't', 'e' }; +static const symbol s_2_713[7] = { 'r', 'o', 's', 'i', 's', 't', 'e' }; +static const symbol s_2_714[7] = { 'j', 'e', 't', 'i', 's', 't', 'e' }; +static const symbol s_2_715[7] = { 'a', 0xC4, 0x8D, 'i', 's', 't', 'e' }; +static const symbol s_2_716[8] = { 'l', 'u', 0xC4, 0x8D, 'i', 's', 't', 'e' }; +static const symbol s_2_717[8] = { 'r', 'o', 0xC5, 0xA1, 'i', 's', 't', 'e' }; +static const symbol s_2_718[4] = { 'k', 's', 't', 'e' }; +static const symbol s_2_719[4] = { 'o', 's', 't', 'e' }; +static const symbol s_2_720[9] = { 'a', 's', 't', 'a', 'd', 'o', 's', 't', 'e' }; +static const symbol s_2_721[9] = { 'i', 's', 't', 'a', 'd', 'o', 's', 't', 'e' }; +static const symbol s_2_722[9] = { 'o', 's', 't', 'a', 'd', 'o', 's', 't', 'e' }; +static const symbol s_2_723[5] = { 'n', 'u', 's', 't', 'e' }; +static const symbol s_2_724[5] = { 'i', 0xC5, 0xA1, 't', 'e' }; +static const symbol s_2_725[3] = { 'a', 'v', 'e' }; +static const symbol s_2_726[3] = { 'e', 'v', 'e' }; +static const symbol s_2_727[5] = { 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_728[6] = { 'c', 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_729[6] = { 'l', 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_730[6] = { 'r', 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_731[7] = { 0xC4, 0x87, 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_732[7] = { 0xC4, 0x8D, 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_733[7] = { 0xC4, 0x91, 'a', 'j', 'e', 'v', 'e' }; +static const symbol s_2_734[3] = { 'i', 'v', 'e' }; +static const symbol s_2_735[3] = { 'o', 'v', 'e' }; +static const symbol s_2_736[4] = { 'g', 'o', 'v', 'e' }; +static const symbol s_2_737[5] = { 'u', 'g', 'o', 'v', 'e' }; +static const symbol s_2_738[4] = { 'l', 'o', 'v', 'e' }; +static const symbol s_2_739[5] = { 'o', 'l', 'o', 'v', 'e' }; +static const symbol s_2_740[4] = { 'm', 'o', 'v', 'e' }; +static const symbol s_2_741[5] = { 'o', 'n', 'o', 'v', 'e' }; +static const symbol s_2_742[4] = { 'a', 0xC4, 0x87, 'e' }; +static const symbol s_2_743[4] = { 'e', 0xC4, 0x87, 'e' }; +static const symbol s_2_744[4] = { 'u', 0xC4, 0x87, 'e' }; +static const symbol s_2_745[4] = { 'a', 0xC4, 0x8D, 'e' }; +static const symbol s_2_746[5] = { 'l', 'u', 0xC4, 0x8D, 'e' }; +static const symbol s_2_747[4] = { 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_748[5] = { 'b', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_749[5] = { 'g', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_750[5] = { 'j', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_751[9] = { 'a', 's', 't', 'a', 'j', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_752[9] = { 'i', 's', 't', 'a', 'j', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_753[9] = { 'o', 's', 't', 'a', 'j', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_754[7] = { 'i', 'n', 'j', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_755[5] = { 'k', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_756[5] = { 'n', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_757[6] = { 'i', 'r', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_758[6] = { 'u', 'r', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_759[5] = { 't', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_760[5] = { 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_761[6] = { 'a', 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_762[6] = { 'e', 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_763[6] = { 'i', 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_764[6] = { 'o', 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_765[6] = { 'u', 'v', 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_766[7] = { 'a', 0xC4, 0x8D, 'a', 0xC5, 0xA1, 'e' }; +static const symbol s_2_767[4] = { 'e', 0xC5, 0xA1, 'e' }; +static const symbol s_2_768[4] = { 'i', 0xC5, 0xA1, 'e' }; +static const symbol s_2_769[7] = { 'j', 'e', 't', 'i', 0xC5, 0xA1, 'e' }; +static const symbol s_2_770[7] = { 'a', 0xC4, 0x8D, 'i', 0xC5, 0xA1, 'e' }; +static const symbol s_2_771[8] = { 'l', 'u', 0xC4, 0x8D, 'i', 0xC5, 0xA1, 'e' }; +static const symbol s_2_772[8] = { 'r', 'o', 0xC5, 0xA1, 'i', 0xC5, 0xA1, 'e' }; +static const symbol s_2_773[4] = { 'o', 0xC5, 0xA1, 'e' }; +static const symbol s_2_774[9] = { 'a', 's', 't', 'a', 'd', 'o', 0xC5, 0xA1, 'e' }; +static const symbol s_2_775[9] = { 'i', 's', 't', 'a', 'd', 'o', 0xC5, 0xA1, 'e' }; +static const symbol s_2_776[9] = { 'o', 's', 't', 'a', 'd', 'o', 0xC5, 0xA1, 'e' }; +static const symbol s_2_777[4] = { 'a', 'c', 'e', 'g' }; +static const symbol s_2_778[4] = { 'e', 'c', 'e', 'g' }; +static const symbol s_2_779[4] = { 'u', 'c', 'e', 'g' }; +static const symbol s_2_780[7] = { 'a', 'n', 'j', 'i', 'j', 'e', 'g' }; +static const symbol s_2_781[7] = { 'e', 'n', 'j', 'i', 'j', 'e', 'g' }; +static const symbol s_2_782[7] = { 's', 'n', 'j', 'i', 'j', 'e', 'g' }; +static const symbol s_2_783[8] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'e', 'g' }; +static const symbol s_2_784[5] = { 'k', 'i', 'j', 'e', 'g' }; +static const symbol s_2_785[6] = { 's', 'k', 'i', 'j', 'e', 'g' }; +static const symbol s_2_786[7] = { 0xC5, 0xA1, 'k', 'i', 'j', 'e', 'g' }; +static const symbol s_2_787[6] = { 'e', 'l', 'i', 'j', 'e', 'g' }; +static const symbol s_2_788[5] = { 'n', 'i', 'j', 'e', 'g' }; +static const symbol s_2_789[6] = { 'o', 's', 'i', 'j', 'e', 'g' }; +static const symbol s_2_790[6] = { 'a', 't', 'i', 'j', 'e', 'g' }; +static const symbol s_2_791[8] = { 'e', 'v', 'i', 't', 'i', 'j', 'e', 'g' }; +static const symbol s_2_792[8] = { 'o', 'v', 'i', 't', 'i', 'j', 'e', 'g' }; +static const symbol s_2_793[7] = { 'a', 's', 't', 'i', 'j', 'e', 'g' }; +static const symbol s_2_794[6] = { 'a', 'v', 'i', 'j', 'e', 'g' }; +static const symbol s_2_795[6] = { 'e', 'v', 'i', 'j', 'e', 'g' }; +static const symbol s_2_796[6] = { 'i', 'v', 'i', 'j', 'e', 'g' }; +static const symbol s_2_797[6] = { 'o', 'v', 'i', 'j', 'e', 'g' }; +static const symbol s_2_798[7] = { 'o', 0xC5, 0xA1, 'i', 'j', 'e', 'g' }; +static const symbol s_2_799[5] = { 'a', 'n', 'j', 'e', 'g' }; +static const symbol s_2_800[5] = { 'e', 'n', 'j', 'e', 'g' }; +static const symbol s_2_801[5] = { 's', 'n', 'j', 'e', 'g' }; +static const symbol s_2_802[6] = { 0xC5, 0xA1, 'n', 'j', 'e', 'g' }; +static const symbol s_2_803[3] = { 'k', 'e', 'g' }; +static const symbol s_2_804[4] = { 'e', 'l', 'e', 'g' }; +static const symbol s_2_805[3] = { 'n', 'e', 'g' }; +static const symbol s_2_806[4] = { 'a', 'n', 'e', 'g' }; +static const symbol s_2_807[4] = { 'e', 'n', 'e', 'g' }; +static const symbol s_2_808[4] = { 's', 'n', 'e', 'g' }; +static const symbol s_2_809[5] = { 0xC5, 0xA1, 'n', 'e', 'g' }; +static const symbol s_2_810[4] = { 'o', 's', 'e', 'g' }; +static const symbol s_2_811[4] = { 'a', 't', 'e', 'g' }; +static const symbol s_2_812[4] = { 'a', 'v', 'e', 'g' }; +static const symbol s_2_813[4] = { 'e', 'v', 'e', 'g' }; +static const symbol s_2_814[4] = { 'i', 'v', 'e', 'g' }; +static const symbol s_2_815[4] = { 'o', 'v', 'e', 'g' }; +static const symbol s_2_816[5] = { 'a', 0xC4, 0x87, 'e', 'g' }; +static const symbol s_2_817[5] = { 'e', 0xC4, 0x87, 'e', 'g' }; +static const symbol s_2_818[5] = { 'u', 0xC4, 0x87, 'e', 'g' }; +static const symbol s_2_819[5] = { 'o', 0xC5, 0xA1, 'e', 'g' }; +static const symbol s_2_820[4] = { 'a', 'c', 'o', 'g' }; +static const symbol s_2_821[4] = { 'e', 'c', 'o', 'g' }; +static const symbol s_2_822[4] = { 'u', 'c', 'o', 'g' }; +static const symbol s_2_823[5] = { 'a', 'n', 'j', 'o', 'g' }; +static const symbol s_2_824[5] = { 'e', 'n', 'j', 'o', 'g' }; +static const symbol s_2_825[5] = { 's', 'n', 'j', 'o', 'g' }; +static const symbol s_2_826[6] = { 0xC5, 0xA1, 'n', 'j', 'o', 'g' }; +static const symbol s_2_827[3] = { 'k', 'o', 'g' }; +static const symbol s_2_828[4] = { 's', 'k', 'o', 'g' }; +static const symbol s_2_829[5] = { 0xC5, 0xA1, 'k', 'o', 'g' }; +static const symbol s_2_830[4] = { 'e', 'l', 'o', 'g' }; +static const symbol s_2_831[3] = { 'n', 'o', 'g' }; +static const symbol s_2_832[5] = { 'c', 'i', 'n', 'o', 'g' }; +static const symbol s_2_833[6] = { 0xC4, 0x8D, 'i', 'n', 'o', 'g' }; +static const symbol s_2_834[4] = { 'o', 's', 'o', 'g' }; +static const symbol s_2_835[4] = { 'a', 't', 'o', 'g' }; +static const symbol s_2_836[6] = { 'e', 'v', 'i', 't', 'o', 'g' }; +static const symbol s_2_837[6] = { 'o', 'v', 'i', 't', 'o', 'g' }; +static const symbol s_2_838[5] = { 'a', 's', 't', 'o', 'g' }; +static const symbol s_2_839[4] = { 'a', 'v', 'o', 'g' }; +static const symbol s_2_840[4] = { 'e', 'v', 'o', 'g' }; +static const symbol s_2_841[4] = { 'i', 'v', 'o', 'g' }; +static const symbol s_2_842[4] = { 'o', 'v', 'o', 'g' }; +static const symbol s_2_843[5] = { 'a', 0xC4, 0x87, 'o', 'g' }; +static const symbol s_2_844[5] = { 'e', 0xC4, 0x87, 'o', 'g' }; +static const symbol s_2_845[5] = { 'u', 0xC4, 0x87, 'o', 'g' }; +static const symbol s_2_846[5] = { 'o', 0xC5, 0xA1, 'o', 'g' }; +static const symbol s_2_847[2] = { 'a', 'h' }; +static const symbol s_2_848[4] = { 'a', 'c', 'a', 'h' }; +static const symbol s_2_849[7] = { 'a', 's', 't', 'a', 'j', 'a', 'h' }; +static const symbol s_2_850[7] = { 'i', 's', 't', 'a', 'j', 'a', 'h' }; +static const symbol s_2_851[7] = { 'o', 's', 't', 'a', 'j', 'a', 'h' }; +static const symbol s_2_852[5] = { 'i', 'n', 'j', 'a', 'h' }; +static const symbol s_2_853[4] = { 'i', 'r', 'a', 'h' }; +static const symbol s_2_854[4] = { 'u', 'r', 'a', 'h' }; +static const symbol s_2_855[3] = { 't', 'a', 'h' }; +static const symbol s_2_856[4] = { 'a', 'v', 'a', 'h' }; +static const symbol s_2_857[4] = { 'e', 'v', 'a', 'h' }; +static const symbol s_2_858[4] = { 'i', 'v', 'a', 'h' }; +static const symbol s_2_859[4] = { 'o', 'v', 'a', 'h' }; +static const symbol s_2_860[4] = { 'u', 'v', 'a', 'h' }; +static const symbol s_2_861[5] = { 'a', 0xC4, 0x8D, 'a', 'h' }; +static const symbol s_2_862[2] = { 'i', 'h' }; +static const symbol s_2_863[4] = { 'a', 'c', 'i', 'h' }; +static const symbol s_2_864[4] = { 'e', 'c', 'i', 'h' }; +static const symbol s_2_865[4] = { 'u', 'c', 'i', 'h' }; +static const symbol s_2_866[5] = { 'l', 'u', 'c', 'i', 'h' }; +static const symbol s_2_867[7] = { 'a', 'n', 'j', 'i', 'j', 'i', 'h' }; +static const symbol s_2_868[7] = { 'e', 'n', 'j', 'i', 'j', 'i', 'h' }; +static const symbol s_2_869[7] = { 's', 'n', 'j', 'i', 'j', 'i', 'h' }; +static const symbol s_2_870[8] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'i', 'h' }; +static const symbol s_2_871[5] = { 'k', 'i', 'j', 'i', 'h' }; +static const symbol s_2_872[6] = { 's', 'k', 'i', 'j', 'i', 'h' }; +static const symbol s_2_873[7] = { 0xC5, 0xA1, 'k', 'i', 'j', 'i', 'h' }; +static const symbol s_2_874[6] = { 'e', 'l', 'i', 'j', 'i', 'h' }; +static const symbol s_2_875[5] = { 'n', 'i', 'j', 'i', 'h' }; +static const symbol s_2_876[6] = { 'o', 's', 'i', 'j', 'i', 'h' }; +static const symbol s_2_877[6] = { 'a', 't', 'i', 'j', 'i', 'h' }; +static const symbol s_2_878[8] = { 'e', 'v', 'i', 't', 'i', 'j', 'i', 'h' }; +static const symbol s_2_879[8] = { 'o', 'v', 'i', 't', 'i', 'j', 'i', 'h' }; +static const symbol s_2_880[7] = { 'a', 's', 't', 'i', 'j', 'i', 'h' }; +static const symbol s_2_881[6] = { 'a', 'v', 'i', 'j', 'i', 'h' }; +static const symbol s_2_882[6] = { 'e', 'v', 'i', 'j', 'i', 'h' }; +static const symbol s_2_883[6] = { 'i', 'v', 'i', 'j', 'i', 'h' }; +static const symbol s_2_884[6] = { 'o', 'v', 'i', 'j', 'i', 'h' }; +static const symbol s_2_885[7] = { 'o', 0xC5, 0xA1, 'i', 'j', 'i', 'h' }; +static const symbol s_2_886[5] = { 'a', 'n', 'j', 'i', 'h' }; +static const symbol s_2_887[5] = { 'e', 'n', 'j', 'i', 'h' }; +static const symbol s_2_888[5] = { 's', 'n', 'j', 'i', 'h' }; +static const symbol s_2_889[6] = { 0xC5, 0xA1, 'n', 'j', 'i', 'h' }; +static const symbol s_2_890[3] = { 'k', 'i', 'h' }; +static const symbol s_2_891[4] = { 's', 'k', 'i', 'h' }; +static const symbol s_2_892[5] = { 0xC5, 0xA1, 'k', 'i', 'h' }; +static const symbol s_2_893[4] = { 'e', 'l', 'i', 'h' }; +static const symbol s_2_894[3] = { 'n', 'i', 'h' }; +static const symbol s_2_895[5] = { 'c', 'i', 'n', 'i', 'h' }; +static const symbol s_2_896[6] = { 0xC4, 0x8D, 'i', 'n', 'i', 'h' }; +static const symbol s_2_897[4] = { 'o', 's', 'i', 'h' }; +static const symbol s_2_898[5] = { 'r', 'o', 's', 'i', 'h' }; +static const symbol s_2_899[4] = { 'a', 't', 'i', 'h' }; +static const symbol s_2_900[5] = { 'j', 'e', 't', 'i', 'h' }; +static const symbol s_2_901[6] = { 'e', 'v', 'i', 't', 'i', 'h' }; +static const symbol s_2_902[6] = { 'o', 'v', 'i', 't', 'i', 'h' }; +static const symbol s_2_903[5] = { 'a', 's', 't', 'i', 'h' }; +static const symbol s_2_904[4] = { 'a', 'v', 'i', 'h' }; +static const symbol s_2_905[4] = { 'e', 'v', 'i', 'h' }; +static const symbol s_2_906[4] = { 'i', 'v', 'i', 'h' }; +static const symbol s_2_907[4] = { 'o', 'v', 'i', 'h' }; +static const symbol s_2_908[5] = { 'a', 0xC4, 0x87, 'i', 'h' }; +static const symbol s_2_909[5] = { 'e', 0xC4, 0x87, 'i', 'h' }; +static const symbol s_2_910[5] = { 'u', 0xC4, 0x87, 'i', 'h' }; +static const symbol s_2_911[5] = { 'a', 0xC4, 0x8D, 'i', 'h' }; +static const symbol s_2_912[6] = { 'l', 'u', 0xC4, 0x8D, 'i', 'h' }; +static const symbol s_2_913[5] = { 'o', 0xC5, 0xA1, 'i', 'h' }; +static const symbol s_2_914[6] = { 'r', 'o', 0xC5, 0xA1, 'i', 'h' }; +static const symbol s_2_915[7] = { 'a', 's', 't', 'a', 'd', 'o', 'h' }; +static const symbol s_2_916[7] = { 'i', 's', 't', 'a', 'd', 'o', 'h' }; +static const symbol s_2_917[7] = { 'o', 's', 't', 'a', 'd', 'o', 'h' }; +static const symbol s_2_918[4] = { 'a', 'c', 'u', 'h' }; +static const symbol s_2_919[4] = { 'e', 'c', 'u', 'h' }; +static const symbol s_2_920[4] = { 'u', 'c', 'u', 'h' }; +static const symbol s_2_921[5] = { 'a', 0xC4, 0x87, 'u', 'h' }; +static const symbol s_2_922[5] = { 'e', 0xC4, 0x87, 'u', 'h' }; +static const symbol s_2_923[5] = { 'u', 0xC4, 0x87, 'u', 'h' }; +static const symbol s_2_924[3] = { 'a', 'c', 'i' }; +static const symbol s_2_925[5] = { 'a', 'c', 'e', 'c', 'i' }; +static const symbol s_2_926[4] = { 'i', 'e', 'c', 'i' }; +static const symbol s_2_927[5] = { 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_928[7] = { 'i', 'r', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_929[7] = { 'u', 'r', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_930[8] = { 'a', 's', 't', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_931[8] = { 'i', 's', 't', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_932[8] = { 'o', 's', 't', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_933[7] = { 'a', 'v', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_934[7] = { 'e', 'v', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_935[7] = { 'i', 'v', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_936[7] = { 'u', 'v', 'a', 'j', 'u', 'c', 'i' }; +static const symbol s_2_937[5] = { 'u', 'j', 'u', 'c', 'i' }; +static const symbol s_2_938[8] = { 'l', 'u', 'c', 'u', 'j', 'u', 'c', 'i' }; +static const symbol s_2_939[7] = { 'i', 'r', 'u', 'j', 'u', 'c', 'i' }; +static const symbol s_2_940[4] = { 'l', 'u', 'c', 'i' }; +static const symbol s_2_941[4] = { 'n', 'u', 'c', 'i' }; +static const symbol s_2_942[5] = { 'e', 't', 'u', 'c', 'i' }; +static const symbol s_2_943[6] = { 'a', 's', 't', 'u', 'c', 'i' }; +static const symbol s_2_944[2] = { 'g', 'i' }; +static const symbol s_2_945[3] = { 'u', 'g', 'i' }; +static const symbol s_2_946[3] = { 'a', 'j', 'i' }; +static const symbol s_2_947[4] = { 'c', 'a', 'j', 'i' }; +static const symbol s_2_948[4] = { 'l', 'a', 'j', 'i' }; +static const symbol s_2_949[4] = { 'r', 'a', 'j', 'i' }; +static const symbol s_2_950[5] = { 0xC4, 0x87, 'a', 'j', 'i' }; +static const symbol s_2_951[5] = { 0xC4, 0x8D, 'a', 'j', 'i' }; +static const symbol s_2_952[5] = { 0xC4, 0x91, 'a', 'j', 'i' }; +static const symbol s_2_953[4] = { 'b', 'i', 'j', 'i' }; +static const symbol s_2_954[4] = { 'c', 'i', 'j', 'i' }; +static const symbol s_2_955[4] = { 'd', 'i', 'j', 'i' }; +static const symbol s_2_956[4] = { 'f', 'i', 'j', 'i' }; +static const symbol s_2_957[4] = { 'g', 'i', 'j', 'i' }; +static const symbol s_2_958[6] = { 'a', 'n', 'j', 'i', 'j', 'i' }; +static const symbol s_2_959[6] = { 'e', 'n', 'j', 'i', 'j', 'i' }; +static const symbol s_2_960[6] = { 's', 'n', 'j', 'i', 'j', 'i' }; +static const symbol s_2_961[7] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'i' }; +static const symbol s_2_962[4] = { 'k', 'i', 'j', 'i' }; +static const symbol s_2_963[5] = { 's', 'k', 'i', 'j', 'i' }; +static const symbol s_2_964[6] = { 0xC5, 0xA1, 'k', 'i', 'j', 'i' }; +static const symbol s_2_965[4] = { 'l', 'i', 'j', 'i' }; +static const symbol s_2_966[5] = { 'e', 'l', 'i', 'j', 'i' }; +static const symbol s_2_967[4] = { 'm', 'i', 'j', 'i' }; +static const symbol s_2_968[4] = { 'n', 'i', 'j', 'i' }; +static const symbol s_2_969[6] = { 'g', 'a', 'n', 'i', 'j', 'i' }; +static const symbol s_2_970[6] = { 'm', 'a', 'n', 'i', 'j', 'i' }; +static const symbol s_2_971[6] = { 'p', 'a', 'n', 'i', 'j', 'i' }; +static const symbol s_2_972[6] = { 'r', 'a', 'n', 'i', 'j', 'i' }; +static const symbol s_2_973[6] = { 't', 'a', 'n', 'i', 'j', 'i' }; +static const symbol s_2_974[4] = { 'p', 'i', 'j', 'i' }; +static const symbol s_2_975[4] = { 'r', 'i', 'j', 'i' }; +static const symbol s_2_976[4] = { 's', 'i', 'j', 'i' }; +static const symbol s_2_977[5] = { 'o', 's', 'i', 'j', 'i' }; +static const symbol s_2_978[4] = { 't', 'i', 'j', 'i' }; +static const symbol s_2_979[5] = { 'a', 't', 'i', 'j', 'i' }; +static const symbol s_2_980[7] = { 'e', 'v', 'i', 't', 'i', 'j', 'i' }; +static const symbol s_2_981[7] = { 'o', 'v', 'i', 't', 'i', 'j', 'i' }; +static const symbol s_2_982[6] = { 'a', 's', 't', 'i', 'j', 'i' }; +static const symbol s_2_983[5] = { 'a', 'v', 'i', 'j', 'i' }; +static const symbol s_2_984[5] = { 'e', 'v', 'i', 'j', 'i' }; +static const symbol s_2_985[5] = { 'i', 'v', 'i', 'j', 'i' }; +static const symbol s_2_986[5] = { 'o', 'v', 'i', 'j', 'i' }; +static const symbol s_2_987[4] = { 'z', 'i', 'j', 'i' }; +static const symbol s_2_988[6] = { 'o', 0xC5, 0xA1, 'i', 'j', 'i' }; +static const symbol s_2_989[5] = { 0xC5, 0xBE, 'i', 'j', 'i' }; +static const symbol s_2_990[4] = { 'a', 'n', 'j', 'i' }; +static const symbol s_2_991[4] = { 'e', 'n', 'j', 'i' }; +static const symbol s_2_992[4] = { 's', 'n', 'j', 'i' }; +static const symbol s_2_993[5] = { 0xC5, 0xA1, 'n', 'j', 'i' }; +static const symbol s_2_994[2] = { 'k', 'i' }; +static const symbol s_2_995[3] = { 's', 'k', 'i' }; +static const symbol s_2_996[4] = { 0xC5, 0xA1, 'k', 'i' }; +static const symbol s_2_997[3] = { 'a', 'l', 'i' }; +static const symbol s_2_998[5] = { 'a', 'c', 'a', 'l', 'i' }; +static const symbol s_2_999[8] = { 'a', 's', 't', 'a', 'j', 'a', 'l', 'i' }; +static const symbol s_2_1000[8] = { 'i', 's', 't', 'a', 'j', 'a', 'l', 'i' }; +static const symbol s_2_1001[8] = { 'o', 's', 't', 'a', 'j', 'a', 'l', 'i' }; +static const symbol s_2_1002[5] = { 'i', 'j', 'a', 'l', 'i' }; +static const symbol s_2_1003[6] = { 'i', 'n', 'j', 'a', 'l', 'i' }; +static const symbol s_2_1004[4] = { 'n', 'a', 'l', 'i' }; +static const symbol s_2_1005[5] = { 'i', 'r', 'a', 'l', 'i' }; +static const symbol s_2_1006[5] = { 'u', 'r', 'a', 'l', 'i' }; +static const symbol s_2_1007[4] = { 't', 'a', 'l', 'i' }; +static const symbol s_2_1008[6] = { 'a', 's', 't', 'a', 'l', 'i' }; +static const symbol s_2_1009[6] = { 'i', 's', 't', 'a', 'l', 'i' }; +static const symbol s_2_1010[6] = { 'o', 's', 't', 'a', 'l', 'i' }; +static const symbol s_2_1011[5] = { 'a', 'v', 'a', 'l', 'i' }; +static const symbol s_2_1012[5] = { 'e', 'v', 'a', 'l', 'i' }; +static const symbol s_2_1013[5] = { 'i', 'v', 'a', 'l', 'i' }; +static const symbol s_2_1014[5] = { 'o', 'v', 'a', 'l', 'i' }; +static const symbol s_2_1015[5] = { 'u', 'v', 'a', 'l', 'i' }; +static const symbol s_2_1016[6] = { 'a', 0xC4, 0x8D, 'a', 'l', 'i' }; +static const symbol s_2_1017[3] = { 'e', 'l', 'i' }; +static const symbol s_2_1018[3] = { 'i', 'l', 'i' }; +static const symbol s_2_1019[5] = { 'a', 'c', 'i', 'l', 'i' }; +static const symbol s_2_1020[6] = { 'l', 'u', 'c', 'i', 'l', 'i' }; +static const symbol s_2_1021[4] = { 'n', 'i', 'l', 'i' }; +static const symbol s_2_1022[6] = { 'r', 'o', 's', 'i', 'l', 'i' }; +static const symbol s_2_1023[6] = { 'j', 'e', 't', 'i', 'l', 'i' }; +static const symbol s_2_1024[5] = { 'o', 'z', 'i', 'l', 'i' }; +static const symbol s_2_1025[6] = { 'a', 0xC4, 0x8D, 'i', 'l', 'i' }; +static const symbol s_2_1026[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 'l', 'i' }; +static const symbol s_2_1027[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 'l', 'i' }; +static const symbol s_2_1028[3] = { 'o', 'l', 'i' }; +static const symbol s_2_1029[4] = { 'a', 's', 'l', 'i' }; +static const symbol s_2_1030[4] = { 'n', 'u', 'l', 'i' }; +static const symbol s_2_1031[4] = { 'r', 'a', 'm', 'i' }; +static const symbol s_2_1032[4] = { 'l', 'e', 'm', 'i' }; +static const symbol s_2_1033[2] = { 'n', 'i' }; +static const symbol s_2_1034[3] = { 'a', 'n', 'i' }; +static const symbol s_2_1035[5] = { 'a', 'c', 'a', 'n', 'i' }; +static const symbol s_2_1036[5] = { 'u', 'r', 'a', 'n', 'i' }; +static const symbol s_2_1037[4] = { 't', 'a', 'n', 'i' }; +static const symbol s_2_1038[5] = { 'a', 'v', 'a', 'n', 'i' }; +static const symbol s_2_1039[5] = { 'e', 'v', 'a', 'n', 'i' }; +static const symbol s_2_1040[5] = { 'i', 'v', 'a', 'n', 'i' }; +static const symbol s_2_1041[5] = { 'u', 'v', 'a', 'n', 'i' }; +static const symbol s_2_1042[6] = { 'a', 0xC4, 0x8D, 'a', 'n', 'i' }; +static const symbol s_2_1043[5] = { 'a', 'c', 'e', 'n', 'i' }; +static const symbol s_2_1044[6] = { 'l', 'u', 'c', 'e', 'n', 'i' }; +static const symbol s_2_1045[6] = { 'a', 0xC4, 0x8D, 'e', 'n', 'i' }; +static const symbol s_2_1046[7] = { 'l', 'u', 0xC4, 0x8D, 'e', 'n', 'i' }; +static const symbol s_2_1047[3] = { 'i', 'n', 'i' }; +static const symbol s_2_1048[4] = { 'c', 'i', 'n', 'i' }; +static const symbol s_2_1049[5] = { 0xC4, 0x8D, 'i', 'n', 'i' }; +static const symbol s_2_1050[3] = { 'o', 'n', 'i' }; +static const symbol s_2_1051[3] = { 'a', 'r', 'i' }; +static const symbol s_2_1052[3] = { 'd', 'r', 'i' }; +static const symbol s_2_1053[3] = { 'e', 'r', 'i' }; +static const symbol s_2_1054[3] = { 'o', 'r', 'i' }; +static const symbol s_2_1055[4] = { 'b', 'a', 's', 'i' }; +static const symbol s_2_1056[4] = { 'g', 'a', 's', 'i' }; +static const symbol s_2_1057[4] = { 'j', 'a', 's', 'i' }; +static const symbol s_2_1058[4] = { 'k', 'a', 's', 'i' }; +static const symbol s_2_1059[4] = { 'n', 'a', 's', 'i' }; +static const symbol s_2_1060[4] = { 't', 'a', 's', 'i' }; +static const symbol s_2_1061[4] = { 'v', 'a', 's', 'i' }; +static const symbol s_2_1062[3] = { 'e', 's', 'i' }; +static const symbol s_2_1063[3] = { 'i', 's', 'i' }; +static const symbol s_2_1064[3] = { 'o', 's', 'i' }; +static const symbol s_2_1065[4] = { 'a', 'v', 's', 'i' }; +static const symbol s_2_1066[6] = { 'a', 'c', 'a', 'v', 's', 'i' }; +static const symbol s_2_1067[6] = { 'i', 'r', 'a', 'v', 's', 'i' }; +static const symbol s_2_1068[5] = { 't', 'a', 'v', 's', 'i' }; +static const symbol s_2_1069[6] = { 'e', 't', 'a', 'v', 's', 'i' }; +static const symbol s_2_1070[7] = { 'a', 's', 't', 'a', 'v', 's', 'i' }; +static const symbol s_2_1071[7] = { 'i', 's', 't', 'a', 'v', 's', 'i' }; +static const symbol s_2_1072[7] = { 'o', 's', 't', 'a', 'v', 's', 'i' }; +static const symbol s_2_1073[4] = { 'i', 'v', 's', 'i' }; +static const symbol s_2_1074[5] = { 'n', 'i', 'v', 's', 'i' }; +static const symbol s_2_1075[7] = { 'r', 'o', 's', 'i', 'v', 's', 'i' }; +static const symbol s_2_1076[5] = { 'n', 'u', 'v', 's', 'i' }; +static const symbol s_2_1077[3] = { 'a', 't', 'i' }; +static const symbol s_2_1078[5] = { 'a', 'c', 'a', 't', 'i' }; +static const symbol s_2_1079[8] = { 'a', 's', 't', 'a', 'j', 'a', 't', 'i' }; +static const symbol s_2_1080[8] = { 'i', 's', 't', 'a', 'j', 'a', 't', 'i' }; +static const symbol s_2_1081[8] = { 'o', 's', 't', 'a', 'j', 'a', 't', 'i' }; +static const symbol s_2_1082[6] = { 'i', 'n', 'j', 'a', 't', 'i' }; +static const symbol s_2_1083[5] = { 'i', 'k', 'a', 't', 'i' }; +static const symbol s_2_1084[4] = { 'l', 'a', 't', 'i' }; +static const symbol s_2_1085[5] = { 'i', 'r', 'a', 't', 'i' }; +static const symbol s_2_1086[5] = { 'u', 'r', 'a', 't', 'i' }; +static const symbol s_2_1087[4] = { 't', 'a', 't', 'i' }; +static const symbol s_2_1088[6] = { 'a', 's', 't', 'a', 't', 'i' }; +static const symbol s_2_1089[6] = { 'i', 's', 't', 'a', 't', 'i' }; +static const symbol s_2_1090[6] = { 'o', 's', 't', 'a', 't', 'i' }; +static const symbol s_2_1091[5] = { 'a', 'v', 'a', 't', 'i' }; +static const symbol s_2_1092[5] = { 'e', 'v', 'a', 't', 'i' }; +static const symbol s_2_1093[5] = { 'i', 'v', 'a', 't', 'i' }; +static const symbol s_2_1094[5] = { 'o', 'v', 'a', 't', 'i' }; +static const symbol s_2_1095[5] = { 'u', 'v', 'a', 't', 'i' }; +static const symbol s_2_1096[6] = { 'a', 0xC4, 0x8D, 'a', 't', 'i' }; +static const symbol s_2_1097[3] = { 'e', 't', 'i' }; +static const symbol s_2_1098[3] = { 'i', 't', 'i' }; +static const symbol s_2_1099[5] = { 'a', 'c', 'i', 't', 'i' }; +static const symbol s_2_1100[6] = { 'l', 'u', 'c', 'i', 't', 'i' }; +static const symbol s_2_1101[4] = { 'n', 'i', 't', 'i' }; +static const symbol s_2_1102[6] = { 'r', 'o', 's', 'i', 't', 'i' }; +static const symbol s_2_1103[6] = { 'j', 'e', 't', 'i', 't', 'i' }; +static const symbol s_2_1104[5] = { 'e', 'v', 'i', 't', 'i' }; +static const symbol s_2_1105[5] = { 'o', 'v', 'i', 't', 'i' }; +static const symbol s_2_1106[6] = { 'a', 0xC4, 0x8D, 'i', 't', 'i' }; +static const symbol s_2_1107[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 't', 'i' }; +static const symbol s_2_1108[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 't', 'i' }; +static const symbol s_2_1109[4] = { 'a', 's', 't', 'i' }; +static const symbol s_2_1110[4] = { 'e', 's', 't', 'i' }; +static const symbol s_2_1111[4] = { 'i', 's', 't', 'i' }; +static const symbol s_2_1112[4] = { 'k', 's', 't', 'i' }; +static const symbol s_2_1113[4] = { 'o', 's', 't', 'i' }; +static const symbol s_2_1114[4] = { 'n', 'u', 't', 'i' }; +static const symbol s_2_1115[3] = { 'a', 'v', 'i' }; +static const symbol s_2_1116[3] = { 'e', 'v', 'i' }; +static const symbol s_2_1117[5] = { 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1118[6] = { 'c', 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1119[6] = { 'l', 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1120[6] = { 'r', 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1121[7] = { 0xC4, 0x87, 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1122[7] = { 0xC4, 0x8D, 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1123[7] = { 0xC4, 0x91, 'a', 'j', 'e', 'v', 'i' }; +static const symbol s_2_1124[3] = { 'i', 'v', 'i' }; +static const symbol s_2_1125[3] = { 'o', 'v', 'i' }; +static const symbol s_2_1126[4] = { 'g', 'o', 'v', 'i' }; +static const symbol s_2_1127[5] = { 'u', 'g', 'o', 'v', 'i' }; +static const symbol s_2_1128[4] = { 'l', 'o', 'v', 'i' }; +static const symbol s_2_1129[5] = { 'o', 'l', 'o', 'v', 'i' }; +static const symbol s_2_1130[4] = { 'm', 'o', 'v', 'i' }; +static const symbol s_2_1131[5] = { 'o', 'n', 'o', 'v', 'i' }; +static const symbol s_2_1132[5] = { 'i', 'e', 0xC4, 0x87, 'i' }; +static const symbol s_2_1133[7] = { 'a', 0xC4, 0x8D, 'e', 0xC4, 0x87, 'i' }; +static const symbol s_2_1134[6] = { 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1135[8] = { 'i', 'r', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1136[8] = { 'u', 'r', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1137[9] = { 'a', 's', 't', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1138[9] = { 'i', 's', 't', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1139[9] = { 'o', 's', 't', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1140[8] = { 'a', 'v', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1141[8] = { 'e', 'v', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1142[8] = { 'i', 'v', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1143[8] = { 'u', 'v', 'a', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1144[6] = { 'u', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1145[8] = { 'i', 'r', 'u', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1146[10] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1147[5] = { 'n', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1148[6] = { 'e', 't', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1149[7] = { 'a', 's', 't', 'u', 0xC4, 0x87, 'i' }; +static const symbol s_2_1150[4] = { 'a', 0xC4, 0x8D, 'i' }; +static const symbol s_2_1151[5] = { 'l', 'u', 0xC4, 0x8D, 'i' }; +static const symbol s_2_1152[5] = { 'b', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1153[5] = { 'g', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1154[5] = { 'j', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1155[5] = { 'k', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1156[5] = { 'n', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1157[5] = { 't', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1158[5] = { 'v', 'a', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1159[4] = { 'e', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1160[4] = { 'i', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1161[4] = { 'o', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1162[5] = { 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1163[7] = { 'i', 'r', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1164[6] = { 't', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1165[7] = { 'e', 't', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1166[8] = { 'a', 's', 't', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1167[8] = { 'i', 's', 't', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1168[8] = { 'o', 's', 't', 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1169[8] = { 'a', 0xC4, 0x8D, 'a', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1170[5] = { 'i', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1171[6] = { 'n', 'i', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1172[9] = { 'r', 'o', 0xC5, 0xA1, 'i', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1173[6] = { 'n', 'u', 'v', 0xC5, 0xA1, 'i' }; +static const symbol s_2_1174[2] = { 'a', 'j' }; +static const symbol s_2_1175[4] = { 'u', 'r', 'a', 'j' }; +static const symbol s_2_1176[3] = { 't', 'a', 'j' }; +static const symbol s_2_1177[4] = { 'a', 'v', 'a', 'j' }; +static const symbol s_2_1178[4] = { 'e', 'v', 'a', 'j' }; +static const symbol s_2_1179[4] = { 'i', 'v', 'a', 'j' }; +static const symbol s_2_1180[4] = { 'u', 'v', 'a', 'j' }; +static const symbol s_2_1181[2] = { 'i', 'j' }; +static const symbol s_2_1182[4] = { 'a', 'c', 'o', 'j' }; +static const symbol s_2_1183[4] = { 'e', 'c', 'o', 'j' }; +static const symbol s_2_1184[4] = { 'u', 'c', 'o', 'j' }; +static const symbol s_2_1185[7] = { 'a', 'n', 'j', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1186[7] = { 'e', 'n', 'j', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1187[7] = { 's', 'n', 'j', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1188[8] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1189[5] = { 'k', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1190[6] = { 's', 'k', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1191[7] = { 0xC5, 0xA1, 'k', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1192[6] = { 'e', 'l', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1193[5] = { 'n', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1194[6] = { 'o', 's', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1195[8] = { 'e', 'v', 'i', 't', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1196[8] = { 'o', 'v', 'i', 't', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1197[7] = { 'a', 's', 't', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1198[6] = { 'a', 'v', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1199[6] = { 'e', 'v', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1200[6] = { 'i', 'v', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1201[6] = { 'o', 'v', 'i', 'j', 'o', 'j' }; +static const symbol s_2_1202[7] = { 'o', 0xC5, 0xA1, 'i', 'j', 'o', 'j' }; +static const symbol s_2_1203[5] = { 'a', 'n', 'j', 'o', 'j' }; +static const symbol s_2_1204[5] = { 'e', 'n', 'j', 'o', 'j' }; +static const symbol s_2_1205[5] = { 's', 'n', 'j', 'o', 'j' }; +static const symbol s_2_1206[6] = { 0xC5, 0xA1, 'n', 'j', 'o', 'j' }; +static const symbol s_2_1207[3] = { 'k', 'o', 'j' }; +static const symbol s_2_1208[4] = { 's', 'k', 'o', 'j' }; +static const symbol s_2_1209[5] = { 0xC5, 0xA1, 'k', 'o', 'j' }; +static const symbol s_2_1210[4] = { 'a', 'l', 'o', 'j' }; +static const symbol s_2_1211[4] = { 'e', 'l', 'o', 'j' }; +static const symbol s_2_1212[3] = { 'n', 'o', 'j' }; +static const symbol s_2_1213[5] = { 'c', 'i', 'n', 'o', 'j' }; +static const symbol s_2_1214[6] = { 0xC4, 0x8D, 'i', 'n', 'o', 'j' }; +static const symbol s_2_1215[4] = { 'o', 's', 'o', 'j' }; +static const symbol s_2_1216[4] = { 'a', 't', 'o', 'j' }; +static const symbol s_2_1217[6] = { 'e', 'v', 'i', 't', 'o', 'j' }; +static const symbol s_2_1218[6] = { 'o', 'v', 'i', 't', 'o', 'j' }; +static const symbol s_2_1219[5] = { 'a', 's', 't', 'o', 'j' }; +static const symbol s_2_1220[4] = { 'a', 'v', 'o', 'j' }; +static const symbol s_2_1221[4] = { 'e', 'v', 'o', 'j' }; +static const symbol s_2_1222[4] = { 'i', 'v', 'o', 'j' }; +static const symbol s_2_1223[4] = { 'o', 'v', 'o', 'j' }; +static const symbol s_2_1224[5] = { 'a', 0xC4, 0x87, 'o', 'j' }; +static const symbol s_2_1225[5] = { 'e', 0xC4, 0x87, 'o', 'j' }; +static const symbol s_2_1226[5] = { 'u', 0xC4, 0x87, 'o', 'j' }; +static const symbol s_2_1227[5] = { 'o', 0xC5, 0xA1, 'o', 'j' }; +static const symbol s_2_1228[5] = { 'l', 'u', 'c', 'u', 'j' }; +static const symbol s_2_1229[4] = { 'i', 'r', 'u', 'j' }; +static const symbol s_2_1230[6] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j' }; +static const symbol s_2_1231[2] = { 'a', 'l' }; +static const symbol s_2_1232[4] = { 'i', 'r', 'a', 'l' }; +static const symbol s_2_1233[4] = { 'u', 'r', 'a', 'l' }; +static const symbol s_2_1234[2] = { 'e', 'l' }; +static const symbol s_2_1235[2] = { 'i', 'l' }; +static const symbol s_2_1236[2] = { 'a', 'm' }; +static const symbol s_2_1237[4] = { 'a', 'c', 'a', 'm' }; +static const symbol s_2_1238[4] = { 'i', 'r', 'a', 'm' }; +static const symbol s_2_1239[4] = { 'u', 'r', 'a', 'm' }; +static const symbol s_2_1240[3] = { 't', 'a', 'm' }; +static const symbol s_2_1241[4] = { 'a', 'v', 'a', 'm' }; +static const symbol s_2_1242[4] = { 'e', 'v', 'a', 'm' }; +static const symbol s_2_1243[4] = { 'i', 'v', 'a', 'm' }; +static const symbol s_2_1244[4] = { 'u', 'v', 'a', 'm' }; +static const symbol s_2_1245[5] = { 'a', 0xC4, 0x8D, 'a', 'm' }; +static const symbol s_2_1246[2] = { 'e', 'm' }; +static const symbol s_2_1247[4] = { 'a', 'c', 'e', 'm' }; +static const symbol s_2_1248[4] = { 'e', 'c', 'e', 'm' }; +static const symbol s_2_1249[4] = { 'u', 'c', 'e', 'm' }; +static const symbol s_2_1250[7] = { 'a', 's', 't', 'a', 'd', 'e', 'm' }; +static const symbol s_2_1251[7] = { 'i', 's', 't', 'a', 'd', 'e', 'm' }; +static const symbol s_2_1252[7] = { 'o', 's', 't', 'a', 'd', 'e', 'm' }; +static const symbol s_2_1253[4] = { 'a', 'j', 'e', 'm' }; +static const symbol s_2_1254[5] = { 'c', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1255[5] = { 'l', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1256[5] = { 'r', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1257[7] = { 'a', 's', 't', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1258[7] = { 'i', 's', 't', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1259[7] = { 'o', 's', 't', 'a', 'j', 'e', 'm' }; +static const symbol s_2_1260[6] = { 0xC4, 0x87, 'a', 'j', 'e', 'm' }; +static const symbol s_2_1261[6] = { 0xC4, 0x8D, 'a', 'j', 'e', 'm' }; +static const symbol s_2_1262[6] = { 0xC4, 0x91, 'a', 'j', 'e', 'm' }; +static const symbol s_2_1263[4] = { 'i', 'j', 'e', 'm' }; +static const symbol s_2_1264[7] = { 'a', 'n', 'j', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1265[7] = { 'e', 'n', 'j', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1266[7] = { 's', 'n', 'j', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1267[8] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1268[5] = { 'k', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1269[6] = { 's', 'k', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1270[7] = { 0xC5, 0xA1, 'k', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1271[5] = { 'l', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1272[6] = { 'e', 'l', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1273[5] = { 'n', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1274[7] = { 'r', 'a', 'r', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1275[5] = { 's', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1276[6] = { 'o', 's', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1277[6] = { 'a', 't', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1278[8] = { 'e', 'v', 'i', 't', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1279[8] = { 'o', 'v', 'i', 't', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1280[6] = { 'o', 't', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1281[7] = { 'a', 's', 't', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1282[6] = { 'a', 'v', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1283[6] = { 'e', 'v', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1284[6] = { 'i', 'v', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1285[6] = { 'o', 'v', 'i', 'j', 'e', 'm' }; +static const symbol s_2_1286[7] = { 'o', 0xC5, 0xA1, 'i', 'j', 'e', 'm' }; +static const symbol s_2_1287[5] = { 'a', 'n', 'j', 'e', 'm' }; +static const symbol s_2_1288[5] = { 'e', 'n', 'j', 'e', 'm' }; +static const symbol s_2_1289[5] = { 'i', 'n', 'j', 'e', 'm' }; +static const symbol s_2_1290[5] = { 's', 'n', 'j', 'e', 'm' }; +static const symbol s_2_1291[6] = { 0xC5, 0xA1, 'n', 'j', 'e', 'm' }; +static const symbol s_2_1292[4] = { 'u', 'j', 'e', 'm' }; +static const symbol s_2_1293[7] = { 'l', 'u', 'c', 'u', 'j', 'e', 'm' }; +static const symbol s_2_1294[6] = { 'i', 'r', 'u', 'j', 'e', 'm' }; +static const symbol s_2_1295[8] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'e', 'm' }; +static const symbol s_2_1296[3] = { 'k', 'e', 'm' }; +static const symbol s_2_1297[4] = { 's', 'k', 'e', 'm' }; +static const symbol s_2_1298[5] = { 0xC5, 0xA1, 'k', 'e', 'm' }; +static const symbol s_2_1299[4] = { 'e', 'l', 'e', 'm' }; +static const symbol s_2_1300[3] = { 'n', 'e', 'm' }; +static const symbol s_2_1301[4] = { 'a', 'n', 'e', 'm' }; +static const symbol s_2_1302[7] = { 'a', 's', 't', 'a', 'n', 'e', 'm' }; +static const symbol s_2_1303[7] = { 'i', 's', 't', 'a', 'n', 'e', 'm' }; +static const symbol s_2_1304[7] = { 'o', 's', 't', 'a', 'n', 'e', 'm' }; +static const symbol s_2_1305[4] = { 'e', 'n', 'e', 'm' }; +static const symbol s_2_1306[4] = { 's', 'n', 'e', 'm' }; +static const symbol s_2_1307[5] = { 0xC5, 0xA1, 'n', 'e', 'm' }; +static const symbol s_2_1308[5] = { 'b', 'a', 's', 'e', 'm' }; +static const symbol s_2_1309[5] = { 'g', 'a', 's', 'e', 'm' }; +static const symbol s_2_1310[5] = { 'j', 'a', 's', 'e', 'm' }; +static const symbol s_2_1311[5] = { 'k', 'a', 's', 'e', 'm' }; +static const symbol s_2_1312[5] = { 'n', 'a', 's', 'e', 'm' }; +static const symbol s_2_1313[5] = { 't', 'a', 's', 'e', 'm' }; +static const symbol s_2_1314[5] = { 'v', 'a', 's', 'e', 'm' }; +static const symbol s_2_1315[4] = { 'e', 's', 'e', 'm' }; +static const symbol s_2_1316[4] = { 'i', 's', 'e', 'm' }; +static const symbol s_2_1317[4] = { 'o', 's', 'e', 'm' }; +static const symbol s_2_1318[4] = { 'a', 't', 'e', 'm' }; +static const symbol s_2_1319[4] = { 'e', 't', 'e', 'm' }; +static const symbol s_2_1320[6] = { 'e', 'v', 'i', 't', 'e', 'm' }; +static const symbol s_2_1321[6] = { 'o', 'v', 'i', 't', 'e', 'm' }; +static const symbol s_2_1322[5] = { 'a', 's', 't', 'e', 'm' }; +static const symbol s_2_1323[5] = { 'i', 's', 't', 'e', 'm' }; +static const symbol s_2_1324[6] = { 'i', 0xC5, 0xA1, 't', 'e', 'm' }; +static const symbol s_2_1325[4] = { 'a', 'v', 'e', 'm' }; +static const symbol s_2_1326[4] = { 'e', 'v', 'e', 'm' }; +static const symbol s_2_1327[4] = { 'i', 'v', 'e', 'm' }; +static const symbol s_2_1328[5] = { 'a', 0xC4, 0x87, 'e', 'm' }; +static const symbol s_2_1329[5] = { 'e', 0xC4, 0x87, 'e', 'm' }; +static const symbol s_2_1330[5] = { 'u', 0xC4, 0x87, 'e', 'm' }; +static const symbol s_2_1331[6] = { 'b', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1332[6] = { 'g', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1333[6] = { 'j', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1334[6] = { 'k', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1335[6] = { 'n', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1336[6] = { 't', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1337[6] = { 'v', 'a', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1338[5] = { 'e', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1339[5] = { 'i', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1340[5] = { 'o', 0xC5, 0xA1, 'e', 'm' }; +static const symbol s_2_1341[2] = { 'i', 'm' }; +static const symbol s_2_1342[4] = { 'a', 'c', 'i', 'm' }; +static const symbol s_2_1343[4] = { 'e', 'c', 'i', 'm' }; +static const symbol s_2_1344[4] = { 'u', 'c', 'i', 'm' }; +static const symbol s_2_1345[5] = { 'l', 'u', 'c', 'i', 'm' }; +static const symbol s_2_1346[7] = { 'a', 'n', 'j', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1347[7] = { 'e', 'n', 'j', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1348[7] = { 's', 'n', 'j', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1349[8] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1350[5] = { 'k', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1351[6] = { 's', 'k', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1352[7] = { 0xC5, 0xA1, 'k', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1353[6] = { 'e', 'l', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1354[5] = { 'n', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1355[6] = { 'o', 's', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1356[6] = { 'a', 't', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1357[8] = { 'e', 'v', 'i', 't', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1358[8] = { 'o', 'v', 'i', 't', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1359[7] = { 'a', 's', 't', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1360[6] = { 'a', 'v', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1361[6] = { 'e', 'v', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1362[6] = { 'i', 'v', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1363[6] = { 'o', 'v', 'i', 'j', 'i', 'm' }; +static const symbol s_2_1364[7] = { 'o', 0xC5, 0xA1, 'i', 'j', 'i', 'm' }; +static const symbol s_2_1365[5] = { 'a', 'n', 'j', 'i', 'm' }; +static const symbol s_2_1366[5] = { 'e', 'n', 'j', 'i', 'm' }; +static const symbol s_2_1367[5] = { 's', 'n', 'j', 'i', 'm' }; +static const symbol s_2_1368[6] = { 0xC5, 0xA1, 'n', 'j', 'i', 'm' }; +static const symbol s_2_1369[3] = { 'k', 'i', 'm' }; +static const symbol s_2_1370[4] = { 's', 'k', 'i', 'm' }; +static const symbol s_2_1371[5] = { 0xC5, 0xA1, 'k', 'i', 'm' }; +static const symbol s_2_1372[4] = { 'e', 'l', 'i', 'm' }; +static const symbol s_2_1373[3] = { 'n', 'i', 'm' }; +static const symbol s_2_1374[5] = { 'c', 'i', 'n', 'i', 'm' }; +static const symbol s_2_1375[6] = { 0xC4, 0x8D, 'i', 'n', 'i', 'm' }; +static const symbol s_2_1376[4] = { 'o', 's', 'i', 'm' }; +static const symbol s_2_1377[5] = { 'r', 'o', 's', 'i', 'm' }; +static const symbol s_2_1378[4] = { 'a', 't', 'i', 'm' }; +static const symbol s_2_1379[5] = { 'j', 'e', 't', 'i', 'm' }; +static const symbol s_2_1380[6] = { 'e', 'v', 'i', 't', 'i', 'm' }; +static const symbol s_2_1381[6] = { 'o', 'v', 'i', 't', 'i', 'm' }; +static const symbol s_2_1382[5] = { 'a', 's', 't', 'i', 'm' }; +static const symbol s_2_1383[4] = { 'a', 'v', 'i', 'm' }; +static const symbol s_2_1384[4] = { 'e', 'v', 'i', 'm' }; +static const symbol s_2_1385[4] = { 'i', 'v', 'i', 'm' }; +static const symbol s_2_1386[4] = { 'o', 'v', 'i', 'm' }; +static const symbol s_2_1387[5] = { 'a', 0xC4, 0x87, 'i', 'm' }; +static const symbol s_2_1388[5] = { 'e', 0xC4, 0x87, 'i', 'm' }; +static const symbol s_2_1389[5] = { 'u', 0xC4, 0x87, 'i', 'm' }; +static const symbol s_2_1390[5] = { 'a', 0xC4, 0x8D, 'i', 'm' }; +static const symbol s_2_1391[6] = { 'l', 'u', 0xC4, 0x8D, 'i', 'm' }; +static const symbol s_2_1392[5] = { 'o', 0xC5, 0xA1, 'i', 'm' }; +static const symbol s_2_1393[6] = { 'r', 'o', 0xC5, 0xA1, 'i', 'm' }; +static const symbol s_2_1394[4] = { 'a', 'c', 'o', 'm' }; +static const symbol s_2_1395[4] = { 'e', 'c', 'o', 'm' }; +static const symbol s_2_1396[4] = { 'u', 'c', 'o', 'm' }; +static const symbol s_2_1397[3] = { 'g', 'o', 'm' }; +static const symbol s_2_1398[5] = { 'l', 'o', 'g', 'o', 'm' }; +static const symbol s_2_1399[4] = { 'u', 'g', 'o', 'm' }; +static const symbol s_2_1400[5] = { 'b', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1401[5] = { 'c', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1402[5] = { 'd', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1403[5] = { 'f', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1404[5] = { 'g', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1405[5] = { 'l', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1406[5] = { 'm', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1407[5] = { 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1408[7] = { 'g', 'a', 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1409[7] = { 'm', 'a', 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1410[7] = { 'p', 'a', 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1411[7] = { 'r', 'a', 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1412[7] = { 't', 'a', 'n', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1413[5] = { 'p', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1414[5] = { 'r', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1415[5] = { 's', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1416[5] = { 't', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1417[5] = { 'z', 'i', 'j', 'o', 'm' }; +static const symbol s_2_1418[6] = { 0xC5, 0xBE, 'i', 'j', 'o', 'm' }; +static const symbol s_2_1419[5] = { 'a', 'n', 'j', 'o', 'm' }; +static const symbol s_2_1420[5] = { 'e', 'n', 'j', 'o', 'm' }; +static const symbol s_2_1421[5] = { 's', 'n', 'j', 'o', 'm' }; +static const symbol s_2_1422[6] = { 0xC5, 0xA1, 'n', 'j', 'o', 'm' }; +static const symbol s_2_1423[3] = { 'k', 'o', 'm' }; +static const symbol s_2_1424[4] = { 's', 'k', 'o', 'm' }; +static const symbol s_2_1425[5] = { 0xC5, 0xA1, 'k', 'o', 'm' }; +static const symbol s_2_1426[4] = { 'a', 'l', 'o', 'm' }; +static const symbol s_2_1427[6] = { 'i', 'j', 'a', 'l', 'o', 'm' }; +static const symbol s_2_1428[5] = { 'n', 'a', 'l', 'o', 'm' }; +static const symbol s_2_1429[4] = { 'e', 'l', 'o', 'm' }; +static const symbol s_2_1430[4] = { 'i', 'l', 'o', 'm' }; +static const symbol s_2_1431[6] = { 'o', 'z', 'i', 'l', 'o', 'm' }; +static const symbol s_2_1432[4] = { 'o', 'l', 'o', 'm' }; +static const symbol s_2_1433[5] = { 'r', 'a', 'm', 'o', 'm' }; +static const symbol s_2_1434[5] = { 'l', 'e', 'm', 'o', 'm' }; +static const symbol s_2_1435[3] = { 'n', 'o', 'm' }; +static const symbol s_2_1436[4] = { 'a', 'n', 'o', 'm' }; +static const symbol s_2_1437[4] = { 'i', 'n', 'o', 'm' }; +static const symbol s_2_1438[5] = { 'c', 'i', 'n', 'o', 'm' }; +static const symbol s_2_1439[6] = { 'a', 'n', 'i', 'n', 'o', 'm' }; +static const symbol s_2_1440[6] = { 0xC4, 0x8D, 'i', 'n', 'o', 'm' }; +static const symbol s_2_1441[4] = { 'o', 'n', 'o', 'm' }; +static const symbol s_2_1442[4] = { 'a', 'r', 'o', 'm' }; +static const symbol s_2_1443[4] = { 'd', 'r', 'o', 'm' }; +static const symbol s_2_1444[4] = { 'e', 'r', 'o', 'm' }; +static const symbol s_2_1445[4] = { 'o', 'r', 'o', 'm' }; +static const symbol s_2_1446[5] = { 'b', 'a', 's', 'o', 'm' }; +static const symbol s_2_1447[5] = { 'g', 'a', 's', 'o', 'm' }; +static const symbol s_2_1448[5] = { 'j', 'a', 's', 'o', 'm' }; +static const symbol s_2_1449[5] = { 'k', 'a', 's', 'o', 'm' }; +static const symbol s_2_1450[5] = { 'n', 'a', 's', 'o', 'm' }; +static const symbol s_2_1451[5] = { 't', 'a', 's', 'o', 'm' }; +static const symbol s_2_1452[5] = { 'v', 'a', 's', 'o', 'm' }; +static const symbol s_2_1453[4] = { 'e', 's', 'o', 'm' }; +static const symbol s_2_1454[4] = { 'i', 's', 'o', 'm' }; +static const symbol s_2_1455[4] = { 'o', 's', 'o', 'm' }; +static const symbol s_2_1456[4] = { 'a', 't', 'o', 'm' }; +static const symbol s_2_1457[6] = { 'i', 'k', 'a', 't', 'o', 'm' }; +static const symbol s_2_1458[5] = { 'l', 'a', 't', 'o', 'm' }; +static const symbol s_2_1459[4] = { 'e', 't', 'o', 'm' }; +static const symbol s_2_1460[6] = { 'e', 'v', 'i', 't', 'o', 'm' }; +static const symbol s_2_1461[6] = { 'o', 'v', 'i', 't', 'o', 'm' }; +static const symbol s_2_1462[5] = { 'a', 's', 't', 'o', 'm' }; +static const symbol s_2_1463[5] = { 'e', 's', 't', 'o', 'm' }; +static const symbol s_2_1464[5] = { 'i', 's', 't', 'o', 'm' }; +static const symbol s_2_1465[5] = { 'k', 's', 't', 'o', 'm' }; +static const symbol s_2_1466[5] = { 'o', 's', 't', 'o', 'm' }; +static const symbol s_2_1467[4] = { 'a', 'v', 'o', 'm' }; +static const symbol s_2_1468[4] = { 'e', 'v', 'o', 'm' }; +static const symbol s_2_1469[4] = { 'i', 'v', 'o', 'm' }; +static const symbol s_2_1470[4] = { 'o', 'v', 'o', 'm' }; +static const symbol s_2_1471[5] = { 'l', 'o', 'v', 'o', 'm' }; +static const symbol s_2_1472[5] = { 'm', 'o', 'v', 'o', 'm' }; +static const symbol s_2_1473[5] = { 's', 't', 'v', 'o', 'm' }; +static const symbol s_2_1474[6] = { 0xC5, 0xA1, 't', 'v', 'o', 'm' }; +static const symbol s_2_1475[5] = { 'a', 0xC4, 0x87, 'o', 'm' }; +static const symbol s_2_1476[5] = { 'e', 0xC4, 0x87, 'o', 'm' }; +static const symbol s_2_1477[5] = { 'u', 0xC4, 0x87, 'o', 'm' }; +static const symbol s_2_1478[6] = { 'b', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1479[6] = { 'g', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1480[6] = { 'j', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1481[6] = { 'k', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1482[6] = { 'n', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1483[6] = { 't', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1484[6] = { 'v', 'a', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1485[5] = { 'e', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1486[5] = { 'i', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1487[5] = { 'o', 0xC5, 0xA1, 'o', 'm' }; +static const symbol s_2_1488[2] = { 'a', 'n' }; +static const symbol s_2_1489[4] = { 'a', 'c', 'a', 'n' }; +static const symbol s_2_1490[4] = { 'i', 'r', 'a', 'n' }; +static const symbol s_2_1491[4] = { 'u', 'r', 'a', 'n' }; +static const symbol s_2_1492[3] = { 't', 'a', 'n' }; +static const symbol s_2_1493[4] = { 'a', 'v', 'a', 'n' }; +static const symbol s_2_1494[4] = { 'e', 'v', 'a', 'n' }; +static const symbol s_2_1495[4] = { 'i', 'v', 'a', 'n' }; +static const symbol s_2_1496[4] = { 'u', 'v', 'a', 'n' }; +static const symbol s_2_1497[5] = { 'a', 0xC4, 0x8D, 'a', 'n' }; +static const symbol s_2_1498[4] = { 'a', 'c', 'e', 'n' }; +static const symbol s_2_1499[5] = { 'l', 'u', 'c', 'e', 'n' }; +static const symbol s_2_1500[5] = { 'a', 0xC4, 0x8D, 'e', 'n' }; +static const symbol s_2_1501[6] = { 'l', 'u', 0xC4, 0x8D, 'e', 'n' }; +static const symbol s_2_1502[4] = { 'a', 'n', 'i', 'n' }; +static const symbol s_2_1503[2] = { 'a', 'o' }; +static const symbol s_2_1504[4] = { 'a', 'c', 'a', 'o' }; +static const symbol s_2_1505[7] = { 'a', 's', 't', 'a', 'j', 'a', 'o' }; +static const symbol s_2_1506[7] = { 'i', 's', 't', 'a', 'j', 'a', 'o' }; +static const symbol s_2_1507[7] = { 'o', 's', 't', 'a', 'j', 'a', 'o' }; +static const symbol s_2_1508[5] = { 'i', 'n', 'j', 'a', 'o' }; +static const symbol s_2_1509[4] = { 'i', 'r', 'a', 'o' }; +static const symbol s_2_1510[4] = { 'u', 'r', 'a', 'o' }; +static const symbol s_2_1511[3] = { 't', 'a', 'o' }; +static const symbol s_2_1512[5] = { 'a', 's', 't', 'a', 'o' }; +static const symbol s_2_1513[5] = { 'i', 's', 't', 'a', 'o' }; +static const symbol s_2_1514[5] = { 'o', 's', 't', 'a', 'o' }; +static const symbol s_2_1515[4] = { 'a', 'v', 'a', 'o' }; +static const symbol s_2_1516[4] = { 'e', 'v', 'a', 'o' }; +static const symbol s_2_1517[4] = { 'i', 'v', 'a', 'o' }; +static const symbol s_2_1518[4] = { 'o', 'v', 'a', 'o' }; +static const symbol s_2_1519[4] = { 'u', 'v', 'a', 'o' }; +static const symbol s_2_1520[5] = { 'a', 0xC4, 0x8D, 'a', 'o' }; +static const symbol s_2_1521[2] = { 'g', 'o' }; +static const symbol s_2_1522[3] = { 'u', 'g', 'o' }; +static const symbol s_2_1523[2] = { 'i', 'o' }; +static const symbol s_2_1524[4] = { 'a', 'c', 'i', 'o' }; +static const symbol s_2_1525[5] = { 'l', 'u', 'c', 'i', 'o' }; +static const symbol s_2_1526[3] = { 'l', 'i', 'o' }; +static const symbol s_2_1527[3] = { 'n', 'i', 'o' }; +static const symbol s_2_1528[5] = { 'r', 'a', 'r', 'i', 'o' }; +static const symbol s_2_1529[3] = { 's', 'i', 'o' }; +static const symbol s_2_1530[5] = { 'r', 'o', 's', 'i', 'o' }; +static const symbol s_2_1531[5] = { 'j', 'e', 't', 'i', 'o' }; +static const symbol s_2_1532[4] = { 'o', 't', 'i', 'o' }; +static const symbol s_2_1533[5] = { 'a', 0xC4, 0x8D, 'i', 'o' }; +static const symbol s_2_1534[6] = { 'l', 'u', 0xC4, 0x8D, 'i', 'o' }; +static const symbol s_2_1535[6] = { 'r', 'o', 0xC5, 0xA1, 'i', 'o' }; +static const symbol s_2_1536[4] = { 'b', 'i', 'j', 'o' }; +static const symbol s_2_1537[4] = { 'c', 'i', 'j', 'o' }; +static const symbol s_2_1538[4] = { 'd', 'i', 'j', 'o' }; +static const symbol s_2_1539[4] = { 'f', 'i', 'j', 'o' }; +static const symbol s_2_1540[4] = { 'g', 'i', 'j', 'o' }; +static const symbol s_2_1541[4] = { 'l', 'i', 'j', 'o' }; +static const symbol s_2_1542[4] = { 'm', 'i', 'j', 'o' }; +static const symbol s_2_1543[4] = { 'n', 'i', 'j', 'o' }; +static const symbol s_2_1544[4] = { 'p', 'i', 'j', 'o' }; +static const symbol s_2_1545[4] = { 'r', 'i', 'j', 'o' }; +static const symbol s_2_1546[4] = { 's', 'i', 'j', 'o' }; +static const symbol s_2_1547[4] = { 't', 'i', 'j', 'o' }; +static const symbol s_2_1548[4] = { 'z', 'i', 'j', 'o' }; +static const symbol s_2_1549[5] = { 0xC5, 0xBE, 'i', 'j', 'o' }; +static const symbol s_2_1550[4] = { 'a', 'n', 'j', 'o' }; +static const symbol s_2_1551[4] = { 'e', 'n', 'j', 'o' }; +static const symbol s_2_1552[4] = { 's', 'n', 'j', 'o' }; +static const symbol s_2_1553[5] = { 0xC5, 0xA1, 'n', 'j', 'o' }; +static const symbol s_2_1554[2] = { 'k', 'o' }; +static const symbol s_2_1555[3] = { 's', 'k', 'o' }; +static const symbol s_2_1556[4] = { 0xC5, 0xA1, 'k', 'o' }; +static const symbol s_2_1557[3] = { 'a', 'l', 'o' }; +static const symbol s_2_1558[5] = { 'a', 'c', 'a', 'l', 'o' }; +static const symbol s_2_1559[8] = { 'a', 's', 't', 'a', 'j', 'a', 'l', 'o' }; +static const symbol s_2_1560[8] = { 'i', 's', 't', 'a', 'j', 'a', 'l', 'o' }; +static const symbol s_2_1561[8] = { 'o', 's', 't', 'a', 'j', 'a', 'l', 'o' }; +static const symbol s_2_1562[5] = { 'i', 'j', 'a', 'l', 'o' }; +static const symbol s_2_1563[6] = { 'i', 'n', 'j', 'a', 'l', 'o' }; +static const symbol s_2_1564[4] = { 'n', 'a', 'l', 'o' }; +static const symbol s_2_1565[5] = { 'i', 'r', 'a', 'l', 'o' }; +static const symbol s_2_1566[5] = { 'u', 'r', 'a', 'l', 'o' }; +static const symbol s_2_1567[4] = { 't', 'a', 'l', 'o' }; +static const symbol s_2_1568[6] = { 'a', 's', 't', 'a', 'l', 'o' }; +static const symbol s_2_1569[6] = { 'i', 's', 't', 'a', 'l', 'o' }; +static const symbol s_2_1570[6] = { 'o', 's', 't', 'a', 'l', 'o' }; +static const symbol s_2_1571[5] = { 'a', 'v', 'a', 'l', 'o' }; +static const symbol s_2_1572[5] = { 'e', 'v', 'a', 'l', 'o' }; +static const symbol s_2_1573[5] = { 'i', 'v', 'a', 'l', 'o' }; +static const symbol s_2_1574[5] = { 'o', 'v', 'a', 'l', 'o' }; +static const symbol s_2_1575[5] = { 'u', 'v', 'a', 'l', 'o' }; +static const symbol s_2_1576[6] = { 'a', 0xC4, 0x8D, 'a', 'l', 'o' }; +static const symbol s_2_1577[3] = { 'e', 'l', 'o' }; +static const symbol s_2_1578[3] = { 'i', 'l', 'o' }; +static const symbol s_2_1579[5] = { 'a', 'c', 'i', 'l', 'o' }; +static const symbol s_2_1580[6] = { 'l', 'u', 'c', 'i', 'l', 'o' }; +static const symbol s_2_1581[4] = { 'n', 'i', 'l', 'o' }; +static const symbol s_2_1582[6] = { 'r', 'o', 's', 'i', 'l', 'o' }; +static const symbol s_2_1583[6] = { 'j', 'e', 't', 'i', 'l', 'o' }; +static const symbol s_2_1584[6] = { 'a', 0xC4, 0x8D, 'i', 'l', 'o' }; +static const symbol s_2_1585[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 'l', 'o' }; +static const symbol s_2_1586[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 'l', 'o' }; +static const symbol s_2_1587[4] = { 'a', 's', 'l', 'o' }; +static const symbol s_2_1588[4] = { 'n', 'u', 'l', 'o' }; +static const symbol s_2_1589[3] = { 'a', 'm', 'o' }; +static const symbol s_2_1590[5] = { 'a', 'c', 'a', 'm', 'o' }; +static const symbol s_2_1591[4] = { 'r', 'a', 'm', 'o' }; +static const symbol s_2_1592[5] = { 'i', 'r', 'a', 'm', 'o' }; +static const symbol s_2_1593[5] = { 'u', 'r', 'a', 'm', 'o' }; +static const symbol s_2_1594[4] = { 't', 'a', 'm', 'o' }; +static const symbol s_2_1595[5] = { 'a', 'v', 'a', 'm', 'o' }; +static const symbol s_2_1596[5] = { 'e', 'v', 'a', 'm', 'o' }; +static const symbol s_2_1597[5] = { 'i', 'v', 'a', 'm', 'o' }; +static const symbol s_2_1598[5] = { 'u', 'v', 'a', 'm', 'o' }; +static const symbol s_2_1599[6] = { 'a', 0xC4, 0x8D, 'a', 'm', 'o' }; +static const symbol s_2_1600[3] = { 'e', 'm', 'o' }; +static const symbol s_2_1601[8] = { 'a', 's', 't', 'a', 'd', 'e', 'm', 'o' }; +static const symbol s_2_1602[8] = { 'i', 's', 't', 'a', 'd', 'e', 'm', 'o' }; +static const symbol s_2_1603[8] = { 'o', 's', 't', 'a', 'd', 'e', 'm', 'o' }; +static const symbol s_2_1604[8] = { 'a', 's', 't', 'a', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1605[8] = { 'i', 's', 't', 'a', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1606[8] = { 'o', 's', 't', 'a', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1607[5] = { 'i', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1608[6] = { 'i', 'n', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1609[5] = { 'u', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1610[8] = { 'l', 'u', 'c', 'u', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1611[7] = { 'i', 'r', 'u', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1612[9] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'e', 'm', 'o' }; +static const symbol s_2_1613[4] = { 'l', 'e', 'm', 'o' }; +static const symbol s_2_1614[4] = { 'n', 'e', 'm', 'o' }; +static const symbol s_2_1615[8] = { 'a', 's', 't', 'a', 'n', 'e', 'm', 'o' }; +static const symbol s_2_1616[8] = { 'i', 's', 't', 'a', 'n', 'e', 'm', 'o' }; +static const symbol s_2_1617[8] = { 'o', 's', 't', 'a', 'n', 'e', 'm', 'o' }; +static const symbol s_2_1618[5] = { 'e', 't', 'e', 'm', 'o' }; +static const symbol s_2_1619[6] = { 'a', 's', 't', 'e', 'm', 'o' }; +static const symbol s_2_1620[3] = { 'i', 'm', 'o' }; +static const symbol s_2_1621[5] = { 'a', 'c', 'i', 'm', 'o' }; +static const symbol s_2_1622[6] = { 'l', 'u', 'c', 'i', 'm', 'o' }; +static const symbol s_2_1623[4] = { 'n', 'i', 'm', 'o' }; +static const symbol s_2_1624[8] = { 'a', 's', 't', 'a', 'n', 'i', 'm', 'o' }; +static const symbol s_2_1625[8] = { 'i', 's', 't', 'a', 'n', 'i', 'm', 'o' }; +static const symbol s_2_1626[8] = { 'o', 's', 't', 'a', 'n', 'i', 'm', 'o' }; +static const symbol s_2_1627[6] = { 'r', 'o', 's', 'i', 'm', 'o' }; +static const symbol s_2_1628[5] = { 'e', 't', 'i', 'm', 'o' }; +static const symbol s_2_1629[6] = { 'j', 'e', 't', 'i', 'm', 'o' }; +static const symbol s_2_1630[6] = { 'a', 's', 't', 'i', 'm', 'o' }; +static const symbol s_2_1631[6] = { 'a', 0xC4, 0x8D, 'i', 'm', 'o' }; +static const symbol s_2_1632[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 'm', 'o' }; +static const symbol s_2_1633[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 'm', 'o' }; +static const symbol s_2_1634[4] = { 'a', 'j', 'm', 'o' }; +static const symbol s_2_1635[6] = { 'u', 'r', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1636[5] = { 't', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1637[7] = { 'a', 's', 't', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1638[7] = { 'i', 's', 't', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1639[7] = { 'o', 's', 't', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1640[6] = { 'a', 'v', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1641[6] = { 'e', 'v', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1642[6] = { 'i', 'v', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1643[6] = { 'u', 'v', 'a', 'j', 'm', 'o' }; +static const symbol s_2_1644[4] = { 'i', 'j', 'm', 'o' }; +static const symbol s_2_1645[4] = { 'u', 'j', 'm', 'o' }; +static const symbol s_2_1646[7] = { 'l', 'u', 'c', 'u', 'j', 'm', 'o' }; +static const symbol s_2_1647[6] = { 'i', 'r', 'u', 'j', 'm', 'o' }; +static const symbol s_2_1648[8] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'm', 'o' }; +static const symbol s_2_1649[4] = { 'a', 's', 'm', 'o' }; +static const symbol s_2_1650[6] = { 'a', 'c', 'a', 's', 'm', 'o' }; +static const symbol s_2_1651[9] = { 'a', 's', 't', 'a', 'j', 'a', 's', 'm', 'o' }; +static const symbol s_2_1652[9] = { 'i', 's', 't', 'a', 'j', 'a', 's', 'm', 'o' }; +static const symbol s_2_1653[9] = { 'o', 's', 't', 'a', 'j', 'a', 's', 'm', 'o' }; +static const symbol s_2_1654[7] = { 'i', 'n', 'j', 'a', 's', 'm', 'o' }; +static const symbol s_2_1655[6] = { 'i', 'r', 'a', 's', 'm', 'o' }; +static const symbol s_2_1656[6] = { 'u', 'r', 'a', 's', 'm', 'o' }; +static const symbol s_2_1657[5] = { 't', 'a', 's', 'm', 'o' }; +static const symbol s_2_1658[6] = { 'a', 'v', 'a', 's', 'm', 'o' }; +static const symbol s_2_1659[6] = { 'e', 'v', 'a', 's', 'm', 'o' }; +static const symbol s_2_1660[6] = { 'i', 'v', 'a', 's', 'm', 'o' }; +static const symbol s_2_1661[6] = { 'o', 'v', 'a', 's', 'm', 'o' }; +static const symbol s_2_1662[6] = { 'u', 'v', 'a', 's', 'm', 'o' }; +static const symbol s_2_1663[7] = { 'a', 0xC4, 0x8D, 'a', 's', 'm', 'o' }; +static const symbol s_2_1664[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_2_1665[6] = { 'a', 'c', 'i', 's', 'm', 'o' }; +static const symbol s_2_1666[7] = { 'l', 'u', 'c', 'i', 's', 'm', 'o' }; +static const symbol s_2_1667[5] = { 'n', 'i', 's', 'm', 'o' }; +static const symbol s_2_1668[7] = { 'r', 'o', 's', 'i', 's', 'm', 'o' }; +static const symbol s_2_1669[7] = { 'j', 'e', 't', 'i', 's', 'm', 'o' }; +static const symbol s_2_1670[7] = { 'a', 0xC4, 0x8D, 'i', 's', 'm', 'o' }; +static const symbol s_2_1671[8] = { 'l', 'u', 0xC4, 0x8D, 'i', 's', 'm', 'o' }; +static const symbol s_2_1672[8] = { 'r', 'o', 0xC5, 0xA1, 'i', 's', 'm', 'o' }; +static const symbol s_2_1673[9] = { 'a', 's', 't', 'a', 'd', 'o', 's', 'm', 'o' }; +static const symbol s_2_1674[9] = { 'i', 's', 't', 'a', 'd', 'o', 's', 'm', 'o' }; +static const symbol s_2_1675[9] = { 'o', 's', 't', 'a', 'd', 'o', 's', 'm', 'o' }; +static const symbol s_2_1676[5] = { 'n', 'u', 's', 'm', 'o' }; +static const symbol s_2_1677[2] = { 'n', 'o' }; +static const symbol s_2_1678[3] = { 'a', 'n', 'o' }; +static const symbol s_2_1679[5] = { 'a', 'c', 'a', 'n', 'o' }; +static const symbol s_2_1680[5] = { 'u', 'r', 'a', 'n', 'o' }; +static const symbol s_2_1681[4] = { 't', 'a', 'n', 'o' }; +static const symbol s_2_1682[5] = { 'a', 'v', 'a', 'n', 'o' }; +static const symbol s_2_1683[5] = { 'e', 'v', 'a', 'n', 'o' }; +static const symbol s_2_1684[5] = { 'i', 'v', 'a', 'n', 'o' }; +static const symbol s_2_1685[5] = { 'u', 'v', 'a', 'n', 'o' }; +static const symbol s_2_1686[6] = { 'a', 0xC4, 0x8D, 'a', 'n', 'o' }; +static const symbol s_2_1687[5] = { 'a', 'c', 'e', 'n', 'o' }; +static const symbol s_2_1688[6] = { 'l', 'u', 'c', 'e', 'n', 'o' }; +static const symbol s_2_1689[6] = { 'a', 0xC4, 0x8D, 'e', 'n', 'o' }; +static const symbol s_2_1690[7] = { 'l', 'u', 0xC4, 0x8D, 'e', 'n', 'o' }; +static const symbol s_2_1691[3] = { 'i', 'n', 'o' }; +static const symbol s_2_1692[4] = { 'c', 'i', 'n', 'o' }; +static const symbol s_2_1693[5] = { 0xC4, 0x8D, 'i', 'n', 'o' }; +static const symbol s_2_1694[3] = { 'a', 't', 'o' }; +static const symbol s_2_1695[5] = { 'i', 'k', 'a', 't', 'o' }; +static const symbol s_2_1696[4] = { 'l', 'a', 't', 'o' }; +static const symbol s_2_1697[3] = { 'e', 't', 'o' }; +static const symbol s_2_1698[5] = { 'e', 'v', 'i', 't', 'o' }; +static const symbol s_2_1699[5] = { 'o', 'v', 'i', 't', 'o' }; +static const symbol s_2_1700[4] = { 'a', 's', 't', 'o' }; +static const symbol s_2_1701[4] = { 'e', 's', 't', 'o' }; +static const symbol s_2_1702[4] = { 'i', 's', 't', 'o' }; +static const symbol s_2_1703[4] = { 'k', 's', 't', 'o' }; +static const symbol s_2_1704[4] = { 'o', 's', 't', 'o' }; +static const symbol s_2_1705[4] = { 'n', 'u', 't', 'o' }; +static const symbol s_2_1706[3] = { 'n', 'u', 'o' }; +static const symbol s_2_1707[3] = { 'a', 'v', 'o' }; +static const symbol s_2_1708[3] = { 'e', 'v', 'o' }; +static const symbol s_2_1709[3] = { 'i', 'v', 'o' }; +static const symbol s_2_1710[3] = { 'o', 'v', 'o' }; +static const symbol s_2_1711[4] = { 's', 't', 'v', 'o' }; +static const symbol s_2_1712[5] = { 0xC5, 0xA1, 't', 'v', 'o' }; +static const symbol s_2_1713[2] = { 'a', 's' }; +static const symbol s_2_1714[4] = { 'a', 'c', 'a', 's' }; +static const symbol s_2_1715[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_2_1716[4] = { 'u', 'r', 'a', 's' }; +static const symbol s_2_1717[3] = { 't', 'a', 's' }; +static const symbol s_2_1718[4] = { 'a', 'v', 'a', 's' }; +static const symbol s_2_1719[4] = { 'e', 'v', 'a', 's' }; +static const symbol s_2_1720[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_2_1721[4] = { 'u', 'v', 'a', 's' }; +static const symbol s_2_1722[2] = { 'e', 's' }; +static const symbol s_2_1723[7] = { 'a', 's', 't', 'a', 'd', 'e', 's' }; +static const symbol s_2_1724[7] = { 'i', 's', 't', 'a', 'd', 'e', 's' }; +static const symbol s_2_1725[7] = { 'o', 's', 't', 'a', 'd', 'e', 's' }; +static const symbol s_2_1726[7] = { 'a', 's', 't', 'a', 'j', 'e', 's' }; +static const symbol s_2_1727[7] = { 'i', 's', 't', 'a', 'j', 'e', 's' }; +static const symbol s_2_1728[7] = { 'o', 's', 't', 'a', 'j', 'e', 's' }; +static const symbol s_2_1729[4] = { 'i', 'j', 'e', 's' }; +static const symbol s_2_1730[5] = { 'i', 'n', 'j', 'e', 's' }; +static const symbol s_2_1731[4] = { 'u', 'j', 'e', 's' }; +static const symbol s_2_1732[7] = { 'l', 'u', 'c', 'u', 'j', 'e', 's' }; +static const symbol s_2_1733[6] = { 'i', 'r', 'u', 'j', 'e', 's' }; +static const symbol s_2_1734[3] = { 'n', 'e', 's' }; +static const symbol s_2_1735[7] = { 'a', 's', 't', 'a', 'n', 'e', 's' }; +static const symbol s_2_1736[7] = { 'i', 's', 't', 'a', 'n', 'e', 's' }; +static const symbol s_2_1737[7] = { 'o', 's', 't', 'a', 'n', 'e', 's' }; +static const symbol s_2_1738[4] = { 'e', 't', 'e', 's' }; +static const symbol s_2_1739[5] = { 'a', 's', 't', 'e', 's' }; +static const symbol s_2_1740[2] = { 'i', 's' }; +static const symbol s_2_1741[4] = { 'a', 'c', 'i', 's' }; +static const symbol s_2_1742[5] = { 'l', 'u', 'c', 'i', 's' }; +static const symbol s_2_1743[3] = { 'n', 'i', 's' }; +static const symbol s_2_1744[5] = { 'r', 'o', 's', 'i', 's' }; +static const symbol s_2_1745[5] = { 'j', 'e', 't', 'i', 's' }; +static const symbol s_2_1746[2] = { 'a', 't' }; +static const symbol s_2_1747[4] = { 'a', 'c', 'a', 't' }; +static const symbol s_2_1748[7] = { 'a', 's', 't', 'a', 'j', 'a', 't' }; +static const symbol s_2_1749[7] = { 'i', 's', 't', 'a', 'j', 'a', 't' }; +static const symbol s_2_1750[7] = { 'o', 's', 't', 'a', 'j', 'a', 't' }; +static const symbol s_2_1751[5] = { 'i', 'n', 'j', 'a', 't' }; +static const symbol s_2_1752[4] = { 'i', 'r', 'a', 't' }; +static const symbol s_2_1753[4] = { 'u', 'r', 'a', 't' }; +static const symbol s_2_1754[3] = { 't', 'a', 't' }; +static const symbol s_2_1755[5] = { 'a', 's', 't', 'a', 't' }; +static const symbol s_2_1756[5] = { 'i', 's', 't', 'a', 't' }; +static const symbol s_2_1757[5] = { 'o', 's', 't', 'a', 't' }; +static const symbol s_2_1758[4] = { 'a', 'v', 'a', 't' }; +static const symbol s_2_1759[4] = { 'e', 'v', 'a', 't' }; +static const symbol s_2_1760[4] = { 'i', 'v', 'a', 't' }; +static const symbol s_2_1761[6] = { 'i', 'r', 'i', 'v', 'a', 't' }; +static const symbol s_2_1762[4] = { 'o', 'v', 'a', 't' }; +static const symbol s_2_1763[4] = { 'u', 'v', 'a', 't' }; +static const symbol s_2_1764[5] = { 'a', 0xC4, 0x8D, 'a', 't' }; +static const symbol s_2_1765[2] = { 'i', 't' }; +static const symbol s_2_1766[4] = { 'a', 'c', 'i', 't' }; +static const symbol s_2_1767[5] = { 'l', 'u', 'c', 'i', 't' }; +static const symbol s_2_1768[5] = { 'r', 'o', 's', 'i', 't' }; +static const symbol s_2_1769[5] = { 'j', 'e', 't', 'i', 't' }; +static const symbol s_2_1770[5] = { 'a', 0xC4, 0x8D, 'i', 't' }; +static const symbol s_2_1771[6] = { 'l', 'u', 0xC4, 0x8D, 'i', 't' }; +static const symbol s_2_1772[6] = { 'r', 'o', 0xC5, 0xA1, 'i', 't' }; +static const symbol s_2_1773[3] = { 'n', 'u', 't' }; +static const symbol s_2_1774[6] = { 'a', 's', 't', 'a', 'd', 'u' }; +static const symbol s_2_1775[6] = { 'i', 's', 't', 'a', 'd', 'u' }; +static const symbol s_2_1776[6] = { 'o', 's', 't', 'a', 'd', 'u' }; +static const symbol s_2_1777[2] = { 'g', 'u' }; +static const symbol s_2_1778[4] = { 'l', 'o', 'g', 'u' }; +static const symbol s_2_1779[3] = { 'u', 'g', 'u' }; +static const symbol s_2_1780[3] = { 'a', 'h', 'u' }; +static const symbol s_2_1781[5] = { 'a', 'c', 'a', 'h', 'u' }; +static const symbol s_2_1782[8] = { 'a', 's', 't', 'a', 'j', 'a', 'h', 'u' }; +static const symbol s_2_1783[8] = { 'i', 's', 't', 'a', 'j', 'a', 'h', 'u' }; +static const symbol s_2_1784[8] = { 'o', 's', 't', 'a', 'j', 'a', 'h', 'u' }; +static const symbol s_2_1785[6] = { 'i', 'n', 'j', 'a', 'h', 'u' }; +static const symbol s_2_1786[5] = { 'i', 'r', 'a', 'h', 'u' }; +static const symbol s_2_1787[5] = { 'u', 'r', 'a', 'h', 'u' }; +static const symbol s_2_1788[5] = { 'a', 'v', 'a', 'h', 'u' }; +static const symbol s_2_1789[5] = { 'e', 'v', 'a', 'h', 'u' }; +static const symbol s_2_1790[5] = { 'i', 'v', 'a', 'h', 'u' }; +static const symbol s_2_1791[5] = { 'o', 'v', 'a', 'h', 'u' }; +static const symbol s_2_1792[5] = { 'u', 'v', 'a', 'h', 'u' }; +static const symbol s_2_1793[6] = { 'a', 0xC4, 0x8D, 'a', 'h', 'u' }; +static const symbol s_2_1794[3] = { 'a', 'j', 'u' }; +static const symbol s_2_1795[4] = { 'c', 'a', 'j', 'u' }; +static const symbol s_2_1796[5] = { 'a', 'c', 'a', 'j', 'u' }; +static const symbol s_2_1797[4] = { 'l', 'a', 'j', 'u' }; +static const symbol s_2_1798[4] = { 'r', 'a', 'j', 'u' }; +static const symbol s_2_1799[5] = { 'i', 'r', 'a', 'j', 'u' }; +static const symbol s_2_1800[5] = { 'u', 'r', 'a', 'j', 'u' }; +static const symbol s_2_1801[4] = { 't', 'a', 'j', 'u' }; +static const symbol s_2_1802[6] = { 'a', 's', 't', 'a', 'j', 'u' }; +static const symbol s_2_1803[6] = { 'i', 's', 't', 'a', 'j', 'u' }; +static const symbol s_2_1804[6] = { 'o', 's', 't', 'a', 'j', 'u' }; +static const symbol s_2_1805[5] = { 'a', 'v', 'a', 'j', 'u' }; +static const symbol s_2_1806[5] = { 'e', 'v', 'a', 'j', 'u' }; +static const symbol s_2_1807[5] = { 'i', 'v', 'a', 'j', 'u' }; +static const symbol s_2_1808[5] = { 'u', 'v', 'a', 'j', 'u' }; +static const symbol s_2_1809[5] = { 0xC4, 0x87, 'a', 'j', 'u' }; +static const symbol s_2_1810[5] = { 0xC4, 0x8D, 'a', 'j', 'u' }; +static const symbol s_2_1811[6] = { 'a', 0xC4, 0x8D, 'a', 'j', 'u' }; +static const symbol s_2_1812[5] = { 0xC4, 0x91, 'a', 'j', 'u' }; +static const symbol s_2_1813[3] = { 'i', 'j', 'u' }; +static const symbol s_2_1814[4] = { 'b', 'i', 'j', 'u' }; +static const symbol s_2_1815[4] = { 'c', 'i', 'j', 'u' }; +static const symbol s_2_1816[4] = { 'd', 'i', 'j', 'u' }; +static const symbol s_2_1817[4] = { 'f', 'i', 'j', 'u' }; +static const symbol s_2_1818[4] = { 'g', 'i', 'j', 'u' }; +static const symbol s_2_1819[6] = { 'a', 'n', 'j', 'i', 'j', 'u' }; +static const symbol s_2_1820[6] = { 'e', 'n', 'j', 'i', 'j', 'u' }; +static const symbol s_2_1821[6] = { 's', 'n', 'j', 'i', 'j', 'u' }; +static const symbol s_2_1822[7] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'u' }; +static const symbol s_2_1823[4] = { 'k', 'i', 'j', 'u' }; +static const symbol s_2_1824[4] = { 'l', 'i', 'j', 'u' }; +static const symbol s_2_1825[5] = { 'e', 'l', 'i', 'j', 'u' }; +static const symbol s_2_1826[4] = { 'm', 'i', 'j', 'u' }; +static const symbol s_2_1827[4] = { 'n', 'i', 'j', 'u' }; +static const symbol s_2_1828[6] = { 'g', 'a', 'n', 'i', 'j', 'u' }; +static const symbol s_2_1829[6] = { 'm', 'a', 'n', 'i', 'j', 'u' }; +static const symbol s_2_1830[6] = { 'p', 'a', 'n', 'i', 'j', 'u' }; +static const symbol s_2_1831[6] = { 'r', 'a', 'n', 'i', 'j', 'u' }; +static const symbol s_2_1832[6] = { 't', 'a', 'n', 'i', 'j', 'u' }; +static const symbol s_2_1833[4] = { 'p', 'i', 'j', 'u' }; +static const symbol s_2_1834[4] = { 'r', 'i', 'j', 'u' }; +static const symbol s_2_1835[6] = { 'r', 'a', 'r', 'i', 'j', 'u' }; +static const symbol s_2_1836[4] = { 's', 'i', 'j', 'u' }; +static const symbol s_2_1837[5] = { 'o', 's', 'i', 'j', 'u' }; +static const symbol s_2_1838[4] = { 't', 'i', 'j', 'u' }; +static const symbol s_2_1839[5] = { 'a', 't', 'i', 'j', 'u' }; +static const symbol s_2_1840[5] = { 'o', 't', 'i', 'j', 'u' }; +static const symbol s_2_1841[5] = { 'a', 'v', 'i', 'j', 'u' }; +static const symbol s_2_1842[5] = { 'e', 'v', 'i', 'j', 'u' }; +static const symbol s_2_1843[5] = { 'i', 'v', 'i', 'j', 'u' }; +static const symbol s_2_1844[5] = { 'o', 'v', 'i', 'j', 'u' }; +static const symbol s_2_1845[4] = { 'z', 'i', 'j', 'u' }; +static const symbol s_2_1846[6] = { 'o', 0xC5, 0xA1, 'i', 'j', 'u' }; +static const symbol s_2_1847[5] = { 0xC5, 0xBE, 'i', 'j', 'u' }; +static const symbol s_2_1848[4] = { 'a', 'n', 'j', 'u' }; +static const symbol s_2_1849[4] = { 'e', 'n', 'j', 'u' }; +static const symbol s_2_1850[4] = { 's', 'n', 'j', 'u' }; +static const symbol s_2_1851[5] = { 0xC5, 0xA1, 'n', 'j', 'u' }; +static const symbol s_2_1852[3] = { 'u', 'j', 'u' }; +static const symbol s_2_1853[6] = { 'l', 'u', 'c', 'u', 'j', 'u' }; +static const symbol s_2_1854[5] = { 'i', 'r', 'u', 'j', 'u' }; +static const symbol s_2_1855[7] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'u' }; +static const symbol s_2_1856[2] = { 'k', 'u' }; +static const symbol s_2_1857[3] = { 's', 'k', 'u' }; +static const symbol s_2_1858[4] = { 0xC5, 0xA1, 'k', 'u' }; +static const symbol s_2_1859[3] = { 'a', 'l', 'u' }; +static const symbol s_2_1860[5] = { 'i', 'j', 'a', 'l', 'u' }; +static const symbol s_2_1861[4] = { 'n', 'a', 'l', 'u' }; +static const symbol s_2_1862[3] = { 'e', 'l', 'u' }; +static const symbol s_2_1863[3] = { 'i', 'l', 'u' }; +static const symbol s_2_1864[5] = { 'o', 'z', 'i', 'l', 'u' }; +static const symbol s_2_1865[3] = { 'o', 'l', 'u' }; +static const symbol s_2_1866[4] = { 'r', 'a', 'm', 'u' }; +static const symbol s_2_1867[5] = { 'a', 'c', 'e', 'm', 'u' }; +static const symbol s_2_1868[5] = { 'e', 'c', 'e', 'm', 'u' }; +static const symbol s_2_1869[5] = { 'u', 'c', 'e', 'm', 'u' }; +static const symbol s_2_1870[8] = { 'a', 'n', 'j', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1871[8] = { 'e', 'n', 'j', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1872[8] = { 's', 'n', 'j', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1873[9] = { 0xC5, 0xA1, 'n', 'j', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1874[6] = { 'k', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1875[7] = { 's', 'k', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1876[8] = { 0xC5, 0xA1, 'k', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1877[7] = { 'e', 'l', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1878[6] = { 'n', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1879[7] = { 'o', 's', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1880[7] = { 'a', 't', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1881[9] = { 'e', 'v', 'i', 't', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1882[9] = { 'o', 'v', 'i', 't', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1883[8] = { 'a', 's', 't', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1884[7] = { 'a', 'v', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1885[7] = { 'e', 'v', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1886[7] = { 'i', 'v', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1887[7] = { 'o', 'v', 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1888[8] = { 'o', 0xC5, 0xA1, 'i', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1889[6] = { 'a', 'n', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1890[6] = { 'e', 'n', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1891[6] = { 's', 'n', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1892[7] = { 0xC5, 0xA1, 'n', 'j', 'e', 'm', 'u' }; +static const symbol s_2_1893[4] = { 'k', 'e', 'm', 'u' }; +static const symbol s_2_1894[5] = { 's', 'k', 'e', 'm', 'u' }; +static const symbol s_2_1895[6] = { 0xC5, 0xA1, 'k', 'e', 'm', 'u' }; +static const symbol s_2_1896[4] = { 'l', 'e', 'm', 'u' }; +static const symbol s_2_1897[5] = { 'e', 'l', 'e', 'm', 'u' }; +static const symbol s_2_1898[4] = { 'n', 'e', 'm', 'u' }; +static const symbol s_2_1899[5] = { 'a', 'n', 'e', 'm', 'u' }; +static const symbol s_2_1900[5] = { 'e', 'n', 'e', 'm', 'u' }; +static const symbol s_2_1901[5] = { 's', 'n', 'e', 'm', 'u' }; +static const symbol s_2_1902[6] = { 0xC5, 0xA1, 'n', 'e', 'm', 'u' }; +static const symbol s_2_1903[5] = { 'o', 's', 'e', 'm', 'u' }; +static const symbol s_2_1904[5] = { 'a', 't', 'e', 'm', 'u' }; +static const symbol s_2_1905[7] = { 'e', 'v', 'i', 't', 'e', 'm', 'u' }; +static const symbol s_2_1906[7] = { 'o', 'v', 'i', 't', 'e', 'm', 'u' }; +static const symbol s_2_1907[6] = { 'a', 's', 't', 'e', 'm', 'u' }; +static const symbol s_2_1908[5] = { 'a', 'v', 'e', 'm', 'u' }; +static const symbol s_2_1909[5] = { 'e', 'v', 'e', 'm', 'u' }; +static const symbol s_2_1910[5] = { 'i', 'v', 'e', 'm', 'u' }; +static const symbol s_2_1911[5] = { 'o', 'v', 'e', 'm', 'u' }; +static const symbol s_2_1912[6] = { 'a', 0xC4, 0x87, 'e', 'm', 'u' }; +static const symbol s_2_1913[6] = { 'e', 0xC4, 0x87, 'e', 'm', 'u' }; +static const symbol s_2_1914[6] = { 'u', 0xC4, 0x87, 'e', 'm', 'u' }; +static const symbol s_2_1915[6] = { 'o', 0xC5, 0xA1, 'e', 'm', 'u' }; +static const symbol s_2_1916[5] = { 'a', 'c', 'o', 'm', 'u' }; +static const symbol s_2_1917[5] = { 'e', 'c', 'o', 'm', 'u' }; +static const symbol s_2_1918[5] = { 'u', 'c', 'o', 'm', 'u' }; +static const symbol s_2_1919[6] = { 'a', 'n', 'j', 'o', 'm', 'u' }; +static const symbol s_2_1920[6] = { 'e', 'n', 'j', 'o', 'm', 'u' }; +static const symbol s_2_1921[6] = { 's', 'n', 'j', 'o', 'm', 'u' }; +static const symbol s_2_1922[7] = { 0xC5, 0xA1, 'n', 'j', 'o', 'm', 'u' }; +static const symbol s_2_1923[4] = { 'k', 'o', 'm', 'u' }; +static const symbol s_2_1924[5] = { 's', 'k', 'o', 'm', 'u' }; +static const symbol s_2_1925[6] = { 0xC5, 0xA1, 'k', 'o', 'm', 'u' }; +static const symbol s_2_1926[5] = { 'e', 'l', 'o', 'm', 'u' }; +static const symbol s_2_1927[4] = { 'n', 'o', 'm', 'u' }; +static const symbol s_2_1928[6] = { 'c', 'i', 'n', 'o', 'm', 'u' }; +static const symbol s_2_1929[7] = { 0xC4, 0x8D, 'i', 'n', 'o', 'm', 'u' }; +static const symbol s_2_1930[5] = { 'o', 's', 'o', 'm', 'u' }; +static const symbol s_2_1931[5] = { 'a', 't', 'o', 'm', 'u' }; +static const symbol s_2_1932[7] = { 'e', 'v', 'i', 't', 'o', 'm', 'u' }; +static const symbol s_2_1933[7] = { 'o', 'v', 'i', 't', 'o', 'm', 'u' }; +static const symbol s_2_1934[6] = { 'a', 's', 't', 'o', 'm', 'u' }; +static const symbol s_2_1935[5] = { 'a', 'v', 'o', 'm', 'u' }; +static const symbol s_2_1936[5] = { 'e', 'v', 'o', 'm', 'u' }; +static const symbol s_2_1937[5] = { 'i', 'v', 'o', 'm', 'u' }; +static const symbol s_2_1938[5] = { 'o', 'v', 'o', 'm', 'u' }; +static const symbol s_2_1939[6] = { 'a', 0xC4, 0x87, 'o', 'm', 'u' }; +static const symbol s_2_1940[6] = { 'e', 0xC4, 0x87, 'o', 'm', 'u' }; +static const symbol s_2_1941[6] = { 'u', 0xC4, 0x87, 'o', 'm', 'u' }; +static const symbol s_2_1942[6] = { 'o', 0xC5, 0xA1, 'o', 'm', 'u' }; +static const symbol s_2_1943[2] = { 'n', 'u' }; +static const symbol s_2_1944[3] = { 'a', 'n', 'u' }; +static const symbol s_2_1945[6] = { 'a', 's', 't', 'a', 'n', 'u' }; +static const symbol s_2_1946[6] = { 'i', 's', 't', 'a', 'n', 'u' }; +static const symbol s_2_1947[6] = { 'o', 's', 't', 'a', 'n', 'u' }; +static const symbol s_2_1948[3] = { 'i', 'n', 'u' }; +static const symbol s_2_1949[4] = { 'c', 'i', 'n', 'u' }; +static const symbol s_2_1950[5] = { 'a', 'n', 'i', 'n', 'u' }; +static const symbol s_2_1951[5] = { 0xC4, 0x8D, 'i', 'n', 'u' }; +static const symbol s_2_1952[3] = { 'o', 'n', 'u' }; +static const symbol s_2_1953[3] = { 'a', 'r', 'u' }; +static const symbol s_2_1954[3] = { 'd', 'r', 'u' }; +static const symbol s_2_1955[3] = { 'e', 'r', 'u' }; +static const symbol s_2_1956[3] = { 'o', 'r', 'u' }; +static const symbol s_2_1957[4] = { 'b', 'a', 's', 'u' }; +static const symbol s_2_1958[4] = { 'g', 'a', 's', 'u' }; +static const symbol s_2_1959[4] = { 'j', 'a', 's', 'u' }; +static const symbol s_2_1960[4] = { 'k', 'a', 's', 'u' }; +static const symbol s_2_1961[4] = { 'n', 'a', 's', 'u' }; +static const symbol s_2_1962[4] = { 't', 'a', 's', 'u' }; +static const symbol s_2_1963[4] = { 'v', 'a', 's', 'u' }; +static const symbol s_2_1964[3] = { 'e', 's', 'u' }; +static const symbol s_2_1965[3] = { 'i', 's', 'u' }; +static const symbol s_2_1966[3] = { 'o', 's', 'u' }; +static const symbol s_2_1967[3] = { 'a', 't', 'u' }; +static const symbol s_2_1968[5] = { 'i', 'k', 'a', 't', 'u' }; +static const symbol s_2_1969[4] = { 'l', 'a', 't', 'u' }; +static const symbol s_2_1970[3] = { 'e', 't', 'u' }; +static const symbol s_2_1971[5] = { 'e', 'v', 'i', 't', 'u' }; +static const symbol s_2_1972[5] = { 'o', 'v', 'i', 't', 'u' }; +static const symbol s_2_1973[4] = { 'a', 's', 't', 'u' }; +static const symbol s_2_1974[4] = { 'e', 's', 't', 'u' }; +static const symbol s_2_1975[4] = { 'i', 's', 't', 'u' }; +static const symbol s_2_1976[4] = { 'k', 's', 't', 'u' }; +static const symbol s_2_1977[4] = { 'o', 's', 't', 'u' }; +static const symbol s_2_1978[5] = { 'i', 0xC5, 0xA1, 't', 'u' }; +static const symbol s_2_1979[3] = { 'a', 'v', 'u' }; +static const symbol s_2_1980[3] = { 'e', 'v', 'u' }; +static const symbol s_2_1981[3] = { 'i', 'v', 'u' }; +static const symbol s_2_1982[3] = { 'o', 'v', 'u' }; +static const symbol s_2_1983[4] = { 'l', 'o', 'v', 'u' }; +static const symbol s_2_1984[4] = { 'm', 'o', 'v', 'u' }; +static const symbol s_2_1985[4] = { 's', 't', 'v', 'u' }; +static const symbol s_2_1986[5] = { 0xC5, 0xA1, 't', 'v', 'u' }; +static const symbol s_2_1987[5] = { 'b', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1988[5] = { 'g', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1989[5] = { 'j', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1990[5] = { 'k', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1991[5] = { 'n', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1992[5] = { 't', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1993[5] = { 'v', 'a', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1994[4] = { 'e', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1995[4] = { 'i', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1996[4] = { 'o', 0xC5, 0xA1, 'u' }; +static const symbol s_2_1997[4] = { 'a', 'v', 'a', 'v' }; +static const symbol s_2_1998[4] = { 'e', 'v', 'a', 'v' }; +static const symbol s_2_1999[4] = { 'i', 'v', 'a', 'v' }; +static const symbol s_2_2000[4] = { 'u', 'v', 'a', 'v' }; +static const symbol s_2_2001[3] = { 'k', 'o', 'v' }; +static const symbol s_2_2002[3] = { 'a', 0xC5, 0xA1 }; +static const symbol s_2_2003[5] = { 'i', 'r', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2004[5] = { 'u', 'r', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2005[4] = { 't', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2006[5] = { 'a', 'v', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2007[5] = { 'e', 'v', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2008[5] = { 'i', 'v', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2009[5] = { 'u', 'v', 'a', 0xC5, 0xA1 }; +static const symbol s_2_2010[6] = { 'a', 0xC4, 0x8D, 'a', 0xC5, 0xA1 }; +static const symbol s_2_2011[3] = { 'e', 0xC5, 0xA1 }; +static const symbol s_2_2012[8] = { 'a', 's', 't', 'a', 'd', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2013[8] = { 'i', 's', 't', 'a', 'd', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2014[8] = { 'o', 's', 't', 'a', 'd', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2015[8] = { 'a', 's', 't', 'a', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2016[8] = { 'i', 's', 't', 'a', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2017[8] = { 'o', 's', 't', 'a', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2018[5] = { 'i', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2019[6] = { 'i', 'n', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2020[5] = { 'u', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2021[7] = { 'i', 'r', 'u', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2022[9] = { 'l', 'u', 0xC4, 0x8D, 'u', 'j', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2023[4] = { 'n', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2024[8] = { 'a', 's', 't', 'a', 'n', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2025[8] = { 'i', 's', 't', 'a', 'n', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2026[8] = { 'o', 's', 't', 'a', 'n', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2027[5] = { 'e', 't', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2028[6] = { 'a', 's', 't', 'e', 0xC5, 0xA1 }; +static const symbol s_2_2029[3] = { 'i', 0xC5, 0xA1 }; +static const symbol s_2_2030[4] = { 'n', 'i', 0xC5, 0xA1 }; +static const symbol s_2_2031[6] = { 'j', 'e', 't', 'i', 0xC5, 0xA1 }; +static const symbol s_2_2032[6] = { 'a', 0xC4, 0x8D, 'i', 0xC5, 0xA1 }; +static const symbol s_2_2033[7] = { 'l', 'u', 0xC4, 0x8D, 'i', 0xC5, 0xA1 }; +static const symbol s_2_2034[7] = { 'r', 'o', 0xC5, 0xA1, 'i', 0xC5, 0xA1 }; +static const struct among a_2[2035] = { +{ 3, s_2_0, 0, 124, 0}, +{ 3, s_2_1, 0, 125, 0}, +{ 3, s_2_2, 0, 126, 0}, +{ 2, s_2_3, 0, 20, 0}, +{ 5, s_2_4, -1, 124, 0}, +{ 5, s_2_5, -2, 125, 0}, +{ 5, s_2_6, -3, 126, 0}, +{ 8, s_2_7, -4, 84, 0}, +{ 8, s_2_8, -5, 85, 0}, +{ 8, s_2_9, -6, 122, 0}, +{ 9, s_2_10, -7, 86, 0}, +{ 6, s_2_11, -8, 95, 0}, +{ 7, s_2_12, -1, 1, 0}, +{ 8, s_2_13, -2, 2, 0}, +{ 7, s_2_14, -11, 83, 0}, +{ 6, s_2_15, -12, 13, 0}, +{ 7, s_2_16, -13, 123, 0}, +{ 7, s_2_17, -14, 120, 0}, +{ 9, s_2_18, -15, 92, 0}, +{ 9, s_2_19, -16, 93, 0}, +{ 8, s_2_20, -17, 94, 0}, +{ 7, s_2_21, -18, 77, 0}, +{ 7, s_2_22, -19, 78, 0}, +{ 7, s_2_23, -20, 79, 0}, +{ 7, s_2_24, -21, 80, 0}, +{ 8, s_2_25, -22, 91, 0}, +{ 6, s_2_26, -23, 84, 0}, +{ 6, s_2_27, -24, 85, 0}, +{ 6, s_2_28, -25, 122, 0}, +{ 7, s_2_29, -26, 86, 0}, +{ 4, s_2_30, -27, 95, 0}, +{ 5, s_2_31, -1, 1, 0}, +{ 6, s_2_32, -2, 2, 0}, +{ 5, s_2_33, -30, 83, 0}, +{ 4, s_2_34, -31, 13, 0}, +{ 5, s_2_35, -1, 10, 0}, +{ 5, s_2_36, -2, 87, 0}, +{ 5, s_2_37, -3, 159, 0}, +{ 6, s_2_38, -4, 88, 0}, +{ 5, s_2_39, -36, 123, 0}, +{ 5, s_2_40, -37, 120, 0}, +{ 7, s_2_41, -38, 92, 0}, +{ 7, s_2_42, -39, 93, 0}, +{ 6, s_2_43, -40, 94, 0}, +{ 5, s_2_44, -41, 77, 0}, +{ 5, s_2_45, -42, 78, 0}, +{ 5, s_2_46, -43, 79, 0}, +{ 5, s_2_47, -44, 80, 0}, +{ 6, s_2_48, -45, 14, 0}, +{ 6, s_2_49, -46, 15, 0}, +{ 6, s_2_50, -47, 16, 0}, +{ 6, s_2_51, -48, 91, 0}, +{ 5, s_2_52, -49, 124, 0}, +{ 5, s_2_53, -50, 125, 0}, +{ 5, s_2_54, -51, 126, 0}, +{ 6, s_2_55, -52, 84, 0}, +{ 6, s_2_56, -53, 85, 0}, +{ 6, s_2_57, -54, 122, 0}, +{ 7, s_2_58, -55, 86, 0}, +{ 4, s_2_59, -56, 95, 0}, +{ 5, s_2_60, -1, 1, 0}, +{ 6, s_2_61, -2, 2, 0}, +{ 4, s_2_62, -59, 19, 0}, +{ 5, s_2_63, -1, 83, 0}, +{ 4, s_2_64, -61, 13, 0}, +{ 6, s_2_65, -1, 137, 0}, +{ 7, s_2_66, -2, 89, 0}, +{ 5, s_2_67, -64, 123, 0}, +{ 5, s_2_68, -65, 120, 0}, +{ 7, s_2_69, -66, 92, 0}, +{ 7, s_2_70, -67, 93, 0}, +{ 6, s_2_71, -68, 94, 0}, +{ 5, s_2_72, -69, 77, 0}, +{ 5, s_2_73, -70, 78, 0}, +{ 5, s_2_74, -71, 79, 0}, +{ 5, s_2_75, -72, 80, 0}, +{ 6, s_2_76, -73, 14, 0}, +{ 6, s_2_77, -74, 15, 0}, +{ 6, s_2_78, -75, 16, 0}, +{ 6, s_2_79, -76, 91, 0}, +{ 3, s_2_80, -77, 18, 0}, +{ 3, s_2_81, 0, 109, 0}, +{ 4, s_2_82, -1, 26, 0}, +{ 4, s_2_83, -2, 30, 0}, +{ 4, s_2_84, -3, 31, 0}, +{ 5, s_2_85, -4, 28, 0}, +{ 5, s_2_86, -5, 27, 0}, +{ 5, s_2_87, -6, 29, 0}, +{ 4, s_2_88, 0, 32, 0}, +{ 4, s_2_89, 0, 33, 0}, +{ 4, s_2_90, 0, 34, 0}, +{ 4, s_2_91, 0, 40, 0}, +{ 4, s_2_92, 0, 39, 0}, +{ 6, s_2_93, 0, 84, 0}, +{ 6, s_2_94, 0, 85, 0}, +{ 6, s_2_95, 0, 122, 0}, +{ 7, s_2_96, 0, 86, 0}, +{ 4, s_2_97, 0, 95, 0}, +{ 5, s_2_98, -1, 1, 0}, +{ 6, s_2_99, -2, 2, 0}, +{ 4, s_2_100, 0, 24, 0}, +{ 5, s_2_101, -1, 83, 0}, +{ 4, s_2_102, 0, 37, 0}, +{ 4, s_2_103, 0, 13, 0}, +{ 6, s_2_104, -1, 9, 0}, +{ 6, s_2_105, -2, 6, 0}, +{ 6, s_2_106, -3, 7, 0}, +{ 6, s_2_107, -4, 8, 0}, +{ 6, s_2_108, -5, 5, 0}, +{ 4, s_2_109, 0, 41, 0}, +{ 4, s_2_110, 0, 42, 0}, +{ 6, s_2_111, -1, 21, 0}, +{ 4, s_2_112, 0, 23, 0}, +{ 5, s_2_113, -1, 123, 0}, +{ 4, s_2_114, 0, 44, 0}, +{ 5, s_2_115, -1, 120, 0}, +{ 7, s_2_116, -2, 92, 0}, +{ 7, s_2_117, -3, 93, 0}, +{ 5, s_2_118, -4, 22, 0}, +{ 6, s_2_119, -5, 94, 0}, +{ 5, s_2_120, 0, 77, 0}, +{ 5, s_2_121, 0, 78, 0}, +{ 5, s_2_122, 0, 79, 0}, +{ 5, s_2_123, 0, 80, 0}, +{ 4, s_2_124, 0, 45, 0}, +{ 6, s_2_125, 0, 91, 0}, +{ 5, s_2_126, 0, 38, 0}, +{ 4, s_2_127, 0, 84, 0}, +{ 4, s_2_128, 0, 85, 0}, +{ 4, s_2_129, 0, 122, 0}, +{ 5, s_2_130, 0, 86, 0}, +{ 2, s_2_131, 0, 95, 0}, +{ 3, s_2_132, -1, 1, 0}, +{ 4, s_2_133, -2, 2, 0}, +{ 3, s_2_134, 0, 104, 0}, +{ 5, s_2_135, -1, 128, 0}, +{ 8, s_2_136, -2, 106, 0}, +{ 8, s_2_137, -3, 107, 0}, +{ 8, s_2_138, -4, 108, 0}, +{ 5, s_2_139, -5, 47, 0}, +{ 6, s_2_140, -6, 114, 0}, +{ 4, s_2_141, -7, 46, 0}, +{ 5, s_2_142, -8, 100, 0}, +{ 5, s_2_143, -9, 105, 0}, +{ 4, s_2_144, -10, 113, 0}, +{ 6, s_2_145, -1, 110, 0}, +{ 6, s_2_146, -2, 111, 0}, +{ 6, s_2_147, -3, 112, 0}, +{ 5, s_2_148, -14, 97, 0}, +{ 5, s_2_149, -15, 96, 0}, +{ 5, s_2_150, -16, 98, 0}, +{ 5, s_2_151, -17, 76, 0}, +{ 5, s_2_152, -18, 99, 0}, +{ 6, s_2_153, -19, 102, 0}, +{ 3, s_2_154, 0, 83, 0}, +{ 3, s_2_155, 0, 116, 0}, +{ 5, s_2_156, -1, 124, 0}, +{ 6, s_2_157, -2, 121, 0}, +{ 4, s_2_158, -3, 103, 0}, +{ 8, s_2_159, -1, 110, 0}, +{ 8, s_2_160, -2, 111, 0}, +{ 8, s_2_161, -3, 112, 0}, +{ 6, s_2_162, -7, 127, 0}, +{ 6, s_2_163, -8, 118, 0}, +{ 5, s_2_164, -9, 48, 0}, +{ 6, s_2_165, -10, 101, 0}, +{ 7, s_2_166, -11, 117, 0}, +{ 7, s_2_167, -12, 90, 0}, +{ 3, s_2_168, 0, 50, 0}, +{ 4, s_2_169, 0, 115, 0}, +{ 4, s_2_170, 0, 13, 0}, +{ 4, s_2_171, 0, 20, 0}, +{ 6, s_2_172, -1, 19, 0}, +{ 5, s_2_173, -2, 18, 0}, +{ 5, s_2_174, 0, 109, 0}, +{ 6, s_2_175, -1, 26, 0}, +{ 6, s_2_176, -2, 30, 0}, +{ 6, s_2_177, -3, 31, 0}, +{ 7, s_2_178, -4, 28, 0}, +{ 7, s_2_179, -5, 27, 0}, +{ 7, s_2_180, -6, 29, 0}, +{ 6, s_2_181, 0, 32, 0}, +{ 6, s_2_182, 0, 33, 0}, +{ 6, s_2_183, 0, 34, 0}, +{ 6, s_2_184, 0, 40, 0}, +{ 6, s_2_185, 0, 39, 0}, +{ 6, s_2_186, 0, 35, 0}, +{ 6, s_2_187, 0, 37, 0}, +{ 6, s_2_188, 0, 36, 0}, +{ 8, s_2_189, -1, 9, 0}, +{ 8, s_2_190, -2, 6, 0}, +{ 8, s_2_191, -3, 7, 0}, +{ 8, s_2_192, -4, 8, 0}, +{ 8, s_2_193, -5, 5, 0}, +{ 6, s_2_194, 0, 41, 0}, +{ 6, s_2_195, 0, 42, 0}, +{ 6, s_2_196, 0, 43, 0}, +{ 6, s_2_197, 0, 44, 0}, +{ 6, s_2_198, 0, 45, 0}, +{ 7, s_2_199, 0, 38, 0}, +{ 5, s_2_200, 0, 104, 0}, +{ 7, s_2_201, -1, 47, 0}, +{ 6, s_2_202, -2, 46, 0}, +{ 5, s_2_203, 0, 119, 0}, +{ 5, s_2_204, 0, 116, 0}, +{ 6, s_2_205, 0, 52, 0}, +{ 6, s_2_206, 0, 51, 0}, +{ 5, s_2_207, 0, 11, 0}, +{ 6, s_2_208, -1, 137, 0}, +{ 7, s_2_209, -2, 89, 0}, +{ 4, s_2_210, 0, 52, 0}, +{ 5, s_2_211, -1, 53, 0}, +{ 5, s_2_212, -2, 54, 0}, +{ 5, s_2_213, -3, 55, 0}, +{ 5, s_2_214, -4, 56, 0}, +{ 6, s_2_215, 0, 135, 0}, +{ 6, s_2_216, 0, 131, 0}, +{ 6, s_2_217, 0, 129, 0}, +{ 6, s_2_218, 0, 133, 0}, +{ 6, s_2_219, 0, 132, 0}, +{ 6, s_2_220, 0, 130, 0}, +{ 6, s_2_221, 0, 134, 0}, +{ 5, s_2_222, 0, 152, 0}, +{ 5, s_2_223, 0, 154, 0}, +{ 5, s_2_224, 0, 70, 0}, +{ 6, s_2_225, 0, 71, 0}, +{ 6, s_2_226, 0, 72, 0}, +{ 6, s_2_227, 0, 73, 0}, +{ 6, s_2_228, 0, 74, 0}, +{ 5, s_2_229, 0, 77, 0}, +{ 5, s_2_230, 0, 78, 0}, +{ 5, s_2_231, 0, 79, 0}, +{ 7, s_2_232, 0, 63, 0}, +{ 7, s_2_233, 0, 64, 0}, +{ 7, s_2_234, 0, 61, 0}, +{ 7, s_2_235, 0, 62, 0}, +{ 7, s_2_236, 0, 60, 0}, +{ 7, s_2_237, 0, 59, 0}, +{ 7, s_2_238, 0, 65, 0}, +{ 6, s_2_239, 0, 66, 0}, +{ 6, s_2_240, 0, 67, 0}, +{ 4, s_2_241, 0, 51, 0}, +{ 5, s_2_242, 0, 124, 0}, +{ 5, s_2_243, 0, 125, 0}, +{ 5, s_2_244, 0, 126, 0}, +{ 5, s_2_245, 0, 109, 0}, +{ 6, s_2_246, -1, 26, 0}, +{ 6, s_2_247, -2, 30, 0}, +{ 6, s_2_248, -3, 31, 0}, +{ 7, s_2_249, -4, 28, 0}, +{ 7, s_2_250, -5, 27, 0}, +{ 7, s_2_251, -6, 29, 0}, +{ 6, s_2_252, 0, 32, 0}, +{ 6, s_2_253, 0, 33, 0}, +{ 6, s_2_254, 0, 34, 0}, +{ 6, s_2_255, 0, 40, 0}, +{ 6, s_2_256, 0, 39, 0}, +{ 8, s_2_257, 0, 84, 0}, +{ 8, s_2_258, 0, 85, 0}, +{ 8, s_2_259, 0, 122, 0}, +{ 9, s_2_260, 0, 86, 0}, +{ 6, s_2_261, 0, 95, 0}, +{ 7, s_2_262, -1, 1, 0}, +{ 8, s_2_263, -2, 2, 0}, +{ 6, s_2_264, 0, 35, 0}, +{ 7, s_2_265, -1, 83, 0}, +{ 6, s_2_266, 0, 37, 0}, +{ 6, s_2_267, 0, 13, 0}, +{ 8, s_2_268, -1, 9, 0}, +{ 8, s_2_269, -2, 6, 0}, +{ 8, s_2_270, -3, 7, 0}, +{ 8, s_2_271, -4, 8, 0}, +{ 8, s_2_272, -5, 5, 0}, +{ 6, s_2_273, 0, 41, 0}, +{ 6, s_2_274, 0, 42, 0}, +{ 6, s_2_275, 0, 43, 0}, +{ 7, s_2_276, -1, 123, 0}, +{ 6, s_2_277, 0, 44, 0}, +{ 7, s_2_278, -1, 120, 0}, +{ 9, s_2_279, -2, 92, 0}, +{ 9, s_2_280, -3, 93, 0}, +{ 8, s_2_281, -4, 94, 0}, +{ 7, s_2_282, 0, 77, 0}, +{ 7, s_2_283, 0, 78, 0}, +{ 7, s_2_284, 0, 79, 0}, +{ 7, s_2_285, 0, 80, 0}, +{ 6, s_2_286, 0, 45, 0}, +{ 8, s_2_287, 0, 91, 0}, +{ 7, s_2_288, 0, 38, 0}, +{ 6, s_2_289, 0, 84, 0}, +{ 6, s_2_290, 0, 85, 0}, +{ 6, s_2_291, 0, 122, 0}, +{ 7, s_2_292, 0, 86, 0}, +{ 4, s_2_293, 0, 95, 0}, +{ 5, s_2_294, -1, 1, 0}, +{ 6, s_2_295, -2, 2, 0}, +{ 5, s_2_296, 0, 104, 0}, +{ 7, s_2_297, -1, 47, 0}, +{ 6, s_2_298, -2, 46, 0}, +{ 5, s_2_299, 0, 83, 0}, +{ 5, s_2_300, 0, 116, 0}, +{ 7, s_2_301, -1, 48, 0}, +{ 5, s_2_302, 0, 50, 0}, +{ 6, s_2_303, 0, 51, 0}, +{ 4, s_2_304, 0, 13, 0}, +{ 5, s_2_305, -1, 10, 0}, +{ 5, s_2_306, -2, 11, 0}, +{ 6, s_2_307, -1, 137, 0}, +{ 7, s_2_308, -2, 89, 0}, +{ 5, s_2_309, -5, 12, 0}, +{ 5, s_2_310, 0, 53, 0}, +{ 5, s_2_311, 0, 54, 0}, +{ 5, s_2_312, 0, 55, 0}, +{ 5, s_2_313, 0, 56, 0}, +{ 6, s_2_314, 0, 135, 0}, +{ 6, s_2_315, 0, 131, 0}, +{ 6, s_2_316, 0, 129, 0}, +{ 6, s_2_317, 0, 133, 0}, +{ 6, s_2_318, 0, 132, 0}, +{ 6, s_2_319, 0, 130, 0}, +{ 6, s_2_320, 0, 134, 0}, +{ 5, s_2_321, 0, 57, 0}, +{ 5, s_2_322, 0, 58, 0}, +{ 5, s_2_323, 0, 123, 0}, +{ 5, s_2_324, 0, 120, 0}, +{ 7, s_2_325, -1, 68, 0}, +{ 6, s_2_326, -2, 69, 0}, +{ 5, s_2_327, 0, 70, 0}, +{ 7, s_2_328, 0, 92, 0}, +{ 7, s_2_329, 0, 93, 0}, +{ 6, s_2_330, 0, 94, 0}, +{ 6, s_2_331, 0, 71, 0}, +{ 6, s_2_332, 0, 72, 0}, +{ 6, s_2_333, 0, 73, 0}, +{ 6, s_2_334, 0, 74, 0}, +{ 7, s_2_335, 0, 75, 0}, +{ 5, s_2_336, 0, 77, 0}, +{ 5, s_2_337, 0, 78, 0}, +{ 7, s_2_338, -1, 109, 0}, +{ 8, s_2_339, -1, 26, 0}, +{ 8, s_2_340, -2, 30, 0}, +{ 8, s_2_341, -3, 31, 0}, +{ 9, s_2_342, -4, 28, 0}, +{ 9, s_2_343, -5, 27, 0}, +{ 9, s_2_344, -6, 29, 0}, +{ 5, s_2_345, 0, 79, 0}, +{ 5, s_2_346, 0, 80, 0}, +{ 6, s_2_347, -1, 20, 0}, +{ 7, s_2_348, -1, 17, 0}, +{ 6, s_2_349, -3, 82, 0}, +{ 7, s_2_350, -1, 49, 0}, +{ 6, s_2_351, -5, 81, 0}, +{ 7, s_2_352, -6, 12, 0}, +{ 6, s_2_353, 0, 3, 0}, +{ 7, s_2_354, 0, 4, 0}, +{ 6, s_2_355, 0, 14, 0}, +{ 6, s_2_356, 0, 15, 0}, +{ 6, s_2_357, 0, 16, 0}, +{ 7, s_2_358, 0, 63, 0}, +{ 7, s_2_359, 0, 64, 0}, +{ 7, s_2_360, 0, 61, 0}, +{ 7, s_2_361, 0, 62, 0}, +{ 7, s_2_362, 0, 60, 0}, +{ 7, s_2_363, 0, 59, 0}, +{ 7, s_2_364, 0, 65, 0}, +{ 6, s_2_365, 0, 66, 0}, +{ 6, s_2_366, 0, 67, 0}, +{ 6, s_2_367, 0, 91, 0}, +{ 2, s_2_368, 0, 13, 0}, +{ 3, s_2_369, -1, 10, 0}, +{ 5, s_2_370, -1, 128, 0}, +{ 5, s_2_371, -2, 105, 0}, +{ 4, s_2_372, -3, 113, 0}, +{ 5, s_2_373, -4, 97, 0}, +{ 5, s_2_374, -5, 96, 0}, +{ 5, s_2_375, -6, 98, 0}, +{ 5, s_2_376, -7, 99, 0}, +{ 6, s_2_377, -8, 102, 0}, +{ 5, s_2_378, -10, 124, 0}, +{ 6, s_2_379, -11, 121, 0}, +{ 6, s_2_380, -12, 101, 0}, +{ 7, s_2_381, -13, 117, 0}, +{ 3, s_2_382, -14, 11, 0}, +{ 4, s_2_383, -1, 137, 0}, +{ 5, s_2_384, -2, 10, 0}, +{ 5, s_2_385, -3, 89, 0}, +{ 3, s_2_386, -18, 12, 0}, +{ 3, s_2_387, 0, 53, 0}, +{ 3, s_2_388, 0, 54, 0}, +{ 3, s_2_389, 0, 55, 0}, +{ 3, s_2_390, 0, 56, 0}, +{ 4, s_2_391, 0, 135, 0}, +{ 4, s_2_392, 0, 131, 0}, +{ 4, s_2_393, 0, 129, 0}, +{ 4, s_2_394, 0, 133, 0}, +{ 4, s_2_395, 0, 132, 0}, +{ 4, s_2_396, 0, 130, 0}, +{ 4, s_2_397, 0, 134, 0}, +{ 3, s_2_398, 0, 57, 0}, +{ 3, s_2_399, 0, 58, 0}, +{ 3, s_2_400, 0, 123, 0}, +{ 3, s_2_401, 0, 120, 0}, +{ 5, s_2_402, -1, 68, 0}, +{ 4, s_2_403, -2, 69, 0}, +{ 3, s_2_404, 0, 70, 0}, +{ 5, s_2_405, 0, 92, 0}, +{ 5, s_2_406, 0, 93, 0}, +{ 4, s_2_407, 0, 94, 0}, +{ 4, s_2_408, 0, 71, 0}, +{ 4, s_2_409, 0, 72, 0}, +{ 4, s_2_410, 0, 73, 0}, +{ 4, s_2_411, 0, 74, 0}, +{ 4, s_2_412, 0, 13, 0}, +{ 5, s_2_413, 0, 75, 0}, +{ 3, s_2_414, 0, 77, 0}, +{ 3, s_2_415, 0, 78, 0}, +{ 5, s_2_416, -1, 109, 0}, +{ 6, s_2_417, -1, 26, 0}, +{ 6, s_2_418, -2, 30, 0}, +{ 6, s_2_419, -3, 31, 0}, +{ 7, s_2_420, -4, 28, 0}, +{ 7, s_2_421, -5, 27, 0}, +{ 7, s_2_422, -6, 29, 0}, +{ 3, s_2_423, 0, 79, 0}, +{ 3, s_2_424, 0, 80, 0}, +{ 4, s_2_425, -1, 20, 0}, +{ 5, s_2_426, -1, 17, 0}, +{ 4, s_2_427, -3, 82, 0}, +{ 5, s_2_428, -1, 49, 0}, +{ 4, s_2_429, -5, 81, 0}, +{ 5, s_2_430, -6, 12, 0}, +{ 4, s_2_431, 0, 3, 0}, +{ 5, s_2_432, 0, 4, 0}, +{ 4, s_2_433, 0, 14, 0}, +{ 4, s_2_434, 0, 15, 0}, +{ 4, s_2_435, 0, 16, 0}, +{ 5, s_2_436, 0, 63, 0}, +{ 5, s_2_437, 0, 64, 0}, +{ 5, s_2_438, 0, 61, 0}, +{ 5, s_2_439, 0, 62, 0}, +{ 5, s_2_440, 0, 60, 0}, +{ 5, s_2_441, 0, 59, 0}, +{ 5, s_2_442, 0, 65, 0}, +{ 4, s_2_443, 0, 66, 0}, +{ 4, s_2_444, 0, 67, 0}, +{ 4, s_2_445, 0, 91, 0}, +{ 3, s_2_446, 0, 124, 0}, +{ 3, s_2_447, 0, 125, 0}, +{ 3, s_2_448, 0, 126, 0}, +{ 4, s_2_449, -1, 121, 0}, +{ 6, s_2_450, 0, 110, 0}, +{ 6, s_2_451, 0, 111, 0}, +{ 6, s_2_452, 0, 112, 0}, +{ 2, s_2_453, 0, 20, 0}, +{ 4, s_2_454, -1, 19, 0}, +{ 3, s_2_455, -2, 18, 0}, +{ 3, s_2_456, 0, 104, 0}, +{ 4, s_2_457, -1, 26, 0}, +{ 4, s_2_458, -2, 30, 0}, +{ 4, s_2_459, -3, 31, 0}, +{ 6, s_2_460, -4, 106, 0}, +{ 6, s_2_461, -5, 107, 0}, +{ 6, s_2_462, -6, 108, 0}, +{ 5, s_2_463, -7, 28, 0}, +{ 5, s_2_464, -8, 27, 0}, +{ 5, s_2_465, -9, 29, 0}, +{ 3, s_2_466, 0, 116, 0}, +{ 4, s_2_467, -1, 32, 0}, +{ 4, s_2_468, -2, 33, 0}, +{ 4, s_2_469, -3, 34, 0}, +{ 4, s_2_470, -4, 40, 0}, +{ 4, s_2_471, -5, 39, 0}, +{ 6, s_2_472, -6, 84, 0}, +{ 6, s_2_473, -7, 85, 0}, +{ 6, s_2_474, -8, 122, 0}, +{ 7, s_2_475, -9, 86, 0}, +{ 4, s_2_476, -10, 95, 0}, +{ 5, s_2_477, -1, 1, 0}, +{ 6, s_2_478, -2, 2, 0}, +{ 4, s_2_479, -13, 35, 0}, +{ 5, s_2_480, -1, 83, 0}, +{ 4, s_2_481, -15, 37, 0}, +{ 4, s_2_482, -16, 13, 0}, +{ 6, s_2_483, -1, 9, 0}, +{ 6, s_2_484, -2, 6, 0}, +{ 6, s_2_485, -3, 7, 0}, +{ 6, s_2_486, -4, 8, 0}, +{ 6, s_2_487, -5, 5, 0}, +{ 4, s_2_488, -22, 41, 0}, +{ 4, s_2_489, -23, 42, 0}, +{ 4, s_2_490, -24, 43, 0}, +{ 5, s_2_491, -1, 123, 0}, +{ 4, s_2_492, -26, 44, 0}, +{ 5, s_2_493, -1, 120, 0}, +{ 7, s_2_494, -2, 92, 0}, +{ 7, s_2_495, -3, 93, 0}, +{ 6, s_2_496, -4, 94, 0}, +{ 5, s_2_497, -31, 77, 0}, +{ 5, s_2_498, -32, 78, 0}, +{ 5, s_2_499, -33, 79, 0}, +{ 5, s_2_500, -34, 80, 0}, +{ 4, s_2_501, -35, 45, 0}, +{ 6, s_2_502, -36, 91, 0}, +{ 5, s_2_503, -37, 38, 0}, +{ 4, s_2_504, 0, 84, 0}, +{ 4, s_2_505, 0, 85, 0}, +{ 4, s_2_506, 0, 122, 0}, +{ 5, s_2_507, 0, 86, 0}, +{ 3, s_2_508, 0, 25, 0}, +{ 6, s_2_509, -1, 121, 0}, +{ 5, s_2_510, -2, 100, 0}, +{ 7, s_2_511, -3, 117, 0}, +{ 2, s_2_512, 0, 95, 0}, +{ 3, s_2_513, -1, 1, 0}, +{ 4, s_2_514, -2, 2, 0}, +{ 3, s_2_515, 0, 104, 0}, +{ 5, s_2_516, -1, 128, 0}, +{ 8, s_2_517, -2, 106, 0}, +{ 8, s_2_518, -3, 107, 0}, +{ 8, s_2_519, -4, 108, 0}, +{ 5, s_2_520, -5, 47, 0}, +{ 6, s_2_521, -6, 114, 0}, +{ 4, s_2_522, -7, 46, 0}, +{ 5, s_2_523, -8, 100, 0}, +{ 5, s_2_524, -9, 105, 0}, +{ 4, s_2_525, -10, 113, 0}, +{ 6, s_2_526, -1, 110, 0}, +{ 6, s_2_527, -2, 111, 0}, +{ 6, s_2_528, -3, 112, 0}, +{ 5, s_2_529, -14, 97, 0}, +{ 5, s_2_530, -15, 96, 0}, +{ 5, s_2_531, -16, 98, 0}, +{ 5, s_2_532, -17, 76, 0}, +{ 5, s_2_533, -18, 99, 0}, +{ 6, s_2_534, -19, 102, 0}, +{ 3, s_2_535, 0, 83, 0}, +{ 3, s_2_536, 0, 116, 0}, +{ 5, s_2_537, -1, 124, 0}, +{ 6, s_2_538, -2, 121, 0}, +{ 4, s_2_539, -3, 103, 0}, +{ 6, s_2_540, -4, 127, 0}, +{ 6, s_2_541, -5, 118, 0}, +{ 5, s_2_542, -6, 48, 0}, +{ 6, s_2_543, -7, 101, 0}, +{ 7, s_2_544, -8, 117, 0}, +{ 7, s_2_545, -9, 90, 0}, +{ 3, s_2_546, 0, 50, 0}, +{ 4, s_2_547, 0, 115, 0}, +{ 4, s_2_548, 0, 13, 0}, +{ 4, s_2_549, 0, 52, 0}, +{ 4, s_2_550, 0, 51, 0}, +{ 5, s_2_551, 0, 124, 0}, +{ 5, s_2_552, 0, 125, 0}, +{ 5, s_2_553, 0, 126, 0}, +{ 6, s_2_554, 0, 84, 0}, +{ 6, s_2_555, 0, 85, 0}, +{ 6, s_2_556, 0, 122, 0}, +{ 7, s_2_557, 0, 86, 0}, +{ 4, s_2_558, 0, 95, 0}, +{ 5, s_2_559, -1, 1, 0}, +{ 6, s_2_560, -2, 2, 0}, +{ 5, s_2_561, 0, 83, 0}, +{ 4, s_2_562, 0, 13, 0}, +{ 6, s_2_563, -1, 137, 0}, +{ 7, s_2_564, -2, 89, 0}, +{ 5, s_2_565, 0, 123, 0}, +{ 5, s_2_566, 0, 120, 0}, +{ 7, s_2_567, 0, 92, 0}, +{ 7, s_2_568, 0, 93, 0}, +{ 6, s_2_569, 0, 94, 0}, +{ 5, s_2_570, 0, 77, 0}, +{ 5, s_2_571, 0, 78, 0}, +{ 5, s_2_572, 0, 79, 0}, +{ 5, s_2_573, 0, 80, 0}, +{ 6, s_2_574, 0, 14, 0}, +{ 6, s_2_575, 0, 15, 0}, +{ 6, s_2_576, 0, 16, 0}, +{ 6, s_2_577, 0, 91, 0}, +{ 2, s_2_578, 0, 13, 0}, +{ 3, s_2_579, -1, 10, 0}, +{ 5, s_2_580, -1, 128, 0}, +{ 5, s_2_581, -2, 105, 0}, +{ 4, s_2_582, -3, 113, 0}, +{ 6, s_2_583, -1, 110, 0}, +{ 6, s_2_584, -2, 111, 0}, +{ 6, s_2_585, -3, 112, 0}, +{ 5, s_2_586, -7, 97, 0}, +{ 5, s_2_587, -8, 96, 0}, +{ 5, s_2_588, -9, 98, 0}, +{ 5, s_2_589, -10, 99, 0}, +{ 6, s_2_590, -11, 102, 0}, +{ 5, s_2_591, -13, 124, 0}, +{ 6, s_2_592, -14, 121, 0}, +{ 6, s_2_593, -15, 101, 0}, +{ 7, s_2_594, -16, 117, 0}, +{ 3, s_2_595, -17, 11, 0}, +{ 4, s_2_596, -1, 137, 0}, +{ 5, s_2_597, -2, 10, 0}, +{ 5, s_2_598, -3, 89, 0}, +{ 3, s_2_599, -21, 12, 0}, +{ 3, s_2_600, 0, 53, 0}, +{ 3, s_2_601, 0, 54, 0}, +{ 3, s_2_602, 0, 55, 0}, +{ 3, s_2_603, 0, 56, 0}, +{ 3, s_2_604, 0, 161, 0}, +{ 4, s_2_605, -1, 135, 0}, +{ 5, s_2_606, -2, 128, 0}, +{ 4, s_2_607, -3, 131, 0}, +{ 4, s_2_608, -4, 129, 0}, +{ 8, s_2_609, -1, 138, 0}, +{ 8, s_2_610, -2, 139, 0}, +{ 8, s_2_611, -3, 140, 0}, +{ 6, s_2_612, -4, 150, 0}, +{ 4, s_2_613, -9, 133, 0}, +{ 4, s_2_614, -10, 132, 0}, +{ 5, s_2_615, -11, 155, 0}, +{ 5, s_2_616, -12, 156, 0}, +{ 4, s_2_617, -13, 130, 0}, +{ 4, s_2_618, -14, 134, 0}, +{ 5, s_2_619, -1, 144, 0}, +{ 5, s_2_620, -2, 145, 0}, +{ 5, s_2_621, -3, 146, 0}, +{ 5, s_2_622, -4, 148, 0}, +{ 5, s_2_623, -5, 147, 0}, +{ 3, s_2_624, 0, 57, 0}, +{ 3, s_2_625, 0, 58, 0}, +{ 5, s_2_626, -1, 124, 0}, +{ 6, s_2_627, -2, 121, 0}, +{ 6, s_2_628, -3, 127, 0}, +{ 6, s_2_629, -4, 149, 0}, +{ 3, s_2_630, 0, 123, 0}, +{ 8, s_2_631, -1, 141, 0}, +{ 8, s_2_632, -2, 142, 0}, +{ 8, s_2_633, -3, 143, 0}, +{ 3, s_2_634, 0, 104, 0}, +{ 5, s_2_635, -1, 128, 0}, +{ 5, s_2_636, -2, 68, 0}, +{ 4, s_2_637, -3, 69, 0}, +{ 5, s_2_638, -4, 100, 0}, +{ 5, s_2_639, -5, 105, 0}, +{ 4, s_2_640, -6, 113, 0}, +{ 5, s_2_641, -7, 97, 0}, +{ 5, s_2_642, -8, 96, 0}, +{ 5, s_2_643, -9, 98, 0}, +{ 5, s_2_644, -10, 99, 0}, +{ 6, s_2_645, -11, 102, 0}, +{ 3, s_2_646, 0, 70, 0}, +{ 8, s_2_647, -1, 110, 0}, +{ 8, s_2_648, -2, 111, 0}, +{ 8, s_2_649, -3, 112, 0}, +{ 8, s_2_650, -4, 106, 0}, +{ 8, s_2_651, -5, 107, 0}, +{ 8, s_2_652, -6, 108, 0}, +{ 5, s_2_653, -7, 116, 0}, +{ 6, s_2_654, -8, 114, 0}, +{ 5, s_2_655, -9, 25, 0}, +{ 8, s_2_656, -1, 121, 0}, +{ 7, s_2_657, -2, 100, 0}, +{ 9, s_2_658, -3, 117, 0}, +{ 4, s_2_659, -13, 13, 0}, +{ 8, s_2_660, -1, 110, 0}, +{ 8, s_2_661, -2, 111, 0}, +{ 8, s_2_662, -3, 112, 0}, +{ 6, s_2_663, -17, 115, 0}, +{ 3, s_2_664, 0, 116, 0}, +{ 5, s_2_665, -1, 124, 0}, +{ 6, s_2_666, -2, 121, 0}, +{ 4, s_2_667, -3, 13, 0}, +{ 8, s_2_668, -1, 110, 0}, +{ 8, s_2_669, -2, 111, 0}, +{ 8, s_2_670, -3, 112, 0}, +{ 6, s_2_671, -7, 127, 0}, +{ 6, s_2_672, -8, 118, 0}, +{ 6, s_2_673, -9, 115, 0}, +{ 5, s_2_674, -10, 92, 0}, +{ 5, s_2_675, -11, 93, 0}, +{ 6, s_2_676, -12, 101, 0}, +{ 7, s_2_677, -13, 117, 0}, +{ 7, s_2_678, -14, 90, 0}, +{ 4, s_2_679, 0, 104, 0}, +{ 6, s_2_680, -1, 105, 0}, +{ 5, s_2_681, -2, 113, 0}, +{ 7, s_2_682, -1, 106, 0}, +{ 7, s_2_683, -2, 107, 0}, +{ 7, s_2_684, -3, 108, 0}, +{ 6, s_2_685, -6, 97, 0}, +{ 6, s_2_686, -7, 96, 0}, +{ 6, s_2_687, -8, 98, 0}, +{ 6, s_2_688, -9, 99, 0}, +{ 4, s_2_689, 0, 116, 0}, +{ 7, s_2_690, 0, 121, 0}, +{ 6, s_2_691, 0, 100, 0}, +{ 8, s_2_692, 0, 117, 0}, +{ 4, s_2_693, 0, 94, 0}, +{ 6, s_2_694, -1, 128, 0}, +{ 9, s_2_695, -2, 106, 0}, +{ 9, s_2_696, -3, 107, 0}, +{ 9, s_2_697, -4, 108, 0}, +{ 7, s_2_698, -5, 114, 0}, +{ 6, s_2_699, -6, 100, 0}, +{ 6, s_2_700, -7, 105, 0}, +{ 5, s_2_701, -8, 113, 0}, +{ 6, s_2_702, -9, 97, 0}, +{ 6, s_2_703, -10, 96, 0}, +{ 6, s_2_704, -11, 98, 0}, +{ 6, s_2_705, -12, 76, 0}, +{ 6, s_2_706, -13, 99, 0}, +{ 7, s_2_707, -14, 102, 0}, +{ 4, s_2_708, 0, 71, 0}, +{ 4, s_2_709, 0, 72, 0}, +{ 6, s_2_710, -1, 124, 0}, +{ 7, s_2_711, -2, 121, 0}, +{ 5, s_2_712, -3, 103, 0}, +{ 7, s_2_713, -4, 127, 0}, +{ 7, s_2_714, -5, 118, 0}, +{ 7, s_2_715, -6, 101, 0}, +{ 8, s_2_716, -7, 117, 0}, +{ 8, s_2_717, -8, 90, 0}, +{ 4, s_2_718, 0, 73, 0}, +{ 4, s_2_719, 0, 74, 0}, +{ 9, s_2_720, -1, 110, 0}, +{ 9, s_2_721, -2, 111, 0}, +{ 9, s_2_722, -3, 112, 0}, +{ 5, s_2_723, 0, 13, 0}, +{ 5, s_2_724, 0, 75, 0}, +{ 3, s_2_725, 0, 77, 0}, +{ 3, s_2_726, 0, 78, 0}, +{ 5, s_2_727, -1, 109, 0}, +{ 6, s_2_728, -1, 26, 0}, +{ 6, s_2_729, -2, 30, 0}, +{ 6, s_2_730, -3, 31, 0}, +{ 7, s_2_731, -4, 28, 0}, +{ 7, s_2_732, -5, 27, 0}, +{ 7, s_2_733, -6, 29, 0}, +{ 3, s_2_734, 0, 79, 0}, +{ 3, s_2_735, 0, 80, 0}, +{ 4, s_2_736, -1, 20, 0}, +{ 5, s_2_737, -1, 17, 0}, +{ 4, s_2_738, -3, 82, 0}, +{ 5, s_2_739, -1, 49, 0}, +{ 4, s_2_740, -5, 81, 0}, +{ 5, s_2_741, -6, 12, 0}, +{ 4, s_2_742, 0, 14, 0}, +{ 4, s_2_743, 0, 15, 0}, +{ 4, s_2_744, 0, 16, 0}, +{ 4, s_2_745, 0, 101, 0}, +{ 5, s_2_746, 0, 117, 0}, +{ 4, s_2_747, 0, 104, 0}, +{ 5, s_2_748, -1, 63, 0}, +{ 5, s_2_749, -2, 64, 0}, +{ 5, s_2_750, -3, 61, 0}, +{ 9, s_2_751, -1, 106, 0}, +{ 9, s_2_752, -2, 107, 0}, +{ 9, s_2_753, -3, 108, 0}, +{ 7, s_2_754, -4, 114, 0}, +{ 5, s_2_755, -8, 62, 0}, +{ 5, s_2_756, -9, 60, 0}, +{ 6, s_2_757, -10, 100, 0}, +{ 6, s_2_758, -11, 105, 0}, +{ 5, s_2_759, -12, 59, 0}, +{ 5, s_2_760, -13, 65, 0}, +{ 6, s_2_761, -1, 97, 0}, +{ 6, s_2_762, -2, 96, 0}, +{ 6, s_2_763, -3, 98, 0}, +{ 6, s_2_764, -4, 76, 0}, +{ 6, s_2_765, -5, 99, 0}, +{ 7, s_2_766, -19, 102, 0}, +{ 4, s_2_767, 0, 66, 0}, +{ 4, s_2_768, 0, 67, 0}, +{ 7, s_2_769, -1, 118, 0}, +{ 7, s_2_770, -2, 101, 0}, +{ 8, s_2_771, -3, 117, 0}, +{ 8, s_2_772, -4, 90, 0}, +{ 4, s_2_773, 0, 91, 0}, +{ 9, s_2_774, -1, 110, 0}, +{ 9, s_2_775, -2, 111, 0}, +{ 9, s_2_776, -3, 112, 0}, +{ 4, s_2_777, 0, 124, 0}, +{ 4, s_2_778, 0, 125, 0}, +{ 4, s_2_779, 0, 126, 0}, +{ 7, s_2_780, 0, 84, 0}, +{ 7, s_2_781, 0, 85, 0}, +{ 7, s_2_782, 0, 122, 0}, +{ 8, s_2_783, 0, 86, 0}, +{ 5, s_2_784, 0, 95, 0}, +{ 6, s_2_785, -1, 1, 0}, +{ 7, s_2_786, -2, 2, 0}, +{ 6, s_2_787, 0, 83, 0}, +{ 5, s_2_788, 0, 13, 0}, +{ 6, s_2_789, 0, 123, 0}, +{ 6, s_2_790, 0, 120, 0}, +{ 8, s_2_791, 0, 92, 0}, +{ 8, s_2_792, 0, 93, 0}, +{ 7, s_2_793, 0, 94, 0}, +{ 6, s_2_794, 0, 77, 0}, +{ 6, s_2_795, 0, 78, 0}, +{ 6, s_2_796, 0, 79, 0}, +{ 6, s_2_797, 0, 80, 0}, +{ 7, s_2_798, 0, 91, 0}, +{ 5, s_2_799, 0, 84, 0}, +{ 5, s_2_800, 0, 85, 0}, +{ 5, s_2_801, 0, 122, 0}, +{ 6, s_2_802, 0, 86, 0}, +{ 3, s_2_803, 0, 95, 0}, +{ 4, s_2_804, 0, 83, 0}, +{ 3, s_2_805, 0, 13, 0}, +{ 4, s_2_806, -1, 10, 0}, +{ 4, s_2_807, -2, 87, 0}, +{ 4, s_2_808, -3, 159, 0}, +{ 5, s_2_809, -4, 88, 0}, +{ 4, s_2_810, 0, 123, 0}, +{ 4, s_2_811, 0, 120, 0}, +{ 4, s_2_812, 0, 77, 0}, +{ 4, s_2_813, 0, 78, 0}, +{ 4, s_2_814, 0, 79, 0}, +{ 4, s_2_815, 0, 80, 0}, +{ 5, s_2_816, 0, 14, 0}, +{ 5, s_2_817, 0, 15, 0}, +{ 5, s_2_818, 0, 16, 0}, +{ 5, s_2_819, 0, 91, 0}, +{ 4, s_2_820, 0, 124, 0}, +{ 4, s_2_821, 0, 125, 0}, +{ 4, s_2_822, 0, 126, 0}, +{ 5, s_2_823, 0, 84, 0}, +{ 5, s_2_824, 0, 85, 0}, +{ 5, s_2_825, 0, 122, 0}, +{ 6, s_2_826, 0, 86, 0}, +{ 3, s_2_827, 0, 95, 0}, +{ 4, s_2_828, -1, 1, 0}, +{ 5, s_2_829, -2, 2, 0}, +{ 4, s_2_830, 0, 83, 0}, +{ 3, s_2_831, 0, 13, 0}, +{ 5, s_2_832, -1, 137, 0}, +{ 6, s_2_833, -2, 89, 0}, +{ 4, s_2_834, 0, 123, 0}, +{ 4, s_2_835, 0, 120, 0}, +{ 6, s_2_836, 0, 92, 0}, +{ 6, s_2_837, 0, 93, 0}, +{ 5, s_2_838, 0, 94, 0}, +{ 4, s_2_839, 0, 77, 0}, +{ 4, s_2_840, 0, 78, 0}, +{ 4, s_2_841, 0, 79, 0}, +{ 4, s_2_842, 0, 80, 0}, +{ 5, s_2_843, 0, 14, 0}, +{ 5, s_2_844, 0, 15, 0}, +{ 5, s_2_845, 0, 16, 0}, +{ 5, s_2_846, 0, 91, 0}, +{ 2, s_2_847, 0, 104, 0}, +{ 4, s_2_848, -1, 128, 0}, +{ 7, s_2_849, -2, 106, 0}, +{ 7, s_2_850, -3, 107, 0}, +{ 7, s_2_851, -4, 108, 0}, +{ 5, s_2_852, -5, 114, 0}, +{ 4, s_2_853, -6, 100, 0}, +{ 4, s_2_854, -7, 105, 0}, +{ 3, s_2_855, -8, 113, 0}, +{ 4, s_2_856, -9, 97, 0}, +{ 4, s_2_857, -10, 96, 0}, +{ 4, s_2_858, -11, 98, 0}, +{ 4, s_2_859, -12, 76, 0}, +{ 4, s_2_860, -13, 99, 0}, +{ 5, s_2_861, -14, 102, 0}, +{ 2, s_2_862, 0, 116, 0}, +{ 4, s_2_863, -1, 124, 0}, +{ 4, s_2_864, -2, 125, 0}, +{ 4, s_2_865, -3, 126, 0}, +{ 5, s_2_866, -1, 121, 0}, +{ 7, s_2_867, -5, 84, 0}, +{ 7, s_2_868, -6, 85, 0}, +{ 7, s_2_869, -7, 122, 0}, +{ 8, s_2_870, -8, 86, 0}, +{ 5, s_2_871, -9, 95, 0}, +{ 6, s_2_872, -1, 1, 0}, +{ 7, s_2_873, -2, 2, 0}, +{ 6, s_2_874, -12, 83, 0}, +{ 5, s_2_875, -13, 13, 0}, +{ 6, s_2_876, -14, 123, 0}, +{ 6, s_2_877, -15, 120, 0}, +{ 8, s_2_878, -16, 92, 0}, +{ 8, s_2_879, -17, 93, 0}, +{ 7, s_2_880, -18, 94, 0}, +{ 6, s_2_881, -19, 77, 0}, +{ 6, s_2_882, -20, 78, 0}, +{ 6, s_2_883, -21, 79, 0}, +{ 6, s_2_884, -22, 80, 0}, +{ 7, s_2_885, -23, 91, 0}, +{ 5, s_2_886, -24, 84, 0}, +{ 5, s_2_887, -25, 85, 0}, +{ 5, s_2_888, -26, 122, 0}, +{ 6, s_2_889, -27, 86, 0}, +{ 3, s_2_890, -28, 95, 0}, +{ 4, s_2_891, -1, 1, 0}, +{ 5, s_2_892, -2, 2, 0}, +{ 4, s_2_893, -31, 83, 0}, +{ 3, s_2_894, -32, 13, 0}, +{ 5, s_2_895, -1, 137, 0}, +{ 6, s_2_896, -2, 89, 0}, +{ 4, s_2_897, -35, 123, 0}, +{ 5, s_2_898, -1, 127, 0}, +{ 4, s_2_899, -37, 120, 0}, +{ 5, s_2_900, -38, 118, 0}, +{ 6, s_2_901, -39, 92, 0}, +{ 6, s_2_902, -40, 93, 0}, +{ 5, s_2_903, -41, 94, 0}, +{ 4, s_2_904, -42, 77, 0}, +{ 4, s_2_905, -43, 78, 0}, +{ 4, s_2_906, -44, 79, 0}, +{ 4, s_2_907, -45, 80, 0}, +{ 5, s_2_908, -46, 14, 0}, +{ 5, s_2_909, -47, 15, 0}, +{ 5, s_2_910, -48, 16, 0}, +{ 5, s_2_911, -49, 101, 0}, +{ 6, s_2_912, -50, 117, 0}, +{ 5, s_2_913, -51, 91, 0}, +{ 6, s_2_914, -1, 90, 0}, +{ 7, s_2_915, 0, 110, 0}, +{ 7, s_2_916, 0, 111, 0}, +{ 7, s_2_917, 0, 112, 0}, +{ 4, s_2_918, 0, 124, 0}, +{ 4, s_2_919, 0, 125, 0}, +{ 4, s_2_920, 0, 126, 0}, +{ 5, s_2_921, 0, 14, 0}, +{ 5, s_2_922, 0, 15, 0}, +{ 5, s_2_923, 0, 16, 0}, +{ 3, s_2_924, 0, 124, 0}, +{ 5, s_2_925, 0, 124, 0}, +{ 4, s_2_926, 0, 162, 0}, +{ 5, s_2_927, 0, 161, 0}, +{ 7, s_2_928, -1, 155, 0}, +{ 7, s_2_929, -2, 156, 0}, +{ 8, s_2_930, -3, 138, 0}, +{ 8, s_2_931, -4, 139, 0}, +{ 8, s_2_932, -5, 140, 0}, +{ 7, s_2_933, -6, 144, 0}, +{ 7, s_2_934, -7, 145, 0}, +{ 7, s_2_935, -8, 146, 0}, +{ 7, s_2_936, -9, 147, 0}, +{ 5, s_2_937, 0, 157, 0}, +{ 8, s_2_938, -1, 121, 0}, +{ 7, s_2_939, -2, 155, 0}, +{ 4, s_2_940, 0, 121, 0}, +{ 4, s_2_941, 0, 164, 0}, +{ 5, s_2_942, 0, 153, 0}, +{ 6, s_2_943, 0, 136, 0}, +{ 2, s_2_944, 0, 20, 0}, +{ 3, s_2_945, -1, 18, 0}, +{ 3, s_2_946, 0, 109, 0}, +{ 4, s_2_947, -1, 26, 0}, +{ 4, s_2_948, -2, 30, 0}, +{ 4, s_2_949, -3, 31, 0}, +{ 5, s_2_950, -4, 28, 0}, +{ 5, s_2_951, -5, 27, 0}, +{ 5, s_2_952, -6, 29, 0}, +{ 4, s_2_953, 0, 32, 0}, +{ 4, s_2_954, 0, 33, 0}, +{ 4, s_2_955, 0, 34, 0}, +{ 4, s_2_956, 0, 40, 0}, +{ 4, s_2_957, 0, 39, 0}, +{ 6, s_2_958, 0, 84, 0}, +{ 6, s_2_959, 0, 85, 0}, +{ 6, s_2_960, 0, 122, 0}, +{ 7, s_2_961, 0, 86, 0}, +{ 4, s_2_962, 0, 95, 0}, +{ 5, s_2_963, -1, 1, 0}, +{ 6, s_2_964, -2, 2, 0}, +{ 4, s_2_965, 0, 35, 0}, +{ 5, s_2_966, -1, 83, 0}, +{ 4, s_2_967, 0, 37, 0}, +{ 4, s_2_968, 0, 13, 0}, +{ 6, s_2_969, -1, 9, 0}, +{ 6, s_2_970, -2, 6, 0}, +{ 6, s_2_971, -3, 7, 0}, +{ 6, s_2_972, -4, 8, 0}, +{ 6, s_2_973, -5, 5, 0}, +{ 4, s_2_974, 0, 41, 0}, +{ 4, s_2_975, 0, 42, 0}, +{ 4, s_2_976, 0, 43, 0}, +{ 5, s_2_977, -1, 123, 0}, +{ 4, s_2_978, 0, 44, 0}, +{ 5, s_2_979, -1, 120, 0}, +{ 7, s_2_980, -2, 92, 0}, +{ 7, s_2_981, -3, 93, 0}, +{ 6, s_2_982, -4, 94, 0}, +{ 5, s_2_983, 0, 77, 0}, +{ 5, s_2_984, 0, 78, 0}, +{ 5, s_2_985, 0, 79, 0}, +{ 5, s_2_986, 0, 80, 0}, +{ 4, s_2_987, 0, 45, 0}, +{ 6, s_2_988, 0, 91, 0}, +{ 5, s_2_989, 0, 38, 0}, +{ 4, s_2_990, 0, 84, 0}, +{ 4, s_2_991, 0, 85, 0}, +{ 4, s_2_992, 0, 122, 0}, +{ 5, s_2_993, 0, 86, 0}, +{ 2, s_2_994, 0, 95, 0}, +{ 3, s_2_995, -1, 1, 0}, +{ 4, s_2_996, -2, 2, 0}, +{ 3, s_2_997, 0, 104, 0}, +{ 5, s_2_998, -1, 128, 0}, +{ 8, s_2_999, -2, 106, 0}, +{ 8, s_2_1000, -3, 107, 0}, +{ 8, s_2_1001, -4, 108, 0}, +{ 5, s_2_1002, -5, 47, 0}, +{ 6, s_2_1003, -6, 114, 0}, +{ 4, s_2_1004, -7, 46, 0}, +{ 5, s_2_1005, -8, 100, 0}, +{ 5, s_2_1006, -9, 105, 0}, +{ 4, s_2_1007, -10, 113, 0}, +{ 6, s_2_1008, -1, 110, 0}, +{ 6, s_2_1009, -2, 111, 0}, +{ 6, s_2_1010, -3, 112, 0}, +{ 5, s_2_1011, -14, 97, 0}, +{ 5, s_2_1012, -15, 96, 0}, +{ 5, s_2_1013, -16, 98, 0}, +{ 5, s_2_1014, -17, 76, 0}, +{ 5, s_2_1015, -18, 99, 0}, +{ 6, s_2_1016, -19, 102, 0}, +{ 3, s_2_1017, 0, 83, 0}, +{ 3, s_2_1018, 0, 116, 0}, +{ 5, s_2_1019, -1, 124, 0}, +{ 6, s_2_1020, -2, 121, 0}, +{ 4, s_2_1021, -3, 103, 0}, +{ 6, s_2_1022, -4, 127, 0}, +{ 6, s_2_1023, -5, 118, 0}, +{ 5, s_2_1024, -6, 48, 0}, +{ 6, s_2_1025, -7, 101, 0}, +{ 7, s_2_1026, -8, 117, 0}, +{ 7, s_2_1027, -9, 90, 0}, +{ 3, s_2_1028, 0, 50, 0}, +{ 4, s_2_1029, 0, 115, 0}, +{ 4, s_2_1030, 0, 13, 0}, +{ 4, s_2_1031, 0, 52, 0}, +{ 4, s_2_1032, 0, 51, 0}, +{ 2, s_2_1033, 0, 13, 0}, +{ 3, s_2_1034, -1, 10, 0}, +{ 5, s_2_1035, -1, 128, 0}, +{ 5, s_2_1036, -2, 105, 0}, +{ 4, s_2_1037, -3, 113, 0}, +{ 5, s_2_1038, -4, 97, 0}, +{ 5, s_2_1039, -5, 96, 0}, +{ 5, s_2_1040, -6, 98, 0}, +{ 5, s_2_1041, -7, 99, 0}, +{ 6, s_2_1042, -8, 102, 0}, +{ 5, s_2_1043, -10, 124, 0}, +{ 6, s_2_1044, -11, 121, 0}, +{ 6, s_2_1045, -12, 101, 0}, +{ 7, s_2_1046, -13, 117, 0}, +{ 3, s_2_1047, -14, 11, 0}, +{ 4, s_2_1048, -1, 137, 0}, +{ 5, s_2_1049, -2, 89, 0}, +{ 3, s_2_1050, -17, 12, 0}, +{ 3, s_2_1051, 0, 53, 0}, +{ 3, s_2_1052, 0, 54, 0}, +{ 3, s_2_1053, 0, 55, 0}, +{ 3, s_2_1054, 0, 56, 0}, +{ 4, s_2_1055, 0, 135, 0}, +{ 4, s_2_1056, 0, 131, 0}, +{ 4, s_2_1057, 0, 129, 0}, +{ 4, s_2_1058, 0, 133, 0}, +{ 4, s_2_1059, 0, 132, 0}, +{ 4, s_2_1060, 0, 130, 0}, +{ 4, s_2_1061, 0, 134, 0}, +{ 3, s_2_1062, 0, 152, 0}, +{ 3, s_2_1063, 0, 154, 0}, +{ 3, s_2_1064, 0, 123, 0}, +{ 4, s_2_1065, 0, 161, 0}, +{ 6, s_2_1066, -1, 128, 0}, +{ 6, s_2_1067, -2, 155, 0}, +{ 5, s_2_1068, -3, 160, 0}, +{ 6, s_2_1069, -1, 153, 0}, +{ 7, s_2_1070, -2, 141, 0}, +{ 7, s_2_1071, -3, 142, 0}, +{ 7, s_2_1072, -4, 143, 0}, +{ 4, s_2_1073, 0, 162, 0}, +{ 5, s_2_1074, -1, 158, 0}, +{ 7, s_2_1075, -2, 127, 0}, +{ 5, s_2_1076, 0, 164, 0}, +{ 3, s_2_1077, 0, 104, 0}, +{ 5, s_2_1078, -1, 128, 0}, +{ 8, s_2_1079, -2, 106, 0}, +{ 8, s_2_1080, -3, 107, 0}, +{ 8, s_2_1081, -4, 108, 0}, +{ 6, s_2_1082, -5, 114, 0}, +{ 5, s_2_1083, -6, 68, 0}, +{ 4, s_2_1084, -7, 69, 0}, +{ 5, s_2_1085, -8, 100, 0}, +{ 5, s_2_1086, -9, 105, 0}, +{ 4, s_2_1087, -10, 113, 0}, +{ 6, s_2_1088, -1, 110, 0}, +{ 6, s_2_1089, -2, 111, 0}, +{ 6, s_2_1090, -3, 112, 0}, +{ 5, s_2_1091, -14, 97, 0}, +{ 5, s_2_1092, -15, 96, 0}, +{ 5, s_2_1093, -16, 98, 0}, +{ 5, s_2_1094, -17, 76, 0}, +{ 5, s_2_1095, -18, 99, 0}, +{ 6, s_2_1096, -19, 102, 0}, +{ 3, s_2_1097, 0, 70, 0}, +{ 3, s_2_1098, 0, 116, 0}, +{ 5, s_2_1099, -1, 124, 0}, +{ 6, s_2_1100, -2, 121, 0}, +{ 4, s_2_1101, -3, 103, 0}, +{ 6, s_2_1102, -4, 127, 0}, +{ 6, s_2_1103, -5, 118, 0}, +{ 5, s_2_1104, -6, 92, 0}, +{ 5, s_2_1105, -7, 93, 0}, +{ 6, s_2_1106, -8, 101, 0}, +{ 7, s_2_1107, -9, 117, 0}, +{ 7, s_2_1108, -10, 90, 0}, +{ 4, s_2_1109, 0, 94, 0}, +{ 4, s_2_1110, 0, 71, 0}, +{ 4, s_2_1111, 0, 72, 0}, +{ 4, s_2_1112, 0, 73, 0}, +{ 4, s_2_1113, 0, 74, 0}, +{ 4, s_2_1114, 0, 13, 0}, +{ 3, s_2_1115, 0, 77, 0}, +{ 3, s_2_1116, 0, 78, 0}, +{ 5, s_2_1117, -1, 109, 0}, +{ 6, s_2_1118, -1, 26, 0}, +{ 6, s_2_1119, -2, 30, 0}, +{ 6, s_2_1120, -3, 31, 0}, +{ 7, s_2_1121, -4, 28, 0}, +{ 7, s_2_1122, -5, 27, 0}, +{ 7, s_2_1123, -6, 29, 0}, +{ 3, s_2_1124, 0, 79, 0}, +{ 3, s_2_1125, 0, 80, 0}, +{ 4, s_2_1126, -1, 20, 0}, +{ 5, s_2_1127, -1, 17, 0}, +{ 4, s_2_1128, -3, 82, 0}, +{ 5, s_2_1129, -1, 49, 0}, +{ 4, s_2_1130, -5, 81, 0}, +{ 5, s_2_1131, -6, 12, 0}, +{ 5, s_2_1132, 0, 116, 0}, +{ 7, s_2_1133, 0, 101, 0}, +{ 6, s_2_1134, 0, 104, 0}, +{ 8, s_2_1135, -1, 100, 0}, +{ 8, s_2_1136, -2, 105, 0}, +{ 9, s_2_1137, -3, 106, 0}, +{ 9, s_2_1138, -4, 107, 0}, +{ 9, s_2_1139, -5, 108, 0}, +{ 8, s_2_1140, -6, 97, 0}, +{ 8, s_2_1141, -7, 96, 0}, +{ 8, s_2_1142, -8, 98, 0}, +{ 8, s_2_1143, -9, 99, 0}, +{ 6, s_2_1144, 0, 25, 0}, +{ 8, s_2_1145, -1, 100, 0}, +{ 10, s_2_1146, -2, 117, 0}, +{ 5, s_2_1147, 0, 13, 0}, +{ 6, s_2_1148, 0, 70, 0}, +{ 7, s_2_1149, 0, 115, 0}, +{ 4, s_2_1150, 0, 101, 0}, +{ 5, s_2_1151, 0, 117, 0}, +{ 5, s_2_1152, 0, 63, 0}, +{ 5, s_2_1153, 0, 64, 0}, +{ 5, s_2_1154, 0, 61, 0}, +{ 5, s_2_1155, 0, 62, 0}, +{ 5, s_2_1156, 0, 60, 0}, +{ 5, s_2_1157, 0, 59, 0}, +{ 5, s_2_1158, 0, 65, 0}, +{ 4, s_2_1159, 0, 66, 0}, +{ 4, s_2_1160, 0, 67, 0}, +{ 4, s_2_1161, 0, 91, 0}, +{ 5, s_2_1162, 0, 104, 0}, +{ 7, s_2_1163, -1, 100, 0}, +{ 6, s_2_1164, -2, 113, 0}, +{ 7, s_2_1165, -1, 70, 0}, +{ 8, s_2_1166, -2, 110, 0}, +{ 8, s_2_1167, -3, 111, 0}, +{ 8, s_2_1168, -4, 112, 0}, +{ 8, s_2_1169, -7, 102, 0}, +{ 5, s_2_1170, 0, 116, 0}, +{ 6, s_2_1171, -1, 103, 0}, +{ 9, s_2_1172, -2, 90, 0}, +{ 6, s_2_1173, 0, 13, 0}, +{ 2, s_2_1174, 0, 104, 0}, +{ 4, s_2_1175, -1, 105, 0}, +{ 3, s_2_1176, -2, 113, 0}, +{ 4, s_2_1177, -3, 97, 0}, +{ 4, s_2_1178, -4, 96, 0}, +{ 4, s_2_1179, -5, 98, 0}, +{ 4, s_2_1180, -6, 99, 0}, +{ 2, s_2_1181, 0, 116, 0}, +{ 4, s_2_1182, 0, 124, 0}, +{ 4, s_2_1183, 0, 125, 0}, +{ 4, s_2_1184, 0, 126, 0}, +{ 7, s_2_1185, 0, 84, 0}, +{ 7, s_2_1186, 0, 85, 0}, +{ 7, s_2_1187, 0, 122, 0}, +{ 8, s_2_1188, 0, 86, 0}, +{ 5, s_2_1189, 0, 95, 0}, +{ 6, s_2_1190, -1, 1, 0}, +{ 7, s_2_1191, -2, 2, 0}, +{ 6, s_2_1192, 0, 83, 0}, +{ 5, s_2_1193, 0, 13, 0}, +{ 6, s_2_1194, 0, 123, 0}, +{ 8, s_2_1195, 0, 92, 0}, +{ 8, s_2_1196, 0, 93, 0}, +{ 7, s_2_1197, 0, 94, 0}, +{ 6, s_2_1198, 0, 77, 0}, +{ 6, s_2_1199, 0, 78, 0}, +{ 6, s_2_1200, 0, 79, 0}, +{ 6, s_2_1201, 0, 80, 0}, +{ 7, s_2_1202, 0, 91, 0}, +{ 5, s_2_1203, 0, 84, 0}, +{ 5, s_2_1204, 0, 85, 0}, +{ 5, s_2_1205, 0, 122, 0}, +{ 6, s_2_1206, 0, 86, 0}, +{ 3, s_2_1207, 0, 95, 0}, +{ 4, s_2_1208, -1, 1, 0}, +{ 5, s_2_1209, -2, 2, 0}, +{ 4, s_2_1210, 0, 104, 0}, +{ 4, s_2_1211, 0, 83, 0}, +{ 3, s_2_1212, 0, 13, 0}, +{ 5, s_2_1213, -1, 137, 0}, +{ 6, s_2_1214, -2, 89, 0}, +{ 4, s_2_1215, 0, 123, 0}, +{ 4, s_2_1216, 0, 120, 0}, +{ 6, s_2_1217, 0, 92, 0}, +{ 6, s_2_1218, 0, 93, 0}, +{ 5, s_2_1219, 0, 94, 0}, +{ 4, s_2_1220, 0, 77, 0}, +{ 4, s_2_1221, 0, 78, 0}, +{ 4, s_2_1222, 0, 79, 0}, +{ 4, s_2_1223, 0, 80, 0}, +{ 5, s_2_1224, 0, 14, 0}, +{ 5, s_2_1225, 0, 15, 0}, +{ 5, s_2_1226, 0, 16, 0}, +{ 5, s_2_1227, 0, 91, 0}, +{ 5, s_2_1228, 0, 121, 0}, +{ 4, s_2_1229, 0, 100, 0}, +{ 6, s_2_1230, 0, 117, 0}, +{ 2, s_2_1231, 0, 104, 0}, +{ 4, s_2_1232, -1, 100, 0}, +{ 4, s_2_1233, -2, 105, 0}, +{ 2, s_2_1234, 0, 119, 0}, +{ 2, s_2_1235, 0, 116, 0}, +{ 2, s_2_1236, 0, 104, 0}, +{ 4, s_2_1237, -1, 128, 0}, +{ 4, s_2_1238, -2, 100, 0}, +{ 4, s_2_1239, -3, 105, 0}, +{ 3, s_2_1240, -4, 113, 0}, +{ 4, s_2_1241, -5, 97, 0}, +{ 4, s_2_1242, -6, 96, 0}, +{ 4, s_2_1243, -7, 98, 0}, +{ 4, s_2_1244, -8, 99, 0}, +{ 5, s_2_1245, -9, 102, 0}, +{ 2, s_2_1246, 0, 119, 0}, +{ 4, s_2_1247, -1, 124, 0}, +{ 4, s_2_1248, -2, 125, 0}, +{ 4, s_2_1249, -3, 126, 0}, +{ 7, s_2_1250, -4, 110, 0}, +{ 7, s_2_1251, -5, 111, 0}, +{ 7, s_2_1252, -6, 112, 0}, +{ 4, s_2_1253, -7, 104, 0}, +{ 5, s_2_1254, -1, 26, 0}, +{ 5, s_2_1255, -2, 30, 0}, +{ 5, s_2_1256, -3, 31, 0}, +{ 7, s_2_1257, -4, 106, 0}, +{ 7, s_2_1258, -5, 107, 0}, +{ 7, s_2_1259, -6, 108, 0}, +{ 6, s_2_1260, -7, 28, 0}, +{ 6, s_2_1261, -8, 27, 0}, +{ 6, s_2_1262, -9, 29, 0}, +{ 4, s_2_1263, -17, 116, 0}, +{ 7, s_2_1264, -1, 84, 0}, +{ 7, s_2_1265, -2, 85, 0}, +{ 7, s_2_1266, -3, 123, 0}, +{ 8, s_2_1267, -4, 86, 0}, +{ 5, s_2_1268, -5, 95, 0}, +{ 6, s_2_1269, -1, 1, 0}, +{ 7, s_2_1270, -2, 2, 0}, +{ 5, s_2_1271, -8, 24, 0}, +{ 6, s_2_1272, -1, 83, 0}, +{ 5, s_2_1273, -10, 13, 0}, +{ 7, s_2_1274, -11, 21, 0}, +{ 5, s_2_1275, -12, 23, 0}, +{ 6, s_2_1276, -1, 123, 0}, +{ 6, s_2_1277, -14, 120, 0}, +{ 8, s_2_1278, -15, 92, 0}, +{ 8, s_2_1279, -16, 93, 0}, +{ 6, s_2_1280, -17, 22, 0}, +{ 7, s_2_1281, -18, 94, 0}, +{ 6, s_2_1282, -19, 77, 0}, +{ 6, s_2_1283, -20, 78, 0}, +{ 6, s_2_1284, -21, 79, 0}, +{ 6, s_2_1285, -22, 80, 0}, +{ 7, s_2_1286, -23, 91, 0}, +{ 5, s_2_1287, -41, 84, 0}, +{ 5, s_2_1288, -42, 85, 0}, +{ 5, s_2_1289, -43, 114, 0}, +{ 5, s_2_1290, -44, 122, 0}, +{ 6, s_2_1291, -45, 86, 0}, +{ 4, s_2_1292, -46, 25, 0}, +{ 7, s_2_1293, -1, 121, 0}, +{ 6, s_2_1294, -2, 100, 0}, +{ 8, s_2_1295, -3, 117, 0}, +{ 3, s_2_1296, -50, 95, 0}, +{ 4, s_2_1297, -1, 1, 0}, +{ 5, s_2_1298, -2, 2, 0}, +{ 4, s_2_1299, -53, 83, 0}, +{ 3, s_2_1300, -54, 13, 0}, +{ 4, s_2_1301, -1, 10, 0}, +{ 7, s_2_1302, -1, 110, 0}, +{ 7, s_2_1303, -2, 111, 0}, +{ 7, s_2_1304, -3, 112, 0}, +{ 4, s_2_1305, -5, 87, 0}, +{ 4, s_2_1306, -6, 159, 0}, +{ 5, s_2_1307, -7, 88, 0}, +{ 5, s_2_1308, -62, 135, 0}, +{ 5, s_2_1309, -63, 131, 0}, +{ 5, s_2_1310, -64, 129, 0}, +{ 5, s_2_1311, -65, 133, 0}, +{ 5, s_2_1312, -66, 132, 0}, +{ 5, s_2_1313, -67, 130, 0}, +{ 5, s_2_1314, -68, 134, 0}, +{ 4, s_2_1315, -69, 152, 0}, +{ 4, s_2_1316, -70, 154, 0}, +{ 4, s_2_1317, -71, 123, 0}, +{ 4, s_2_1318, -72, 120, 0}, +{ 4, s_2_1319, -73, 70, 0}, +{ 6, s_2_1320, -74, 92, 0}, +{ 6, s_2_1321, -75, 93, 0}, +{ 5, s_2_1322, -76, 94, 0}, +{ 5, s_2_1323, -77, 151, 0}, +{ 6, s_2_1324, -78, 75, 0}, +{ 4, s_2_1325, -79, 77, 0}, +{ 4, s_2_1326, -80, 78, 0}, +{ 4, s_2_1327, -81, 79, 0}, +{ 5, s_2_1328, -82, 14, 0}, +{ 5, s_2_1329, -83, 15, 0}, +{ 5, s_2_1330, -84, 16, 0}, +{ 6, s_2_1331, -85, 63, 0}, +{ 6, s_2_1332, -86, 64, 0}, +{ 6, s_2_1333, -87, 61, 0}, +{ 6, s_2_1334, -88, 62, 0}, +{ 6, s_2_1335, -89, 60, 0}, +{ 6, s_2_1336, -90, 59, 0}, +{ 6, s_2_1337, -91, 65, 0}, +{ 5, s_2_1338, -92, 66, 0}, +{ 5, s_2_1339, -93, 67, 0}, +{ 5, s_2_1340, -94, 91, 0}, +{ 2, s_2_1341, 0, 116, 0}, +{ 4, s_2_1342, -1, 124, 0}, +{ 4, s_2_1343, -2, 125, 0}, +{ 4, s_2_1344, -3, 126, 0}, +{ 5, s_2_1345, -1, 121, 0}, +{ 7, s_2_1346, -5, 84, 0}, +{ 7, s_2_1347, -6, 85, 0}, +{ 7, s_2_1348, -7, 122, 0}, +{ 8, s_2_1349, -8, 86, 0}, +{ 5, s_2_1350, -9, 95, 0}, +{ 6, s_2_1351, -1, 1, 0}, +{ 7, s_2_1352, -2, 2, 0}, +{ 6, s_2_1353, -12, 83, 0}, +{ 5, s_2_1354, -13, 13, 0}, +{ 6, s_2_1355, -14, 123, 0}, +{ 6, s_2_1356, -15, 120, 0}, +{ 8, s_2_1357, -16, 92, 0}, +{ 8, s_2_1358, -17, 93, 0}, +{ 7, s_2_1359, -18, 94, 0}, +{ 6, s_2_1360, -19, 77, 0}, +{ 6, s_2_1361, -20, 78, 0}, +{ 6, s_2_1362, -21, 79, 0}, +{ 6, s_2_1363, -22, 80, 0}, +{ 7, s_2_1364, -23, 91, 0}, +{ 5, s_2_1365, -24, 84, 0}, +{ 5, s_2_1366, -25, 85, 0}, +{ 5, s_2_1367, -26, 122, 0}, +{ 6, s_2_1368, -27, 86, 0}, +{ 3, s_2_1369, -28, 95, 0}, +{ 4, s_2_1370, -1, 1, 0}, +{ 5, s_2_1371, -2, 2, 0}, +{ 4, s_2_1372, -31, 83, 0}, +{ 3, s_2_1373, -32, 13, 0}, +{ 5, s_2_1374, -1, 137, 0}, +{ 6, s_2_1375, -2, 89, 0}, +{ 4, s_2_1376, -35, 123, 0}, +{ 5, s_2_1377, -1, 127, 0}, +{ 4, s_2_1378, -37, 120, 0}, +{ 5, s_2_1379, -38, 118, 0}, +{ 6, s_2_1380, -39, 92, 0}, +{ 6, s_2_1381, -40, 93, 0}, +{ 5, s_2_1382, -41, 94, 0}, +{ 4, s_2_1383, -42, 77, 0}, +{ 4, s_2_1384, -43, 78, 0}, +{ 4, s_2_1385, -44, 79, 0}, +{ 4, s_2_1386, -45, 80, 0}, +{ 5, s_2_1387, -46, 14, 0}, +{ 5, s_2_1388, -47, 15, 0}, +{ 5, s_2_1389, -48, 16, 0}, +{ 5, s_2_1390, -49, 101, 0}, +{ 6, s_2_1391, -50, 117, 0}, +{ 5, s_2_1392, -51, 91, 0}, +{ 6, s_2_1393, -1, 90, 0}, +{ 4, s_2_1394, 0, 124, 0}, +{ 4, s_2_1395, 0, 125, 0}, +{ 4, s_2_1396, 0, 126, 0}, +{ 3, s_2_1397, 0, 20, 0}, +{ 5, s_2_1398, -1, 19, 0}, +{ 4, s_2_1399, -2, 18, 0}, +{ 5, s_2_1400, 0, 32, 0}, +{ 5, s_2_1401, 0, 33, 0}, +{ 5, s_2_1402, 0, 34, 0}, +{ 5, s_2_1403, 0, 40, 0}, +{ 5, s_2_1404, 0, 39, 0}, +{ 5, s_2_1405, 0, 35, 0}, +{ 5, s_2_1406, 0, 37, 0}, +{ 5, s_2_1407, 0, 36, 0}, +{ 7, s_2_1408, -1, 9, 0}, +{ 7, s_2_1409, -2, 6, 0}, +{ 7, s_2_1410, -3, 7, 0}, +{ 7, s_2_1411, -4, 8, 0}, +{ 7, s_2_1412, -5, 5, 0}, +{ 5, s_2_1413, 0, 41, 0}, +{ 5, s_2_1414, 0, 42, 0}, +{ 5, s_2_1415, 0, 43, 0}, +{ 5, s_2_1416, 0, 44, 0}, +{ 5, s_2_1417, 0, 45, 0}, +{ 6, s_2_1418, 0, 38, 0}, +{ 5, s_2_1419, 0, 84, 0}, +{ 5, s_2_1420, 0, 85, 0}, +{ 5, s_2_1421, 0, 122, 0}, +{ 6, s_2_1422, 0, 86, 0}, +{ 3, s_2_1423, 0, 95, 0}, +{ 4, s_2_1424, -1, 1, 0}, +{ 5, s_2_1425, -2, 2, 0}, +{ 4, s_2_1426, 0, 104, 0}, +{ 6, s_2_1427, -1, 47, 0}, +{ 5, s_2_1428, -2, 46, 0}, +{ 4, s_2_1429, 0, 83, 0}, +{ 4, s_2_1430, 0, 116, 0}, +{ 6, s_2_1431, -1, 48, 0}, +{ 4, s_2_1432, 0, 50, 0}, +{ 5, s_2_1433, 0, 52, 0}, +{ 5, s_2_1434, 0, 51, 0}, +{ 3, s_2_1435, 0, 13, 0}, +{ 4, s_2_1436, -1, 10, 0}, +{ 4, s_2_1437, -2, 11, 0}, +{ 5, s_2_1438, -1, 137, 0}, +{ 6, s_2_1439, -2, 10, 0}, +{ 6, s_2_1440, -3, 89, 0}, +{ 4, s_2_1441, -6, 12, 0}, +{ 4, s_2_1442, 0, 53, 0}, +{ 4, s_2_1443, 0, 54, 0}, +{ 4, s_2_1444, 0, 55, 0}, +{ 4, s_2_1445, 0, 56, 0}, +{ 5, s_2_1446, 0, 135, 0}, +{ 5, s_2_1447, 0, 131, 0}, +{ 5, s_2_1448, 0, 129, 0}, +{ 5, s_2_1449, 0, 133, 0}, +{ 5, s_2_1450, 0, 132, 0}, +{ 5, s_2_1451, 0, 130, 0}, +{ 5, s_2_1452, 0, 134, 0}, +{ 4, s_2_1453, 0, 57, 0}, +{ 4, s_2_1454, 0, 58, 0}, +{ 4, s_2_1455, 0, 123, 0}, +{ 4, s_2_1456, 0, 120, 0}, +{ 6, s_2_1457, -1, 68, 0}, +{ 5, s_2_1458, -2, 69, 0}, +{ 4, s_2_1459, 0, 70, 0}, +{ 6, s_2_1460, 0, 92, 0}, +{ 6, s_2_1461, 0, 93, 0}, +{ 5, s_2_1462, 0, 94, 0}, +{ 5, s_2_1463, 0, 71, 0}, +{ 5, s_2_1464, 0, 72, 0}, +{ 5, s_2_1465, 0, 73, 0}, +{ 5, s_2_1466, 0, 74, 0}, +{ 4, s_2_1467, 0, 77, 0}, +{ 4, s_2_1468, 0, 78, 0}, +{ 4, s_2_1469, 0, 79, 0}, +{ 4, s_2_1470, 0, 80, 0}, +{ 5, s_2_1471, -1, 82, 0}, +{ 5, s_2_1472, -2, 81, 0}, +{ 5, s_2_1473, 0, 3, 0}, +{ 6, s_2_1474, 0, 4, 0}, +{ 5, s_2_1475, 0, 14, 0}, +{ 5, s_2_1476, 0, 15, 0}, +{ 5, s_2_1477, 0, 16, 0}, +{ 6, s_2_1478, 0, 63, 0}, +{ 6, s_2_1479, 0, 64, 0}, +{ 6, s_2_1480, 0, 61, 0}, +{ 6, s_2_1481, 0, 62, 0}, +{ 6, s_2_1482, 0, 60, 0}, +{ 6, s_2_1483, 0, 59, 0}, +{ 6, s_2_1484, 0, 65, 0}, +{ 5, s_2_1485, 0, 66, 0}, +{ 5, s_2_1486, 0, 67, 0}, +{ 5, s_2_1487, 0, 91, 0}, +{ 2, s_2_1488, 0, 104, 0}, +{ 4, s_2_1489, -1, 128, 0}, +{ 4, s_2_1490, -2, 100, 0}, +{ 4, s_2_1491, -3, 105, 0}, +{ 3, s_2_1492, -4, 113, 0}, +{ 4, s_2_1493, -5, 97, 0}, +{ 4, s_2_1494, -6, 96, 0}, +{ 4, s_2_1495, -7, 98, 0}, +{ 4, s_2_1496, -8, 99, 0}, +{ 5, s_2_1497, -9, 102, 0}, +{ 4, s_2_1498, 0, 124, 0}, +{ 5, s_2_1499, 0, 121, 0}, +{ 5, s_2_1500, 0, 101, 0}, +{ 6, s_2_1501, 0, 117, 0}, +{ 4, s_2_1502, 0, 10, 0}, +{ 2, s_2_1503, 0, 104, 0}, +{ 4, s_2_1504, -1, 128, 0}, +{ 7, s_2_1505, -2, 106, 0}, +{ 7, s_2_1506, -3, 107, 0}, +{ 7, s_2_1507, -4, 108, 0}, +{ 5, s_2_1508, -5, 114, 0}, +{ 4, s_2_1509, -6, 100, 0}, +{ 4, s_2_1510, -7, 105, 0}, +{ 3, s_2_1511, -8, 113, 0}, +{ 5, s_2_1512, -1, 110, 0}, +{ 5, s_2_1513, -2, 111, 0}, +{ 5, s_2_1514, -3, 112, 0}, +{ 4, s_2_1515, -12, 97, 0}, +{ 4, s_2_1516, -13, 96, 0}, +{ 4, s_2_1517, -14, 98, 0}, +{ 4, s_2_1518, -15, 76, 0}, +{ 4, s_2_1519, -16, 99, 0}, +{ 5, s_2_1520, -17, 102, 0}, +{ 2, s_2_1521, 0, 20, 0}, +{ 3, s_2_1522, -1, 18, 0}, +{ 2, s_2_1523, 0, 116, 0}, +{ 4, s_2_1524, -1, 124, 0}, +{ 5, s_2_1525, -2, 121, 0}, +{ 3, s_2_1526, -3, 24, 0}, +{ 3, s_2_1527, -4, 103, 0}, +{ 5, s_2_1528, -5, 21, 0}, +{ 3, s_2_1529, -6, 23, 0}, +{ 5, s_2_1530, -1, 127, 0}, +{ 5, s_2_1531, -8, 118, 0}, +{ 4, s_2_1532, -9, 22, 0}, +{ 5, s_2_1533, -10, 101, 0}, +{ 6, s_2_1534, -11, 117, 0}, +{ 6, s_2_1535, -12, 90, 0}, +{ 4, s_2_1536, 0, 32, 0}, +{ 4, s_2_1537, 0, 33, 0}, +{ 4, s_2_1538, 0, 34, 0}, +{ 4, s_2_1539, 0, 40, 0}, +{ 4, s_2_1540, 0, 39, 0}, +{ 4, s_2_1541, 0, 35, 0}, +{ 4, s_2_1542, 0, 37, 0}, +{ 4, s_2_1543, 0, 36, 0}, +{ 4, s_2_1544, 0, 41, 0}, +{ 4, s_2_1545, 0, 42, 0}, +{ 4, s_2_1546, 0, 43, 0}, +{ 4, s_2_1547, 0, 44, 0}, +{ 4, s_2_1548, 0, 45, 0}, +{ 5, s_2_1549, 0, 38, 0}, +{ 4, s_2_1550, 0, 84, 0}, +{ 4, s_2_1551, 0, 85, 0}, +{ 4, s_2_1552, 0, 122, 0}, +{ 5, s_2_1553, 0, 86, 0}, +{ 2, s_2_1554, 0, 95, 0}, +{ 3, s_2_1555, -1, 1, 0}, +{ 4, s_2_1556, -2, 2, 0}, +{ 3, s_2_1557, 0, 104, 0}, +{ 5, s_2_1558, -1, 128, 0}, +{ 8, s_2_1559, -2, 106, 0}, +{ 8, s_2_1560, -3, 107, 0}, +{ 8, s_2_1561, -4, 108, 0}, +{ 5, s_2_1562, -5, 47, 0}, +{ 6, s_2_1563, -6, 114, 0}, +{ 4, s_2_1564, -7, 46, 0}, +{ 5, s_2_1565, -8, 100, 0}, +{ 5, s_2_1566, -9, 105, 0}, +{ 4, s_2_1567, -10, 113, 0}, +{ 6, s_2_1568, -1, 110, 0}, +{ 6, s_2_1569, -2, 111, 0}, +{ 6, s_2_1570, -3, 112, 0}, +{ 5, s_2_1571, -14, 97, 0}, +{ 5, s_2_1572, -15, 96, 0}, +{ 5, s_2_1573, -16, 98, 0}, +{ 5, s_2_1574, -17, 76, 0}, +{ 5, s_2_1575, -18, 99, 0}, +{ 6, s_2_1576, -19, 102, 0}, +{ 3, s_2_1577, 0, 83, 0}, +{ 3, s_2_1578, 0, 116, 0}, +{ 5, s_2_1579, -1, 124, 0}, +{ 6, s_2_1580, -2, 121, 0}, +{ 4, s_2_1581, -3, 103, 0}, +{ 6, s_2_1582, -4, 127, 0}, +{ 6, s_2_1583, -5, 118, 0}, +{ 6, s_2_1584, -6, 101, 0}, +{ 7, s_2_1585, -7, 117, 0}, +{ 7, s_2_1586, -8, 90, 0}, +{ 4, s_2_1587, 0, 115, 0}, +{ 4, s_2_1588, 0, 13, 0}, +{ 3, s_2_1589, 0, 104, 0}, +{ 5, s_2_1590, -1, 128, 0}, +{ 4, s_2_1591, -2, 52, 0}, +{ 5, s_2_1592, -1, 100, 0}, +{ 5, s_2_1593, -2, 105, 0}, +{ 4, s_2_1594, -5, 113, 0}, +{ 5, s_2_1595, -6, 97, 0}, +{ 5, s_2_1596, -7, 96, 0}, +{ 5, s_2_1597, -8, 98, 0}, +{ 5, s_2_1598, -9, 99, 0}, +{ 6, s_2_1599, -10, 102, 0}, +{ 3, s_2_1600, 0, 119, 0}, +{ 8, s_2_1601, -1, 110, 0}, +{ 8, s_2_1602, -2, 111, 0}, +{ 8, s_2_1603, -3, 112, 0}, +{ 8, s_2_1604, -4, 106, 0}, +{ 8, s_2_1605, -5, 107, 0}, +{ 8, s_2_1606, -6, 108, 0}, +{ 5, s_2_1607, -7, 116, 0}, +{ 6, s_2_1608, -8, 114, 0}, +{ 5, s_2_1609, -9, 25, 0}, +{ 8, s_2_1610, -1, 121, 0}, +{ 7, s_2_1611, -2, 100, 0}, +{ 9, s_2_1612, -3, 117, 0}, +{ 4, s_2_1613, -13, 51, 0}, +{ 4, s_2_1614, -14, 13, 0}, +{ 8, s_2_1615, -1, 110, 0}, +{ 8, s_2_1616, -2, 111, 0}, +{ 8, s_2_1617, -3, 112, 0}, +{ 5, s_2_1618, -18, 70, 0}, +{ 6, s_2_1619, -19, 115, 0}, +{ 3, s_2_1620, 0, 116, 0}, +{ 5, s_2_1621, -1, 124, 0}, +{ 6, s_2_1622, -2, 121, 0}, +{ 4, s_2_1623, -3, 13, 0}, +{ 8, s_2_1624, -1, 110, 0}, +{ 8, s_2_1625, -2, 111, 0}, +{ 8, s_2_1626, -3, 112, 0}, +{ 6, s_2_1627, -7, 127, 0}, +{ 5, s_2_1628, -8, 70, 0}, +{ 6, s_2_1629, -1, 118, 0}, +{ 6, s_2_1630, -10, 115, 0}, +{ 6, s_2_1631, -11, 101, 0}, +{ 7, s_2_1632, -12, 117, 0}, +{ 7, s_2_1633, -13, 90, 0}, +{ 4, s_2_1634, 0, 104, 0}, +{ 6, s_2_1635, -1, 105, 0}, +{ 5, s_2_1636, -2, 113, 0}, +{ 7, s_2_1637, -1, 106, 0}, +{ 7, s_2_1638, -2, 107, 0}, +{ 7, s_2_1639, -3, 108, 0}, +{ 6, s_2_1640, -6, 97, 0}, +{ 6, s_2_1641, -7, 96, 0}, +{ 6, s_2_1642, -8, 98, 0}, +{ 6, s_2_1643, -9, 99, 0}, +{ 4, s_2_1644, 0, 116, 0}, +{ 4, s_2_1645, 0, 25, 0}, +{ 7, s_2_1646, -1, 121, 0}, +{ 6, s_2_1647, -2, 100, 0}, +{ 8, s_2_1648, -3, 117, 0}, +{ 4, s_2_1649, 0, 104, 0}, +{ 6, s_2_1650, -1, 128, 0}, +{ 9, s_2_1651, -2, 106, 0}, +{ 9, s_2_1652, -3, 107, 0}, +{ 9, s_2_1653, -4, 108, 0}, +{ 7, s_2_1654, -5, 114, 0}, +{ 6, s_2_1655, -6, 100, 0}, +{ 6, s_2_1656, -7, 105, 0}, +{ 5, s_2_1657, -8, 113, 0}, +{ 6, s_2_1658, -9, 97, 0}, +{ 6, s_2_1659, -10, 96, 0}, +{ 6, s_2_1660, -11, 98, 0}, +{ 6, s_2_1661, -12, 76, 0}, +{ 6, s_2_1662, -13, 99, 0}, +{ 7, s_2_1663, -14, 102, 0}, +{ 4, s_2_1664, 0, 116, 0}, +{ 6, s_2_1665, -1, 124, 0}, +{ 7, s_2_1666, -2, 121, 0}, +{ 5, s_2_1667, -3, 103, 0}, +{ 7, s_2_1668, -4, 127, 0}, +{ 7, s_2_1669, -5, 118, 0}, +{ 7, s_2_1670, -6, 101, 0}, +{ 8, s_2_1671, -7, 117, 0}, +{ 8, s_2_1672, -8, 90, 0}, +{ 9, s_2_1673, 0, 110, 0}, +{ 9, s_2_1674, 0, 111, 0}, +{ 9, s_2_1675, 0, 112, 0}, +{ 5, s_2_1676, 0, 13, 0}, +{ 2, s_2_1677, 0, 13, 0}, +{ 3, s_2_1678, -1, 104, 0}, +{ 5, s_2_1679, -1, 128, 0}, +{ 5, s_2_1680, -2, 105, 0}, +{ 4, s_2_1681, -3, 113, 0}, +{ 5, s_2_1682, -4, 97, 0}, +{ 5, s_2_1683, -5, 96, 0}, +{ 5, s_2_1684, -6, 98, 0}, +{ 5, s_2_1685, -7, 99, 0}, +{ 6, s_2_1686, -8, 102, 0}, +{ 5, s_2_1687, -10, 124, 0}, +{ 6, s_2_1688, -11, 121, 0}, +{ 6, s_2_1689, -12, 101, 0}, +{ 7, s_2_1690, -13, 117, 0}, +{ 3, s_2_1691, -14, 11, 0}, +{ 4, s_2_1692, -1, 137, 0}, +{ 5, s_2_1693, -2, 89, 0}, +{ 3, s_2_1694, 0, 120, 0}, +{ 5, s_2_1695, -1, 68, 0}, +{ 4, s_2_1696, -2, 69, 0}, +{ 3, s_2_1697, 0, 70, 0}, +{ 5, s_2_1698, 0, 92, 0}, +{ 5, s_2_1699, 0, 93, 0}, +{ 4, s_2_1700, 0, 94, 0}, +{ 4, s_2_1701, 0, 71, 0}, +{ 4, s_2_1702, 0, 72, 0}, +{ 4, s_2_1703, 0, 73, 0}, +{ 4, s_2_1704, 0, 74, 0}, +{ 4, s_2_1705, 0, 13, 0}, +{ 3, s_2_1706, 0, 13, 0}, +{ 3, s_2_1707, 0, 77, 0}, +{ 3, s_2_1708, 0, 78, 0}, +{ 3, s_2_1709, 0, 79, 0}, +{ 3, s_2_1710, 0, 80, 0}, +{ 4, s_2_1711, 0, 3, 0}, +{ 5, s_2_1712, 0, 4, 0}, +{ 2, s_2_1713, 0, 161, 0}, +{ 4, s_2_1714, -1, 128, 0}, +{ 4, s_2_1715, -2, 155, 0}, +{ 4, s_2_1716, -3, 156, 0}, +{ 3, s_2_1717, -4, 160, 0}, +{ 4, s_2_1718, -5, 144, 0}, +{ 4, s_2_1719, -6, 145, 0}, +{ 4, s_2_1720, -7, 146, 0}, +{ 4, s_2_1721, -8, 147, 0}, +{ 2, s_2_1722, 0, 163, 0}, +{ 7, s_2_1723, -1, 141, 0}, +{ 7, s_2_1724, -2, 142, 0}, +{ 7, s_2_1725, -3, 143, 0}, +{ 7, s_2_1726, -4, 138, 0}, +{ 7, s_2_1727, -5, 139, 0}, +{ 7, s_2_1728, -6, 140, 0}, +{ 4, s_2_1729, -7, 162, 0}, +{ 5, s_2_1730, -8, 150, 0}, +{ 4, s_2_1731, -9, 157, 0}, +{ 7, s_2_1732, -1, 121, 0}, +{ 6, s_2_1733, -2, 155, 0}, +{ 3, s_2_1734, -12, 164, 0}, +{ 7, s_2_1735, -1, 141, 0}, +{ 7, s_2_1736, -2, 142, 0}, +{ 7, s_2_1737, -3, 143, 0}, +{ 4, s_2_1738, -16, 153, 0}, +{ 5, s_2_1739, -17, 136, 0}, +{ 2, s_2_1740, 0, 162, 0}, +{ 4, s_2_1741, -1, 124, 0}, +{ 5, s_2_1742, -2, 121, 0}, +{ 3, s_2_1743, -3, 158, 0}, +{ 5, s_2_1744, -4, 127, 0}, +{ 5, s_2_1745, -5, 149, 0}, +{ 2, s_2_1746, 0, 104, 0}, +{ 4, s_2_1747, -1, 128, 0}, +{ 7, s_2_1748, -2, 106, 0}, +{ 7, s_2_1749, -3, 107, 0}, +{ 7, s_2_1750, -4, 108, 0}, +{ 5, s_2_1751, -5, 114, 0}, +{ 4, s_2_1752, -6, 100, 0}, +{ 4, s_2_1753, -7, 105, 0}, +{ 3, s_2_1754, -8, 113, 0}, +{ 5, s_2_1755, -1, 110, 0}, +{ 5, s_2_1756, -2, 111, 0}, +{ 5, s_2_1757, -3, 112, 0}, +{ 4, s_2_1758, -12, 97, 0}, +{ 4, s_2_1759, -13, 96, 0}, +{ 4, s_2_1760, -14, 98, 0}, +{ 6, s_2_1761, -1, 100, 0}, +{ 4, s_2_1762, -16, 76, 0}, +{ 4, s_2_1763, -17, 99, 0}, +{ 5, s_2_1764, -18, 102, 0}, +{ 2, s_2_1765, 0, 116, 0}, +{ 4, s_2_1766, -1, 124, 0}, +{ 5, s_2_1767, -2, 121, 0}, +{ 5, s_2_1768, -3, 127, 0}, +{ 5, s_2_1769, -4, 118, 0}, +{ 5, s_2_1770, -5, 101, 0}, +{ 6, s_2_1771, -6, 117, 0}, +{ 6, s_2_1772, -7, 90, 0}, +{ 3, s_2_1773, 0, 13, 0}, +{ 6, s_2_1774, 0, 110, 0}, +{ 6, s_2_1775, 0, 111, 0}, +{ 6, s_2_1776, 0, 112, 0}, +{ 2, s_2_1777, 0, 20, 0}, +{ 4, s_2_1778, -1, 19, 0}, +{ 3, s_2_1779, -2, 18, 0}, +{ 3, s_2_1780, 0, 104, 0}, +{ 5, s_2_1781, -1, 128, 0}, +{ 8, s_2_1782, -2, 106, 0}, +{ 8, s_2_1783, -3, 107, 0}, +{ 8, s_2_1784, -4, 108, 0}, +{ 6, s_2_1785, -5, 114, 0}, +{ 5, s_2_1786, -6, 100, 0}, +{ 5, s_2_1787, -7, 105, 0}, +{ 5, s_2_1788, -8, 97, 0}, +{ 5, s_2_1789, -9, 96, 0}, +{ 5, s_2_1790, -10, 98, 0}, +{ 5, s_2_1791, -11, 76, 0}, +{ 5, s_2_1792, -12, 99, 0}, +{ 6, s_2_1793, -13, 102, 0}, +{ 3, s_2_1794, 0, 104, 0}, +{ 4, s_2_1795, -1, 26, 0}, +{ 5, s_2_1796, -1, 128, 0}, +{ 4, s_2_1797, -3, 30, 0}, +{ 4, s_2_1798, -4, 31, 0}, +{ 5, s_2_1799, -1, 100, 0}, +{ 5, s_2_1800, -2, 105, 0}, +{ 4, s_2_1801, -7, 113, 0}, +{ 6, s_2_1802, -1, 106, 0}, +{ 6, s_2_1803, -2, 107, 0}, +{ 6, s_2_1804, -3, 108, 0}, +{ 5, s_2_1805, -11, 97, 0}, +{ 5, s_2_1806, -12, 96, 0}, +{ 5, s_2_1807, -13, 98, 0}, +{ 5, s_2_1808, -14, 99, 0}, +{ 5, s_2_1809, -15, 28, 0}, +{ 5, s_2_1810, -16, 27, 0}, +{ 6, s_2_1811, -1, 102, 0}, +{ 5, s_2_1812, -18, 29, 0}, +{ 3, s_2_1813, 0, 116, 0}, +{ 4, s_2_1814, -1, 32, 0}, +{ 4, s_2_1815, -2, 33, 0}, +{ 4, s_2_1816, -3, 34, 0}, +{ 4, s_2_1817, -4, 40, 0}, +{ 4, s_2_1818, -5, 39, 0}, +{ 6, s_2_1819, -6, 84, 0}, +{ 6, s_2_1820, -7, 85, 0}, +{ 6, s_2_1821, -8, 122, 0}, +{ 7, s_2_1822, -9, 86, 0}, +{ 4, s_2_1823, -10, 95, 0}, +{ 4, s_2_1824, -11, 24, 0}, +{ 5, s_2_1825, -1, 83, 0}, +{ 4, s_2_1826, -13, 37, 0}, +{ 4, s_2_1827, -14, 13, 0}, +{ 6, s_2_1828, -1, 9, 0}, +{ 6, s_2_1829, -2, 6, 0}, +{ 6, s_2_1830, -3, 7, 0}, +{ 6, s_2_1831, -4, 8, 0}, +{ 6, s_2_1832, -5, 5, 0}, +{ 4, s_2_1833, -20, 41, 0}, +{ 4, s_2_1834, -21, 42, 0}, +{ 6, s_2_1835, -1, 21, 0}, +{ 4, s_2_1836, -23, 23, 0}, +{ 5, s_2_1837, -1, 123, 0}, +{ 4, s_2_1838, -25, 44, 0}, +{ 5, s_2_1839, -1, 120, 0}, +{ 5, s_2_1840, -2, 22, 0}, +{ 5, s_2_1841, -28, 77, 0}, +{ 5, s_2_1842, -29, 78, 0}, +{ 5, s_2_1843, -30, 79, 0}, +{ 5, s_2_1844, -31, 80, 0}, +{ 4, s_2_1845, -32, 45, 0}, +{ 6, s_2_1846, -33, 91, 0}, +{ 5, s_2_1847, -34, 38, 0}, +{ 4, s_2_1848, 0, 84, 0}, +{ 4, s_2_1849, 0, 85, 0}, +{ 4, s_2_1850, 0, 122, 0}, +{ 5, s_2_1851, 0, 86, 0}, +{ 3, s_2_1852, 0, 25, 0}, +{ 6, s_2_1853, -1, 121, 0}, +{ 5, s_2_1854, -2, 100, 0}, +{ 7, s_2_1855, -3, 117, 0}, +{ 2, s_2_1856, 0, 95, 0}, +{ 3, s_2_1857, -1, 1, 0}, +{ 4, s_2_1858, -2, 2, 0}, +{ 3, s_2_1859, 0, 104, 0}, +{ 5, s_2_1860, -1, 47, 0}, +{ 4, s_2_1861, -2, 46, 0}, +{ 3, s_2_1862, 0, 83, 0}, +{ 3, s_2_1863, 0, 116, 0}, +{ 5, s_2_1864, -1, 48, 0}, +{ 3, s_2_1865, 0, 50, 0}, +{ 4, s_2_1866, 0, 52, 0}, +{ 5, s_2_1867, 0, 124, 0}, +{ 5, s_2_1868, 0, 125, 0}, +{ 5, s_2_1869, 0, 126, 0}, +{ 8, s_2_1870, 0, 84, 0}, +{ 8, s_2_1871, 0, 85, 0}, +{ 8, s_2_1872, 0, 122, 0}, +{ 9, s_2_1873, 0, 86, 0}, +{ 6, s_2_1874, 0, 95, 0}, +{ 7, s_2_1875, -1, 1, 0}, +{ 8, s_2_1876, -2, 2, 0}, +{ 7, s_2_1877, 0, 83, 0}, +{ 6, s_2_1878, 0, 13, 0}, +{ 7, s_2_1879, 0, 123, 0}, +{ 7, s_2_1880, 0, 120, 0}, +{ 9, s_2_1881, 0, 92, 0}, +{ 9, s_2_1882, 0, 93, 0}, +{ 8, s_2_1883, 0, 94, 0}, +{ 7, s_2_1884, 0, 77, 0}, +{ 7, s_2_1885, 0, 78, 0}, +{ 7, s_2_1886, 0, 79, 0}, +{ 7, s_2_1887, 0, 80, 0}, +{ 8, s_2_1888, 0, 91, 0}, +{ 6, s_2_1889, 0, 84, 0}, +{ 6, s_2_1890, 0, 85, 0}, +{ 6, s_2_1891, 0, 122, 0}, +{ 7, s_2_1892, 0, 86, 0}, +{ 4, s_2_1893, 0, 95, 0}, +{ 5, s_2_1894, -1, 1, 0}, +{ 6, s_2_1895, -2, 2, 0}, +{ 4, s_2_1896, 0, 51, 0}, +{ 5, s_2_1897, -1, 83, 0}, +{ 4, s_2_1898, 0, 13, 0}, +{ 5, s_2_1899, -1, 10, 0}, +{ 5, s_2_1900, -2, 87, 0}, +{ 5, s_2_1901, -3, 159, 0}, +{ 6, s_2_1902, -4, 88, 0}, +{ 5, s_2_1903, 0, 123, 0}, +{ 5, s_2_1904, 0, 120, 0}, +{ 7, s_2_1905, 0, 92, 0}, +{ 7, s_2_1906, 0, 93, 0}, +{ 6, s_2_1907, 0, 94, 0}, +{ 5, s_2_1908, 0, 77, 0}, +{ 5, s_2_1909, 0, 78, 0}, +{ 5, s_2_1910, 0, 79, 0}, +{ 5, s_2_1911, 0, 80, 0}, +{ 6, s_2_1912, 0, 14, 0}, +{ 6, s_2_1913, 0, 15, 0}, +{ 6, s_2_1914, 0, 16, 0}, +{ 6, s_2_1915, 0, 91, 0}, +{ 5, s_2_1916, 0, 124, 0}, +{ 5, s_2_1917, 0, 125, 0}, +{ 5, s_2_1918, 0, 126, 0}, +{ 6, s_2_1919, 0, 84, 0}, +{ 6, s_2_1920, 0, 85, 0}, +{ 6, s_2_1921, 0, 122, 0}, +{ 7, s_2_1922, 0, 86, 0}, +{ 4, s_2_1923, 0, 95, 0}, +{ 5, s_2_1924, -1, 1, 0}, +{ 6, s_2_1925, -2, 2, 0}, +{ 5, s_2_1926, 0, 83, 0}, +{ 4, s_2_1927, 0, 13, 0}, +{ 6, s_2_1928, -1, 137, 0}, +{ 7, s_2_1929, -2, 89, 0}, +{ 5, s_2_1930, 0, 123, 0}, +{ 5, s_2_1931, 0, 120, 0}, +{ 7, s_2_1932, 0, 92, 0}, +{ 7, s_2_1933, 0, 93, 0}, +{ 6, s_2_1934, 0, 94, 0}, +{ 5, s_2_1935, 0, 77, 0}, +{ 5, s_2_1936, 0, 78, 0}, +{ 5, s_2_1937, 0, 79, 0}, +{ 5, s_2_1938, 0, 80, 0}, +{ 6, s_2_1939, 0, 14, 0}, +{ 6, s_2_1940, 0, 15, 0}, +{ 6, s_2_1941, 0, 16, 0}, +{ 6, s_2_1942, 0, 91, 0}, +{ 2, s_2_1943, 0, 13, 0}, +{ 3, s_2_1944, -1, 10, 0}, +{ 6, s_2_1945, -1, 110, 0}, +{ 6, s_2_1946, -2, 111, 0}, +{ 6, s_2_1947, -3, 112, 0}, +{ 3, s_2_1948, -5, 11, 0}, +{ 4, s_2_1949, -1, 137, 0}, +{ 5, s_2_1950, -2, 10, 0}, +{ 5, s_2_1951, -3, 89, 0}, +{ 3, s_2_1952, -9, 12, 0}, +{ 3, s_2_1953, 0, 53, 0}, +{ 3, s_2_1954, 0, 54, 0}, +{ 3, s_2_1955, 0, 55, 0}, +{ 3, s_2_1956, 0, 56, 0}, +{ 4, s_2_1957, 0, 135, 0}, +{ 4, s_2_1958, 0, 131, 0}, +{ 4, s_2_1959, 0, 129, 0}, +{ 4, s_2_1960, 0, 133, 0}, +{ 4, s_2_1961, 0, 132, 0}, +{ 4, s_2_1962, 0, 130, 0}, +{ 4, s_2_1963, 0, 134, 0}, +{ 3, s_2_1964, 0, 57, 0}, +{ 3, s_2_1965, 0, 58, 0}, +{ 3, s_2_1966, 0, 123, 0}, +{ 3, s_2_1967, 0, 120, 0}, +{ 5, s_2_1968, -1, 68, 0}, +{ 4, s_2_1969, -2, 69, 0}, +{ 3, s_2_1970, 0, 70, 0}, +{ 5, s_2_1971, 0, 92, 0}, +{ 5, s_2_1972, 0, 93, 0}, +{ 4, s_2_1973, 0, 94, 0}, +{ 4, s_2_1974, 0, 71, 0}, +{ 4, s_2_1975, 0, 72, 0}, +{ 4, s_2_1976, 0, 73, 0}, +{ 4, s_2_1977, 0, 74, 0}, +{ 5, s_2_1978, 0, 75, 0}, +{ 3, s_2_1979, 0, 77, 0}, +{ 3, s_2_1980, 0, 78, 0}, +{ 3, s_2_1981, 0, 79, 0}, +{ 3, s_2_1982, 0, 80, 0}, +{ 4, s_2_1983, -1, 82, 0}, +{ 4, s_2_1984, -2, 81, 0}, +{ 4, s_2_1985, 0, 3, 0}, +{ 5, s_2_1986, 0, 4, 0}, +{ 5, s_2_1987, 0, 63, 0}, +{ 5, s_2_1988, 0, 64, 0}, +{ 5, s_2_1989, 0, 61, 0}, +{ 5, s_2_1990, 0, 62, 0}, +{ 5, s_2_1991, 0, 60, 0}, +{ 5, s_2_1992, 0, 59, 0}, +{ 5, s_2_1993, 0, 65, 0}, +{ 4, s_2_1994, 0, 66, 0}, +{ 4, s_2_1995, 0, 67, 0}, +{ 4, s_2_1996, 0, 91, 0}, +{ 4, s_2_1997, 0, 97, 0}, +{ 4, s_2_1998, 0, 96, 0}, +{ 4, s_2_1999, 0, 98, 0}, +{ 4, s_2_2000, 0, 99, 0}, +{ 3, s_2_2001, 0, 95, 0}, +{ 3, s_2_2002, 0, 104, 0}, +{ 5, s_2_2003, -1, 100, 0}, +{ 5, s_2_2004, -2, 105, 0}, +{ 4, s_2_2005, -3, 113, 0}, +{ 5, s_2_2006, -4, 97, 0}, +{ 5, s_2_2007, -5, 96, 0}, +{ 5, s_2_2008, -6, 98, 0}, +{ 5, s_2_2009, -7, 99, 0}, +{ 6, s_2_2010, -8, 102, 0}, +{ 3, s_2_2011, 0, 119, 0}, +{ 8, s_2_2012, -1, 110, 0}, +{ 8, s_2_2013, -2, 111, 0}, +{ 8, s_2_2014, -3, 112, 0}, +{ 8, s_2_2015, -4, 106, 0}, +{ 8, s_2_2016, -5, 107, 0}, +{ 8, s_2_2017, -6, 108, 0}, +{ 5, s_2_2018, -7, 116, 0}, +{ 6, s_2_2019, -8, 114, 0}, +{ 5, s_2_2020, -9, 25, 0}, +{ 7, s_2_2021, -1, 100, 0}, +{ 9, s_2_2022, -2, 117, 0}, +{ 4, s_2_2023, -12, 13, 0}, +{ 8, s_2_2024, -1, 110, 0}, +{ 8, s_2_2025, -2, 111, 0}, +{ 8, s_2_2026, -3, 112, 0}, +{ 5, s_2_2027, -16, 70, 0}, +{ 6, s_2_2028, -17, 115, 0}, +{ 3, s_2_2029, 0, 116, 0}, +{ 4, s_2_2030, -1, 103, 0}, +{ 6, s_2_2031, -2, 118, 0}, +{ 6, s_2_2032, -3, 101, 0}, +{ 7, s_2_2033, -4, 117, 0}, +{ 7, s_2_2034, -5, 90, 0} +}; + +static const symbol s_3_0[1] = { 'a' }; +static const symbol s_3_1[3] = { 'o', 'g', 'a' }; +static const symbol s_3_2[3] = { 'a', 'm', 'a' }; +static const symbol s_3_3[3] = { 'i', 'm', 'a' }; +static const symbol s_3_4[3] = { 'e', 'n', 'a' }; +static const symbol s_3_5[1] = { 'e' }; +static const symbol s_3_6[2] = { 'o', 'g' }; +static const symbol s_3_7[4] = { 'a', 'n', 'o', 'g' }; +static const symbol s_3_8[4] = { 'e', 'n', 'o', 'g' }; +static const symbol s_3_9[4] = { 'a', 'n', 'i', 'h' }; +static const symbol s_3_10[4] = { 'e', 'n', 'i', 'h' }; +static const symbol s_3_11[1] = { 'i' }; +static const symbol s_3_12[3] = { 'a', 'n', 'i' }; +static const symbol s_3_13[3] = { 'e', 'n', 'i' }; +static const symbol s_3_14[4] = { 'a', 'n', 'o', 'j' }; +static const symbol s_3_15[4] = { 'e', 'n', 'o', 'j' }; +static const symbol s_3_16[4] = { 'a', 'n', 'i', 'm' }; +static const symbol s_3_17[4] = { 'e', 'n', 'i', 'm' }; +static const symbol s_3_18[2] = { 'o', 'm' }; +static const symbol s_3_19[4] = { 'e', 'n', 'o', 'm' }; +static const symbol s_3_20[1] = { 'o' }; +static const symbol s_3_21[3] = { 'a', 'n', 'o' }; +static const symbol s_3_22[3] = { 'e', 'n', 'o' }; +static const symbol s_3_23[3] = { 'o', 's', 't' }; +static const symbol s_3_24[1] = { 'u' }; +static const symbol s_3_25[3] = { 'e', 'n', 'u' }; +static const struct among a_3[26] = { +{ 1, s_3_0, 0, 1, 0}, +{ 3, s_3_1, -1, 1, 0}, +{ 3, s_3_2, -2, 1, 0}, +{ 3, s_3_3, -3, 1, 0}, +{ 3, s_3_4, -4, 1, 0}, +{ 1, s_3_5, 0, 1, 0}, +{ 2, s_3_6, 0, 1, 0}, +{ 4, s_3_7, -1, 1, 0}, +{ 4, s_3_8, -2, 1, 0}, +{ 4, s_3_9, 0, 1, 0}, +{ 4, s_3_10, 0, 1, 0}, +{ 1, s_3_11, 0, 1, 0}, +{ 3, s_3_12, -1, 1, 0}, +{ 3, s_3_13, -2, 1, 0}, +{ 4, s_3_14, 0, 1, 0}, +{ 4, s_3_15, 0, 1, 0}, +{ 4, s_3_16, 0, 1, 0}, +{ 4, s_3_17, 0, 1, 0}, +{ 2, s_3_18, 0, 1, 0}, +{ 4, s_3_19, -1, 1, 0}, +{ 1, s_3_20, 0, 1, 0}, +{ 3, s_3_21, -1, 1, 0}, +{ 3, s_3_22, -2, 1, 0}, +{ 3, s_3_23, 0, 1, 0}, +{ 1, s_3_24, 0, 1, 0}, +{ 3, s_3_25, -1, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16 }; + +static const unsigned char g_sa[] = { 65, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 128 }; + +static const unsigned char g_ca[] = { 119, 95, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 16 }; + +static const unsigned char g_rg[] = { 1 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'b' }; +static const symbol s_2[] = { 'v' }; +static const symbol s_3[] = { 'g' }; +static const symbol s_4[] = { 'd' }; +static const symbol s_5[] = { 0xC4, 0x91 }; +static const symbol s_6[] = { 'e' }; +static const symbol s_7[] = { 0xC5, 0xBE }; +static const symbol s_8[] = { 'z' }; +static const symbol s_9[] = { 'i' }; +static const symbol s_10[] = { 'j' }; +static const symbol s_11[] = { 'k' }; +static const symbol s_12[] = { 'l' }; +static const symbol s_13[] = { 'l', 'j' }; +static const symbol s_14[] = { 'm' }; +static const symbol s_15[] = { 'n' }; +static const symbol s_16[] = { 'n', 'j' }; +static const symbol s_17[] = { 'o' }; +static const symbol s_18[] = { 'p' }; +static const symbol s_19[] = { 'r' }; +static const symbol s_20[] = { 's' }; +static const symbol s_21[] = { 't' }; +static const symbol s_22[] = { 0xC4, 0x87 }; +static const symbol s_23[] = { 'u' }; +static const symbol s_24[] = { 'f' }; +static const symbol s_25[] = { 'h' }; +static const symbol s_26[] = { 'c' }; +static const symbol s_27[] = { 0xC4, 0x8D }; +static const symbol s_28[] = { 'd', 0xC5, 0xBE }; +static const symbol s_29[] = { 0xC5, 0xA1 }; +static const symbol s_30[] = { 'i', 'j', 'e' }; +static const symbol s_31[] = { 'e' }; +static const symbol s_32[] = { 'j', 'e' }; +static const symbol s_33[] = { 'e' }; +static const symbol s_34[] = { 'd', 'j' }; +static const symbol s_35[] = { 0xC4, 0x91 }; +static const symbol s_36[] = { 'l', 'o', 'g', 'a' }; +static const symbol s_37[] = { 'p', 'e', 'h' }; +static const symbol s_38[] = { 'v', 'o', 'j', 'k', 'a' }; +static const symbol s_39[] = { 'b', 'o', 'j', 'k', 'a' }; +static const symbol s_40[] = { 'j', 'a', 'k' }; +static const symbol s_41[] = { 0xC4, 0x8D, 'a', 'j', 'n', 'i' }; +static const symbol s_42[] = { 'c', 'a', 'j', 'n', 'i' }; +static const symbol s_43[] = { 'e', 'r', 'n', 'i' }; +static const symbol s_44[] = { 'l', 'a', 'r', 'n', 'i' }; +static const symbol s_45[] = { 'e', 's', 'n', 'i' }; +static const symbol s_46[] = { 'a', 'n', 'j', 'c', 'a' }; +static const symbol s_47[] = { 'a', 'j', 'c', 'a' }; +static const symbol s_48[] = { 'l', 'j', 'c', 'a' }; +static const symbol s_49[] = { 'e', 'j', 'c', 'a' }; +static const symbol s_50[] = { 'o', 'j', 'c', 'a' }; +static const symbol s_51[] = { 'a', 'j', 'k', 'a' }; +static const symbol s_52[] = { 'o', 'j', 'k', 'a' }; +static const symbol s_53[] = { 0xC5, 0xA1, 'c', 'a' }; +static const symbol s_54[] = { 'i', 'n', 'g' }; +static const symbol s_55[] = { 't', 'v', 'e', 'n', 'i', 'k' }; +static const symbol s_56[] = { 't', 'e', 't', 'i', 'k', 'a' }; +static const symbol s_57[] = { 'n', 's', 't', 'v', 'a' }; +static const symbol s_58[] = { 'n', 'i', 'k' }; +static const symbol s_59[] = { 't', 'i', 'k' }; +static const symbol s_60[] = { 'z', 'i', 'k' }; +static const symbol s_61[] = { 's', 'n', 'i', 'k' }; +static const symbol s_62[] = { 'k', 'u', 's', 'i' }; +static const symbol s_63[] = { 'k', 'u', 's', 'n', 'i' }; +static const symbol s_64[] = { 'k', 'u', 's', 't', 'v', 'a' }; +static const symbol s_65[] = { 'd', 'u', 0xC5, 0xA1, 'n', 'i' }; +static const symbol s_66[] = { 'd', 'u', 's', 'n', 'i' }; +static const symbol s_67[] = { 'a', 'n', 't', 'n', 'i' }; +static const symbol s_68[] = { 'b', 'i', 'l', 'n', 'i' }; +static const symbol s_69[] = { 't', 'i', 'l', 'n', 'i' }; +static const symbol s_70[] = { 'a', 'v', 'i', 'l', 'n', 'i' }; +static const symbol s_71[] = { 's', 'i', 'l', 'n', 'i' }; +static const symbol s_72[] = { 'g', 'i', 'l', 'n', 'i' }; +static const symbol s_73[] = { 'r', 'i', 'l', 'n', 'i' }; +static const symbol s_74[] = { 'n', 'i', 'l', 'n', 'i' }; +static const symbol s_75[] = { 'a', 'l', 'n', 'i' }; +static const symbol s_76[] = { 'o', 'z', 'n', 'i' }; +static const symbol s_77[] = { 'r', 'a', 'v', 'i' }; +static const symbol s_78[] = { 's', 't', 'a', 'v', 'n', 'i' }; +static const symbol s_79[] = { 'p', 'r', 'a', 'v', 'n', 'i' }; +static const symbol s_80[] = { 't', 'i', 'v', 'n', 'i' }; +static const symbol s_81[] = { 's', 'i', 'v', 'n', 'i' }; +static const symbol s_82[] = { 'a', 't', 'n', 'i' }; +static const symbol s_83[] = { 'e', 'n', 't', 'a' }; +static const symbol s_84[] = { 't', 'e', 't', 'n', 'i' }; +static const symbol s_85[] = { 'p', 'l', 'e', 't', 'n', 'i' }; +static const symbol s_86[] = { 0xC5, 0xA1, 'a', 'v', 'i' }; +static const symbol s_87[] = { 's', 'a', 'v', 'i' }; +static const symbol s_88[] = { 'a', 'n', 't', 'a' }; +static const symbol s_89[] = { 'a', 0xC4, 0x8D, 'k', 'a' }; +static const symbol s_90[] = { 'a', 'c', 'k', 'a' }; +static const symbol s_91[] = { 'u', 0xC5, 0xA1, 'k', 'a' }; +static const symbol s_92[] = { 'u', 's', 'k', 'a' }; +static const symbol s_93[] = { 'a', 't', 'k', 'a' }; +static const symbol s_94[] = { 'e', 't', 'k', 'a' }; +static const symbol s_95[] = { 'i', 't', 'k', 'a' }; +static const symbol s_96[] = { 'o', 't', 'k', 'a' }; +static const symbol s_97[] = { 'u', 't', 'k', 'a' }; +static const symbol s_98[] = { 'e', 's', 'k', 'n', 'a' }; +static const symbol s_99[] = { 't', 'i', 0xC4, 0x8D, 'n', 'i' }; +static const symbol s_100[] = { 't', 'i', 'c', 'n', 'i' }; +static const symbol s_101[] = { 'o', 'j', 's', 'k', 'a' }; +static const symbol s_102[] = { 'e', 's', 'm', 'a' }; +static const symbol s_103[] = { 'm', 'e', 't', 'r', 'a' }; +static const symbol s_104[] = { 'c', 'e', 'n', 't', 'r', 'a' }; +static const symbol s_105[] = { 'i', 's', 't', 'r', 'a' }; +static const symbol s_106[] = { 'o', 's', 't', 'i' }; +static const symbol s_107[] = { 'o', 's', 't', 'i' }; +static const symbol s_108[] = { 'd', 'b', 'a' }; +static const symbol s_109[] = { 0xC4, 0x8D, 'k', 'a' }; +static const symbol s_110[] = { 'm', 'c', 'a' }; +static const symbol s_111[] = { 'n', 'c', 'a' }; +static const symbol s_112[] = { 'v', 'o', 'l', 'j', 'n', 'i' }; +static const symbol s_113[] = { 'a', 'n', 'k', 'i' }; +static const symbol s_114[] = { 'v', 'c', 'a' }; +static const symbol s_115[] = { 's', 'c', 'a' }; +static const symbol s_116[] = { 'r', 'c', 'a' }; +static const symbol s_117[] = { 'a', 'l', 'c', 'a' }; +static const symbol s_118[] = { 'e', 'l', 'c', 'a' }; +static const symbol s_119[] = { 'o', 'l', 'c', 'a' }; +static const symbol s_120[] = { 'n', 'j', 'c', 'a' }; +static const symbol s_121[] = { 'e', 'k', 't', 'a' }; +static const symbol s_122[] = { 'i', 'z', 'm', 'a' }; +static const symbol s_123[] = { 'j', 'e', 'b', 'i' }; +static const symbol s_124[] = { 'b', 'a', 'c', 'i' }; +static const symbol s_125[] = { 'a', 0xC5, 0xA1, 'n', 'i' }; +static const symbol s_126[] = { 'a', 's', 'n', 'i' }; +static const symbol s_127[] = { 's', 'k' }; +static const symbol s_128[] = { 0xC5, 0xA1, 'k' }; +static const symbol s_129[] = { 's', 't', 'v' }; +static const symbol s_130[] = { 0xC5, 0xA1, 't', 'v' }; +static const symbol s_131[] = { 't', 'a', 'n', 'i', 'j' }; +static const symbol s_132[] = { 'm', 'a', 'n', 'i', 'j' }; +static const symbol s_133[] = { 'p', 'a', 'n', 'i', 'j' }; +static const symbol s_134[] = { 'r', 'a', 'n', 'i', 'j' }; +static const symbol s_135[] = { 'g', 'a', 'n', 'i', 'j' }; +static const symbol s_136[] = { 'a', 'n' }; +static const symbol s_137[] = { 'i', 'n' }; +static const symbol s_138[] = { 'o', 'n' }; +static const symbol s_139[] = { 'n' }; +static const symbol s_140[] = { 'a', 0xC4, 0x87 }; +static const symbol s_141[] = { 'e', 0xC4, 0x87 }; +static const symbol s_142[] = { 'u', 0xC4, 0x87 }; +static const symbol s_143[] = { 'u', 'g', 'o', 'v' }; +static const symbol s_144[] = { 'u', 'g' }; +static const symbol s_145[] = { 'l', 'o', 'g' }; +static const symbol s_146[] = { 'g' }; +static const symbol s_147[] = { 'r', 'a', 'r', 'i' }; +static const symbol s_148[] = { 'o', 't', 'i' }; +static const symbol s_149[] = { 's', 'i' }; +static const symbol s_150[] = { 'l', 'i' }; +static const symbol s_151[] = { 'u', 'j' }; +static const symbol s_152[] = { 'c', 'a', 'j' }; +static const symbol s_153[] = { 0xC4, 0x8D, 'a', 'j' }; +static const symbol s_154[] = { 0xC4, 0x87, 'a', 'j' }; +static const symbol s_155[] = { 0xC4, 0x91, 'a', 'j' }; +static const symbol s_156[] = { 'l', 'a', 'j' }; +static const symbol s_157[] = { 'r', 'a', 'j' }; +static const symbol s_158[] = { 'b', 'i', 'j' }; +static const symbol s_159[] = { 'c', 'i', 'j' }; +static const symbol s_160[] = { 'd', 'i', 'j' }; +static const symbol s_161[] = { 'l', 'i', 'j' }; +static const symbol s_162[] = { 'n', 'i', 'j' }; +static const symbol s_163[] = { 'm', 'i', 'j' }; +static const symbol s_164[] = { 0xC5, 0xBE, 'i', 'j' }; +static const symbol s_165[] = { 'g', 'i', 'j' }; +static const symbol s_166[] = { 'f', 'i', 'j' }; +static const symbol s_167[] = { 'p', 'i', 'j' }; +static const symbol s_168[] = { 'r', 'i', 'j' }; +static const symbol s_169[] = { 's', 'i', 'j' }; +static const symbol s_170[] = { 't', 'i', 'j' }; +static const symbol s_171[] = { 'z', 'i', 'j' }; +static const symbol s_172[] = { 'n', 'a', 'l' }; +static const symbol s_173[] = { 'i', 'j', 'a', 'l' }; +static const symbol s_174[] = { 'o', 'z', 'i', 'l' }; +static const symbol s_175[] = { 'o', 'l', 'o', 'v' }; +static const symbol s_176[] = { 'o', 'l' }; +static const symbol s_177[] = { 'l', 'e', 'm' }; +static const symbol s_178[] = { 'r', 'a', 'm' }; +static const symbol s_179[] = { 'a', 'r' }; +static const symbol s_180[] = { 'd', 'r' }; +static const symbol s_181[] = { 'e', 'r' }; +static const symbol s_182[] = { 'o', 'r' }; +static const symbol s_183[] = { 'e', 's' }; +static const symbol s_184[] = { 'i', 's' }; +static const symbol s_185[] = { 't', 'a', 0xC5, 0xA1 }; +static const symbol s_186[] = { 'n', 'a', 0xC5, 0xA1 }; +static const symbol s_187[] = { 'j', 'a', 0xC5, 0xA1 }; +static const symbol s_188[] = { 'k', 'a', 0xC5, 0xA1 }; +static const symbol s_189[] = { 'b', 'a', 0xC5, 0xA1 }; +static const symbol s_190[] = { 'g', 'a', 0xC5, 0xA1 }; +static const symbol s_191[] = { 'v', 'a', 0xC5, 0xA1 }; +static const symbol s_192[] = { 'e', 0xC5, 0xA1 }; +static const symbol s_193[] = { 'i', 0xC5, 0xA1 }; +static const symbol s_194[] = { 'i', 'k', 'a', 't' }; +static const symbol s_195[] = { 'l', 'a', 't' }; +static const symbol s_196[] = { 'e', 't' }; +static const symbol s_197[] = { 'e', 's', 't' }; +static const symbol s_198[] = { 'i', 's', 't' }; +static const symbol s_199[] = { 'k', 's', 't' }; +static const symbol s_200[] = { 'o', 's', 't' }; +static const symbol s_201[] = { 'i', 0xC5, 0xA1, 't' }; +static const symbol s_202[] = { 'o', 'v', 'a' }; +static const symbol s_203[] = { 'a', 'v' }; +static const symbol s_204[] = { 'e', 'v' }; +static const symbol s_205[] = { 'i', 'v' }; +static const symbol s_206[] = { 'o', 'v' }; +static const symbol s_207[] = { 'm', 'o', 'v' }; +static const symbol s_208[] = { 'l', 'o', 'v' }; +static const symbol s_209[] = { 'e', 'l' }; +static const symbol s_210[] = { 'a', 'n', 'j' }; +static const symbol s_211[] = { 'e', 'n', 'j' }; +static const symbol s_212[] = { 0xC5, 0xA1, 'n', 'j' }; +static const symbol s_213[] = { 'e', 'n' }; +static const symbol s_214[] = { 0xC5, 0xA1, 'n' }; +static const symbol s_215[] = { 0xC4, 0x8D, 'i', 'n' }; +static const symbol s_216[] = { 'r', 'o', 0xC5, 0xA1, 'i' }; +static const symbol s_217[] = { 'o', 0xC5, 0xA1 }; +static const symbol s_218[] = { 'e', 'v', 'i', 't' }; +static const symbol s_219[] = { 'o', 'v', 'i', 't' }; +static const symbol s_220[] = { 'a', 's', 't' }; +static const symbol s_221[] = { 'k' }; +static const symbol s_222[] = { 'e', 'v', 'a' }; +static const symbol s_223[] = { 'a', 'v', 'a' }; +static const symbol s_224[] = { 'i', 'v', 'a' }; +static const symbol s_225[] = { 'u', 'v', 'a' }; +static const symbol s_226[] = { 'i', 'r' }; +static const symbol s_227[] = { 'a', 0xC4, 0x8D }; +static const symbol s_228[] = { 'a', 0xC4, 0x8D, 'a' }; +static const symbol s_229[] = { 'n', 'i' }; +static const symbol s_230[] = { 'a' }; +static const symbol s_231[] = { 'u', 'r' }; +static const symbol s_232[] = { 'a', 's', 't', 'a', 'j' }; +static const symbol s_233[] = { 'i', 's', 't', 'a', 'j' }; +static const symbol s_234[] = { 'o', 's', 't', 'a', 'j' }; +static const symbol s_235[] = { 'a', 'j' }; +static const symbol s_236[] = { 'a', 's', 't', 'a' }; +static const symbol s_237[] = { 'i', 's', 't', 'a' }; +static const symbol s_238[] = { 'o', 's', 't', 'a' }; +static const symbol s_239[] = { 't', 'a' }; +static const symbol s_240[] = { 'i', 'n', 'j' }; +static const symbol s_241[] = { 'a', 's' }; +static const symbol s_242[] = { 'i' }; +static const symbol s_243[] = { 'l', 'u', 0xC4, 0x8D }; +static const symbol s_244[] = { 'j', 'e', 't', 'i' }; +static const symbol s_245[] = { 'e' }; +static const symbol s_246[] = { 'a', 't' }; +static const symbol s_247[] = { 'l', 'u', 'c' }; +static const symbol s_248[] = { 's', 'n', 'j' }; +static const symbol s_249[] = { 'o', 's' }; +static const symbol s_250[] = { 'a', 'c' }; +static const symbol s_251[] = { 'e', 'c' }; +static const symbol s_252[] = { 'u', 'c' }; +static const symbol s_253[] = { 'r', 'o', 's', 'i' }; +static const symbol s_254[] = { 'a', 'c', 'a' }; +static const symbol s_255[] = { 'j', 'a', 's' }; +static const symbol s_256[] = { 't', 'a', 's' }; +static const symbol s_257[] = { 'g', 'a', 's' }; +static const symbol s_258[] = { 'n', 'a', 's' }; +static const symbol s_259[] = { 'k', 'a', 's' }; +static const symbol s_260[] = { 'v', 'a', 's' }; +static const symbol s_261[] = { 'b', 'a', 's' }; +static const symbol s_262[] = { 'a', 's' }; +static const symbol s_263[] = { 'c', 'i', 'n' }; +static const symbol s_264[] = { 'a', 's', 't', 'a', 'j' }; +static const symbol s_265[] = { 'i', 's', 't', 'a', 'j' }; +static const symbol s_266[] = { 'o', 's', 't', 'a', 'j' }; +static const symbol s_267[] = { 'a', 's', 't', 'a' }; +static const symbol s_268[] = { 'i', 's', 't', 'a' }; +static const symbol s_269[] = { 'o', 's', 't', 'a' }; +static const symbol s_270[] = { 'a', 'v', 'a' }; +static const symbol s_271[] = { 'e', 'v', 'a' }; +static const symbol s_272[] = { 'i', 'v', 'a' }; +static const symbol s_273[] = { 'u', 'v', 'a' }; +static const symbol s_274[] = { 'o', 'v', 'a' }; +static const symbol s_275[] = { 'j', 'e', 't', 'i' }; +static const symbol s_276[] = { 'i', 'n', 'j' }; +static const symbol s_277[] = { 'i', 's', 't' }; +static const symbol s_278[] = { 'e', 's' }; +static const symbol s_279[] = { 'e', 't' }; +static const symbol s_280[] = { 'i', 's' }; +static const symbol s_281[] = { 'i', 'r' }; +static const symbol s_282[] = { 'u', 'r' }; +static const symbol s_283[] = { 'u', 'j' }; +static const symbol s_284[] = { 'n', 'i' }; +static const symbol s_285[] = { 's', 'n' }; +static const symbol s_286[] = { 't', 'a' }; +static const symbol s_287[] = { 'a' }; +static const symbol s_288[] = { 'i' }; +static const symbol s_289[] = { 'e' }; +static const symbol s_290[] = { 'n' }; + +static int r_cyr_to_lat(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 30); + if (!among_var) goto lab2; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 1, s_6); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 1, s_9); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 1, s_10); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 2, s_13); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 1, s_14); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 1, s_15); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 2, s_16); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 1, s_17); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 1, s_18); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 1, s_19); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 1, s_20); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 1, s_21); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 2, s_22); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 1, s_23); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 1, s_24); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 1, s_25); + if (ret < 0) return ret; + } + break; + case 27: + { + int ret = slice_from_s(z, 1, s_26); + if (ret < 0) return ret; + } + break; + case 28: + { + int ret = slice_from_s(z, 2, s_27); + if (ret < 0) return ret; + } + break; + case 29: + { + int ret = slice_from_s(z, 3, s_28); + if (ret < 0) return ret; + } + break; + case 30: + { + int ret = slice_from_s(z, 2, s_29); + if (ret < 0) return ret; + } + break; + } + z->c = v_3; + break; + lab2: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + return 1; +} + +static int r_prelude(struct SN_env * z) { + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + if (in_grouping_U(z, g_ca, 98, 382, 0)) goto lab2; + z->bra = z->c; + if (!(eq_s(z, 3, s_30))) goto lab2; + z->ket = z->c; + if (in_grouping_U(z, g_ca, 98, 382, 0)) goto lab2; + { + int ret = slice_from_s(z, 1, s_31); + if (ret < 0) return ret; + } + z->c = v_3; + break; + lab2: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int v_4 = z->c; + while (1) { + int v_5 = z->c; + while (1) { + int v_6 = z->c; + if (in_grouping_U(z, g_ca, 98, 382, 0)) goto lab5; + z->bra = z->c; + if (!(eq_s(z, 2, s_32))) goto lab5; + z->ket = z->c; + if (in_grouping_U(z, g_ca, 98, 382, 0)) goto lab5; + { + int ret = slice_from_s(z, 1, s_33); + if (ret < 0) return ret; + } + z->c = v_6; + break; + lab5: + z->c = v_6; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab4; + z->c = ret; + } + } + continue; + lab4: + z->c = v_5; + break; + } + z->c = v_4; + } + { + int v_7 = z->c; + while (1) { + int v_8 = z->c; + while (1) { + int v_9 = z->c; + z->bra = z->c; + if (!(eq_s(z, 2, s_34))) goto lab8; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_35); + if (ret < 0) return ret; + } + z->c = v_9; + break; + lab8: + z->c = v_9; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab7; + z->c = ret; + } + } + continue; + lab7: + z->c = v_8; + break; + } + z->c = v_7; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = 1; + { + int v_1 = z->c; + { + int ret = out_grouping_U(z, g_sa, 263, 382, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = 0; + lab0: + z->c = v_1; + } + z->I[0] = z->l; + { + int v_2 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab1; + z->c += ret; + } + z->I[0] = z->c; + if (z->I[0] >= 2) goto lab1; + { + int ret = in_grouping_U(z, g_v, 97, 117, 1); + if (ret < 0) goto lab1; + z->c += ret; + } + z->I[0] = z->c; + lab1: + z->c = v_2; + } + { + int v_3 = z->c; + while (1) { + if (z->c == z->l || z->p[z->c] != 'r') goto lab3; + z->c++; + break; + lab3: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab2; + z->c = ret; + } + } + { + int v_4 = z->c; + if (z->c < 2) goto lab5; + goto lab4; + lab5: + z->c = v_4; + { + int ret = in_grouping_U(z, g_rg, 114, 114, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab4: + if ((z->I[0] - z->c) <= 1) goto lab2; + z->I[0] = z->c; + lab2: + z->c = v_3; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_Step_1(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((3435050 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_1, 130); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_36); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_37); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 5, s_38); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 5, s_39); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_40); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_41); + if (ret < 0) return ret; + } + break; + case 7: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_42); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 4, s_43); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 5, s_44); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 4, s_45); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 5, s_46); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 4, s_47); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 4, s_48); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 4, s_49); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 4, s_50); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 4, s_51); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 4, s_52); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 4, s_53); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 3, s_54); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 6, s_55); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 6, s_56); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 5, s_57); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 3, s_58); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 3, s_59); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 3, s_60); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 4, s_61); + if (ret < 0) return ret; + } + break; + case 27: + { + int ret = slice_from_s(z, 4, s_62); + if (ret < 0) return ret; + } + break; + case 28: + { + int ret = slice_from_s(z, 5, s_63); + if (ret < 0) return ret; + } + break; + case 29: + { + int ret = slice_from_s(z, 6, s_64); + if (ret < 0) return ret; + } + break; + case 30: + { + int ret = slice_from_s(z, 6, s_65); + if (ret < 0) return ret; + } + break; + case 31: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_66); + if (ret < 0) return ret; + } + break; + case 32: + { + int ret = slice_from_s(z, 5, s_67); + if (ret < 0) return ret; + } + break; + case 33: + { + int ret = slice_from_s(z, 5, s_68); + if (ret < 0) return ret; + } + break; + case 34: + { + int ret = slice_from_s(z, 5, s_69); + if (ret < 0) return ret; + } + break; + case 35: + { + int ret = slice_from_s(z, 6, s_70); + if (ret < 0) return ret; + } + break; + case 36: + { + int ret = slice_from_s(z, 5, s_71); + if (ret < 0) return ret; + } + break; + case 37: + { + int ret = slice_from_s(z, 5, s_72); + if (ret < 0) return ret; + } + break; + case 38: + { + int ret = slice_from_s(z, 5, s_73); + if (ret < 0) return ret; + } + break; + case 39: + { + int ret = slice_from_s(z, 5, s_74); + if (ret < 0) return ret; + } + break; + case 40: + { + int ret = slice_from_s(z, 4, s_75); + if (ret < 0) return ret; + } + break; + case 41: + { + int ret = slice_from_s(z, 4, s_76); + if (ret < 0) return ret; + } + break; + case 42: + { + int ret = slice_from_s(z, 4, s_77); + if (ret < 0) return ret; + } + break; + case 43: + { + int ret = slice_from_s(z, 6, s_78); + if (ret < 0) return ret; + } + break; + case 44: + { + int ret = slice_from_s(z, 6, s_79); + if (ret < 0) return ret; + } + break; + case 45: + { + int ret = slice_from_s(z, 5, s_80); + if (ret < 0) return ret; + } + break; + case 46: + { + int ret = slice_from_s(z, 5, s_81); + if (ret < 0) return ret; + } + break; + case 47: + { + int ret = slice_from_s(z, 4, s_82); + if (ret < 0) return ret; + } + break; + case 48: + { + int ret = slice_from_s(z, 4, s_83); + if (ret < 0) return ret; + } + break; + case 49: + { + int ret = slice_from_s(z, 5, s_84); + if (ret < 0) return ret; + } + break; + case 50: + { + int ret = slice_from_s(z, 6, s_85); + if (ret < 0) return ret; + } + break; + case 51: + { + int ret = slice_from_s(z, 5, s_86); + if (ret < 0) return ret; + } + break; + case 52: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_87); + if (ret < 0) return ret; + } + break; + case 53: + { + int ret = slice_from_s(z, 4, s_88); + if (ret < 0) return ret; + } + break; + case 54: + { + int ret = slice_from_s(z, 5, s_89); + if (ret < 0) return ret; + } + break; + case 55: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_90); + if (ret < 0) return ret; + } + break; + case 56: + { + int ret = slice_from_s(z, 5, s_91); + if (ret < 0) return ret; + } + break; + case 57: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_92); + if (ret < 0) return ret; + } + break; + case 58: + { + int ret = slice_from_s(z, 4, s_93); + if (ret < 0) return ret; + } + break; + case 59: + { + int ret = slice_from_s(z, 4, s_94); + if (ret < 0) return ret; + } + break; + case 60: + { + int ret = slice_from_s(z, 4, s_95); + if (ret < 0) return ret; + } + break; + case 61: + { + int ret = slice_from_s(z, 4, s_96); + if (ret < 0) return ret; + } + break; + case 62: + { + int ret = slice_from_s(z, 4, s_97); + if (ret < 0) return ret; + } + break; + case 63: + { + int ret = slice_from_s(z, 5, s_98); + if (ret < 0) return ret; + } + break; + case 64: + { + int ret = slice_from_s(z, 6, s_99); + if (ret < 0) return ret; + } + break; + case 65: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_100); + if (ret < 0) return ret; + } + break; + case 66: + { + int ret = slice_from_s(z, 5, s_101); + if (ret < 0) return ret; + } + break; + case 67: + { + int ret = slice_from_s(z, 4, s_102); + if (ret < 0) return ret; + } + break; + case 68: + { + int ret = slice_from_s(z, 5, s_103); + if (ret < 0) return ret; + } + break; + case 69: + { + int ret = slice_from_s(z, 6, s_104); + if (ret < 0) return ret; + } + break; + case 70: + { + int ret = slice_from_s(z, 5, s_105); + if (ret < 0) return ret; + } + break; + case 71: + { + int ret = slice_from_s(z, 4, s_106); + if (ret < 0) return ret; + } + break; + case 72: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_107); + if (ret < 0) return ret; + } + break; + case 73: + { + int ret = slice_from_s(z, 3, s_108); + if (ret < 0) return ret; + } + break; + case 74: + { + int ret = slice_from_s(z, 4, s_109); + if (ret < 0) return ret; + } + break; + case 75: + { + int ret = slice_from_s(z, 3, s_110); + if (ret < 0) return ret; + } + break; + case 76: + { + int ret = slice_from_s(z, 3, s_111); + if (ret < 0) return ret; + } + break; + case 77: + { + int ret = slice_from_s(z, 6, s_112); + if (ret < 0) return ret; + } + break; + case 78: + { + int ret = slice_from_s(z, 4, s_113); + if (ret < 0) return ret; + } + break; + case 79: + { + int ret = slice_from_s(z, 3, s_114); + if (ret < 0) return ret; + } + break; + case 80: + { + int ret = slice_from_s(z, 3, s_115); + if (ret < 0) return ret; + } + break; + case 81: + { + int ret = slice_from_s(z, 3, s_116); + if (ret < 0) return ret; + } + break; + case 82: + { + int ret = slice_from_s(z, 4, s_117); + if (ret < 0) return ret; + } + break; + case 83: + { + int ret = slice_from_s(z, 4, s_118); + if (ret < 0) return ret; + } + break; + case 84: + { + int ret = slice_from_s(z, 4, s_119); + if (ret < 0) return ret; + } + break; + case 85: + { + int ret = slice_from_s(z, 4, s_120); + if (ret < 0) return ret; + } + break; + case 86: + { + int ret = slice_from_s(z, 4, s_121); + if (ret < 0) return ret; + } + break; + case 87: + { + int ret = slice_from_s(z, 4, s_122); + if (ret < 0) return ret; + } + break; + case 88: + { + int ret = slice_from_s(z, 4, s_123); + if (ret < 0) return ret; + } + break; + case 89: + { + int ret = slice_from_s(z, 4, s_124); + if (ret < 0) return ret; + } + break; + case 90: + { + int ret = slice_from_s(z, 5, s_125); + if (ret < 0) return ret; + } + break; + case 91: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_126); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_2, 2035); + if (!among_var) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 2, s_127); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_128); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_129); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 4, s_130); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 5, s_131); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 5, s_132); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 5, s_133); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 5, s_134); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 5, s_135); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 2, s_136); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 2, s_137); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 2, s_138); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 1, s_139); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 3, s_140); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 3, s_141); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 3, s_142); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 4, s_143); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 2, s_144); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 3, s_145); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 1, s_146); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 4, s_147); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 3, s_148); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 2, s_149); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 2, s_150); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 2, s_151); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 3, s_152); + if (ret < 0) return ret; + } + break; + case 27: + { + int ret = slice_from_s(z, 4, s_153); + if (ret < 0) return ret; + } + break; + case 28: + { + int ret = slice_from_s(z, 4, s_154); + if (ret < 0) return ret; + } + break; + case 29: + { + int ret = slice_from_s(z, 4, s_155); + if (ret < 0) return ret; + } + break; + case 30: + { + int ret = slice_from_s(z, 3, s_156); + if (ret < 0) return ret; + } + break; + case 31: + { + int ret = slice_from_s(z, 3, s_157); + if (ret < 0) return ret; + } + break; + case 32: + { + int ret = slice_from_s(z, 3, s_158); + if (ret < 0) return ret; + } + break; + case 33: + { + int ret = slice_from_s(z, 3, s_159); + if (ret < 0) return ret; + } + break; + case 34: + { + int ret = slice_from_s(z, 3, s_160); + if (ret < 0) return ret; + } + break; + case 35: + { + int ret = slice_from_s(z, 3, s_161); + if (ret < 0) return ret; + } + break; + case 36: + { + int ret = slice_from_s(z, 3, s_162); + if (ret < 0) return ret; + } + break; + case 37: + { + int ret = slice_from_s(z, 3, s_163); + if (ret < 0) return ret; + } + break; + case 38: + { + int ret = slice_from_s(z, 4, s_164); + if (ret < 0) return ret; + } + break; + case 39: + { + int ret = slice_from_s(z, 3, s_165); + if (ret < 0) return ret; + } + break; + case 40: + { + int ret = slice_from_s(z, 3, s_166); + if (ret < 0) return ret; + } + break; + case 41: + { + int ret = slice_from_s(z, 3, s_167); + if (ret < 0) return ret; + } + break; + case 42: + { + int ret = slice_from_s(z, 3, s_168); + if (ret < 0) return ret; + } + break; + case 43: + { + int ret = slice_from_s(z, 3, s_169); + if (ret < 0) return ret; + } + break; + case 44: + { + int ret = slice_from_s(z, 3, s_170); + if (ret < 0) return ret; + } + break; + case 45: + { + int ret = slice_from_s(z, 3, s_171); + if (ret < 0) return ret; + } + break; + case 46: + { + int ret = slice_from_s(z, 3, s_172); + if (ret < 0) return ret; + } + break; + case 47: + { + int ret = slice_from_s(z, 4, s_173); + if (ret < 0) return ret; + } + break; + case 48: + { + int ret = slice_from_s(z, 4, s_174); + if (ret < 0) return ret; + } + break; + case 49: + { + int ret = slice_from_s(z, 4, s_175); + if (ret < 0) return ret; + } + break; + case 50: + { + int ret = slice_from_s(z, 2, s_176); + if (ret < 0) return ret; + } + break; + case 51: + { + int ret = slice_from_s(z, 3, s_177); + if (ret < 0) return ret; + } + break; + case 52: + { + int ret = slice_from_s(z, 3, s_178); + if (ret < 0) return ret; + } + break; + case 53: + { + int ret = slice_from_s(z, 2, s_179); + if (ret < 0) return ret; + } + break; + case 54: + { + int ret = slice_from_s(z, 2, s_180); + if (ret < 0) return ret; + } + break; + case 55: + { + int ret = slice_from_s(z, 2, s_181); + if (ret < 0) return ret; + } + break; + case 56: + { + int ret = slice_from_s(z, 2, s_182); + if (ret < 0) return ret; + } + break; + case 57: + { + int ret = slice_from_s(z, 2, s_183); + if (ret < 0) return ret; + } + break; + case 58: + { + int ret = slice_from_s(z, 2, s_184); + if (ret < 0) return ret; + } + break; + case 59: + { + int ret = slice_from_s(z, 4, s_185); + if (ret < 0) return ret; + } + break; + case 60: + { + int ret = slice_from_s(z, 4, s_186); + if (ret < 0) return ret; + } + break; + case 61: + { + int ret = slice_from_s(z, 4, s_187); + if (ret < 0) return ret; + } + break; + case 62: + { + int ret = slice_from_s(z, 4, s_188); + if (ret < 0) return ret; + } + break; + case 63: + { + int ret = slice_from_s(z, 4, s_189); + if (ret < 0) return ret; + } + break; + case 64: + { + int ret = slice_from_s(z, 4, s_190); + if (ret < 0) return ret; + } + break; + case 65: + { + int ret = slice_from_s(z, 4, s_191); + if (ret < 0) return ret; + } + break; + case 66: + { + int ret = slice_from_s(z, 3, s_192); + if (ret < 0) return ret; + } + break; + case 67: + { + int ret = slice_from_s(z, 3, s_193); + if (ret < 0) return ret; + } + break; + case 68: + { + int ret = slice_from_s(z, 4, s_194); + if (ret < 0) return ret; + } + break; + case 69: + { + int ret = slice_from_s(z, 3, s_195); + if (ret < 0) return ret; + } + break; + case 70: + { + int ret = slice_from_s(z, 2, s_196); + if (ret < 0) return ret; + } + break; + case 71: + { + int ret = slice_from_s(z, 3, s_197); + if (ret < 0) return ret; + } + break; + case 72: + { + int ret = slice_from_s(z, 3, s_198); + if (ret < 0) return ret; + } + break; + case 73: + { + int ret = slice_from_s(z, 3, s_199); + if (ret < 0) return ret; + } + break; + case 74: + { + int ret = slice_from_s(z, 3, s_200); + if (ret < 0) return ret; + } + break; + case 75: + { + int ret = slice_from_s(z, 4, s_201); + if (ret < 0) return ret; + } + break; + case 76: + { + int ret = slice_from_s(z, 3, s_202); + if (ret < 0) return ret; + } + break; + case 77: + { + int ret = slice_from_s(z, 2, s_203); + if (ret < 0) return ret; + } + break; + case 78: + { + int ret = slice_from_s(z, 2, s_204); + if (ret < 0) return ret; + } + break; + case 79: + { + int ret = slice_from_s(z, 2, s_205); + if (ret < 0) return ret; + } + break; + case 80: + { + int ret = slice_from_s(z, 2, s_206); + if (ret < 0) return ret; + } + break; + case 81: + { + int ret = slice_from_s(z, 3, s_207); + if (ret < 0) return ret; + } + break; + case 82: + { + int ret = slice_from_s(z, 3, s_208); + if (ret < 0) return ret; + } + break; + case 83: + { + int ret = slice_from_s(z, 2, s_209); + if (ret < 0) return ret; + } + break; + case 84: + { + int ret = slice_from_s(z, 3, s_210); + if (ret < 0) return ret; + } + break; + case 85: + { + int ret = slice_from_s(z, 3, s_211); + if (ret < 0) return ret; + } + break; + case 86: + { + int ret = slice_from_s(z, 4, s_212); + if (ret < 0) return ret; + } + break; + case 87: + { + int ret = slice_from_s(z, 2, s_213); + if (ret < 0) return ret; + } + break; + case 88: + { + int ret = slice_from_s(z, 3, s_214); + if (ret < 0) return ret; + } + break; + case 89: + { + int ret = slice_from_s(z, 4, s_215); + if (ret < 0) return ret; + } + break; + case 90: + { + int ret = slice_from_s(z, 5, s_216); + if (ret < 0) return ret; + } + break; + case 91: + { + int ret = slice_from_s(z, 3, s_217); + if (ret < 0) return ret; + } + break; + case 92: + { + int ret = slice_from_s(z, 4, s_218); + if (ret < 0) return ret; + } + break; + case 93: + { + int ret = slice_from_s(z, 4, s_219); + if (ret < 0) return ret; + } + break; + case 94: + { + int ret = slice_from_s(z, 3, s_220); + if (ret < 0) return ret; + } + break; + case 95: + { + int ret = slice_from_s(z, 1, s_221); + if (ret < 0) return ret; + } + break; + case 96: + { + int ret = slice_from_s(z, 3, s_222); + if (ret < 0) return ret; + } + break; + case 97: + { + int ret = slice_from_s(z, 3, s_223); + if (ret < 0) return ret; + } + break; + case 98: + { + int ret = slice_from_s(z, 3, s_224); + if (ret < 0) return ret; + } + break; + case 99: + { + int ret = slice_from_s(z, 3, s_225); + if (ret < 0) return ret; + } + break; + case 100: + { + int ret = slice_from_s(z, 2, s_226); + if (ret < 0) return ret; + } + break; + case 101: + { + int ret = slice_from_s(z, 3, s_227); + if (ret < 0) return ret; + } + break; + case 102: + { + int ret = slice_from_s(z, 4, s_228); + if (ret < 0) return ret; + } + break; + case 103: + { + int ret = slice_from_s(z, 2, s_229); + if (ret < 0) return ret; + } + break; + case 104: + { + int ret = slice_from_s(z, 1, s_230); + if (ret < 0) return ret; + } + break; + case 105: + { + int ret = slice_from_s(z, 2, s_231); + if (ret < 0) return ret; + } + break; + case 106: + { + int ret = slice_from_s(z, 5, s_232); + if (ret < 0) return ret; + } + break; + case 107: + { + int ret = slice_from_s(z, 5, s_233); + if (ret < 0) return ret; + } + break; + case 108: + { + int ret = slice_from_s(z, 5, s_234); + if (ret < 0) return ret; + } + break; + case 109: + { + int ret = slice_from_s(z, 2, s_235); + if (ret < 0) return ret; + } + break; + case 110: + { + int ret = slice_from_s(z, 4, s_236); + if (ret < 0) return ret; + } + break; + case 111: + { + int ret = slice_from_s(z, 4, s_237); + if (ret < 0) return ret; + } + break; + case 112: + { + int ret = slice_from_s(z, 4, s_238); + if (ret < 0) return ret; + } + break; + case 113: + { + int ret = slice_from_s(z, 2, s_239); + if (ret < 0) return ret; + } + break; + case 114: + { + int ret = slice_from_s(z, 3, s_240); + if (ret < 0) return ret; + } + break; + case 115: + { + int ret = slice_from_s(z, 2, s_241); + if (ret < 0) return ret; + } + break; + case 116: + { + int ret = slice_from_s(z, 1, s_242); + if (ret < 0) return ret; + } + break; + case 117: + { + int ret = slice_from_s(z, 4, s_243); + if (ret < 0) return ret; + } + break; + case 118: + { + int ret = slice_from_s(z, 4, s_244); + if (ret < 0) return ret; + } + break; + case 119: + { + int ret = slice_from_s(z, 1, s_245); + if (ret < 0) return ret; + } + break; + case 120: + { + int ret = slice_from_s(z, 2, s_246); + if (ret < 0) return ret; + } + break; + case 121: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_247); + if (ret < 0) return ret; + } + break; + case 122: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_248); + if (ret < 0) return ret; + } + break; + case 123: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_249); + if (ret < 0) return ret; + } + break; + case 124: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_250); + if (ret < 0) return ret; + } + break; + case 125: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_251); + if (ret < 0) return ret; + } + break; + case 126: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_252); + if (ret < 0) return ret; + } + break; + case 127: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_253); + if (ret < 0) return ret; + } + break; + case 128: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_254); + if (ret < 0) return ret; + } + break; + case 129: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_255); + if (ret < 0) return ret; + } + break; + case 130: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_256); + if (ret < 0) return ret; + } + break; + case 131: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_257); + if (ret < 0) return ret; + } + break; + case 132: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_258); + if (ret < 0) return ret; + } + break; + case 133: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_259); + if (ret < 0) return ret; + } + break; + case 134: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_260); + if (ret < 0) return ret; + } + break; + case 135: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_261); + if (ret < 0) return ret; + } + break; + case 136: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_262); + if (ret < 0) return ret; + } + break; + case 137: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_263); + if (ret < 0) return ret; + } + break; + case 138: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_264); + if (ret < 0) return ret; + } + break; + case 139: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_265); + if (ret < 0) return ret; + } + break; + case 140: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 5, s_266); + if (ret < 0) return ret; + } + break; + case 141: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_267); + if (ret < 0) return ret; + } + break; + case 142: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_268); + if (ret < 0) return ret; + } + break; + case 143: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_269); + if (ret < 0) return ret; + } + break; + case 144: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_270); + if (ret < 0) return ret; + } + break; + case 145: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_271); + if (ret < 0) return ret; + } + break; + case 146: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_272); + if (ret < 0) return ret; + } + break; + case 147: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_273); + if (ret < 0) return ret; + } + break; + case 148: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_274); + if (ret < 0) return ret; + } + break; + case 149: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 4, s_275); + if (ret < 0) return ret; + } + break; + case 150: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_276); + if (ret < 0) return ret; + } + break; + case 151: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 3, s_277); + if (ret < 0) return ret; + } + break; + case 152: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_278); + if (ret < 0) return ret; + } + break; + case 153: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_279); + if (ret < 0) return ret; + } + break; + case 154: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_280); + if (ret < 0) return ret; + } + break; + case 155: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_281); + if (ret < 0) return ret; + } + break; + case 156: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_282); + if (ret < 0) return ret; + } + break; + case 157: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_283); + if (ret < 0) return ret; + } + break; + case 158: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_284); + if (ret < 0) return ret; + } + break; + case 159: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_285); + if (ret < 0) return ret; + } + break; + case 160: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 2, s_286); + if (ret < 0) return ret; + } + break; + case 161: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 1, s_287); + if (ret < 0) return ret; + } + break; + case 162: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 1, s_288); + if (ret < 0) return ret; + } + break; + case 163: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 1, s_289); + if (ret < 0) return ret; + } + break; + case 164: + if (!(z->I[1])) return 0; + { + int ret = slice_from_s(z, 1, s_290); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((3188642 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_3, 26)) return 0; + z->bra = z->c; + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 0, 0); + if (ret < 0) return ret; + } + return 1; +} + +extern int serbian_UTF_8_stem(struct SN_env * z) { + { + int ret = r_cyr_to_lat(z); + if (ret < 0) return ret; + } + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_Step_1(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_Step_2(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_Step_3(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * serbian_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void serbian_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_serbian.h b/contrib/libs/snowball/src_c/stem_UTF_8_serbian.h new file mode 100644 index 000000000000..fda51cd4932b --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_serbian.h @@ -0,0 +1,15 @@ +/* Generated from serbian.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * serbian_UTF_8_create_env(void); +extern void serbian_UTF_8_close_env(struct SN_env * z); + +extern int serbian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_spanish.c b/contrib/libs/snowball/src_c/stem_UTF_8_spanish.c new file mode 100644 index 000000000000..f7254ff6e132 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_spanish.c @@ -0,0 +1,1105 @@ +/* Generated from spanish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int spanish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_y_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * spanish_UTF_8_create_env(void); +extern void spanish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 0xC3, 0xA1 }; +static const symbol s_0_2[2] = { 0xC3, 0xA9 }; +static const symbol s_0_3[2] = { 0xC3, 0xAD }; +static const symbol s_0_4[2] = { 0xC3, 0xB3 }; +static const symbol s_0_5[2] = { 0xC3, 0xBA }; +static const struct among a_0[6] = { +{ 0, 0, 0, 6, 0}, +{ 2, s_0_1, -1, 1, 0}, +{ 2, s_0_2, -2, 2, 0}, +{ 2, s_0_3, -3, 3, 0}, +{ 2, s_0_4, -4, 4, 0}, +{ 2, s_0_5, -5, 5, 0} +}; + +static const symbol s_1_0[2] = { 'l', 'a' }; +static const symbol s_1_1[4] = { 's', 'e', 'l', 'a' }; +static const symbol s_1_2[2] = { 'l', 'e' }; +static const symbol s_1_3[2] = { 'm', 'e' }; +static const symbol s_1_4[2] = { 's', 'e' }; +static const symbol s_1_5[2] = { 'l', 'o' }; +static const symbol s_1_6[4] = { 's', 'e', 'l', 'o' }; +static const symbol s_1_7[3] = { 'l', 'a', 's' }; +static const symbol s_1_8[5] = { 's', 'e', 'l', 'a', 's' }; +static const symbol s_1_9[3] = { 'l', 'e', 's' }; +static const symbol s_1_10[3] = { 'l', 'o', 's' }; +static const symbol s_1_11[5] = { 's', 'e', 'l', 'o', 's' }; +static const symbol s_1_12[3] = { 'n', 'o', 's' }; +static const struct among a_1[13] = { +{ 2, s_1_0, 0, -1, 0}, +{ 4, s_1_1, -1, -1, 0}, +{ 2, s_1_2, 0, -1, 0}, +{ 2, s_1_3, 0, -1, 0}, +{ 2, s_1_4, 0, -1, 0}, +{ 2, s_1_5, 0, -1, 0}, +{ 4, s_1_6, -1, -1, 0}, +{ 3, s_1_7, 0, -1, 0}, +{ 5, s_1_8, -1, -1, 0}, +{ 3, s_1_9, 0, -1, 0}, +{ 3, s_1_10, 0, -1, 0}, +{ 5, s_1_11, -1, -1, 0}, +{ 3, s_1_12, 0, -1, 0} +}; + +static const symbol s_2_0[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_2_1[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_2_2[5] = { 'y', 'e', 'n', 'd', 'o' }; +static const symbol s_2_3[5] = { 0xC3, 0xA1, 'n', 'd', 'o' }; +static const symbol s_2_4[6] = { 'i', 0xC3, 0xA9, 'n', 'd', 'o' }; +static const symbol s_2_5[2] = { 'a', 'r' }; +static const symbol s_2_6[2] = { 'e', 'r' }; +static const symbol s_2_7[2] = { 'i', 'r' }; +static const symbol s_2_8[3] = { 0xC3, 0xA1, 'r' }; +static const symbol s_2_9[3] = { 0xC3, 0xA9, 'r' }; +static const symbol s_2_10[3] = { 0xC3, 0xAD, 'r' }; +static const struct among a_2[11] = { +{ 4, s_2_0, 0, 6, 0}, +{ 5, s_2_1, 0, 6, 0}, +{ 5, s_2_2, 0, 7, 0}, +{ 5, s_2_3, 0, 2, 0}, +{ 6, s_2_4, 0, 1, 0}, +{ 2, s_2_5, 0, 6, 0}, +{ 2, s_2_6, 0, 6, 0}, +{ 2, s_2_7, 0, 6, 0}, +{ 3, s_2_8, 0, 3, 0}, +{ 3, s_2_9, 0, 4, 0}, +{ 3, s_2_10, 0, 5, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'c' }; +static const symbol s_3_1[2] = { 'a', 'd' }; +static const symbol s_3_2[2] = { 'o', 's' }; +static const symbol s_3_3[2] = { 'i', 'v' }; +static const struct among a_3[4] = { +{ 2, s_3_0, 0, -1, 0}, +{ 2, s_3_1, 0, -1, 0}, +{ 2, s_3_2, 0, -1, 0}, +{ 2, s_3_3, 0, 1, 0} +}; + +static const symbol s_4_0[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_4_1[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_4_2[4] = { 'a', 'n', 't', 'e' }; +static const struct among a_4[3] = { +{ 4, s_4_0, 0, 1, 0}, +{ 4, s_4_1, 0, 1, 0}, +{ 4, s_4_2, 0, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_5_2[2] = { 'i', 'v' }; +static const struct among a_5[3] = { +{ 2, s_5_0, 0, 1, 0}, +{ 4, s_5_1, 0, 1, 0}, +{ 2, s_5_2, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 'i', 'c', 'a' }; +static const symbol s_6_1[5] = { 'a', 'n', 'c', 'i', 'a' }; +static const symbol s_6_2[5] = { 'e', 'n', 'c', 'i', 'a' }; +static const symbol s_6_3[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_6_4[3] = { 'o', 's', 'a' }; +static const symbol s_6_5[4] = { 'i', 's', 't', 'a' }; +static const symbol s_6_6[3] = { 'i', 'v', 'a' }; +static const symbol s_6_7[4] = { 'a', 'n', 'z', 'a' }; +static const symbol s_6_8[6] = { 'l', 'o', 'g', 0xC3, 0xAD, 'a' }; +static const symbol s_6_9[4] = { 'i', 'd', 'a', 'd' }; +static const symbol s_6_10[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_6_11[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_6_12[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_13[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_14[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_15[5] = { 'a', 'c', 'i', 'o', 'n' }; +static const symbol s_6_16[5] = { 'u', 'c', 'i', 'o', 'n' }; +static const symbol s_6_17[6] = { 'a', 'c', 'i', 0xC3, 0xB3, 'n' }; +static const symbol s_6_18[6] = { 'u', 'c', 'i', 0xC3, 0xB3, 'n' }; +static const symbol s_6_19[3] = { 'i', 'c', 'o' }; +static const symbol s_6_20[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_6_21[3] = { 'o', 's', 'o' }; +static const symbol s_6_22[7] = { 'a', 'm', 'i', 'e', 'n', 't', 'o' }; +static const symbol s_6_23[7] = { 'i', 'm', 'i', 'e', 'n', 't', 'o' }; +static const symbol s_6_24[3] = { 'i', 'v', 'o' }; +static const symbol s_6_25[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_6_26[4] = { 'i', 'c', 'a', 's' }; +static const symbol s_6_27[6] = { 'a', 'n', 'c', 'i', 'a', 's' }; +static const symbol s_6_28[6] = { 'e', 'n', 'c', 'i', 'a', 's' }; +static const symbol s_6_29[6] = { 'a', 'd', 'o', 'r', 'a', 's' }; +static const symbol s_6_30[4] = { 'o', 's', 'a', 's' }; +static const symbol s_6_31[5] = { 'i', 's', 't', 'a', 's' }; +static const symbol s_6_32[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_6_33[5] = { 'a', 'n', 'z', 'a', 's' }; +static const symbol s_6_34[7] = { 'l', 'o', 'g', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_6_35[6] = { 'i', 'd', 'a', 'd', 'e', 's' }; +static const symbol s_6_36[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_6_37[5] = { 'i', 'b', 'l', 'e', 's' }; +static const symbol s_6_38[7] = { 'a', 'c', 'i', 'o', 'n', 'e', 's' }; +static const symbol s_6_39[7] = { 'u', 'c', 'i', 'o', 'n', 'e', 's' }; +static const symbol s_6_40[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_6_41[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_6_42[4] = { 'i', 'c', 'o', 's' }; +static const symbol s_6_43[5] = { 'i', 's', 'm', 'o', 's' }; +static const symbol s_6_44[4] = { 'o', 's', 'o', 's' }; +static const symbol s_6_45[8] = { 'a', 'm', 'i', 'e', 'n', 't', 'o', 's' }; +static const symbol s_6_46[8] = { 'i', 'm', 'i', 'e', 'n', 't', 'o', 's' }; +static const symbol s_6_47[4] = { 'i', 'v', 'o', 's' }; +static const struct among a_6[48] = { +{ 3, s_6_0, 0, 1, 0}, +{ 5, s_6_1, 0, 2, 0}, +{ 5, s_6_2, 0, 5, 0}, +{ 5, s_6_3, 0, 2, 0}, +{ 3, s_6_4, 0, 1, 0}, +{ 4, s_6_5, 0, 1, 0}, +{ 3, s_6_6, 0, 9, 0}, +{ 4, s_6_7, 0, 1, 0}, +{ 6, s_6_8, 0, 3, 0}, +{ 4, s_6_9, 0, 8, 0}, +{ 4, s_6_10, 0, 1, 0}, +{ 4, s_6_11, 0, 1, 0}, +{ 4, s_6_12, 0, 2, 0}, +{ 5, s_6_13, 0, 7, 0}, +{ 6, s_6_14, -1, 6, 0}, +{ 5, s_6_15, 0, 2, 0}, +{ 5, s_6_16, 0, 4, 0}, +{ 6, s_6_17, 0, 2, 0}, +{ 6, s_6_18, 0, 4, 0}, +{ 3, s_6_19, 0, 1, 0}, +{ 4, s_6_20, 0, 1, 0}, +{ 3, s_6_21, 0, 1, 0}, +{ 7, s_6_22, 0, 1, 0}, +{ 7, s_6_23, 0, 1, 0}, +{ 3, s_6_24, 0, 9, 0}, +{ 4, s_6_25, 0, 2, 0}, +{ 4, s_6_26, 0, 1, 0}, +{ 6, s_6_27, 0, 2, 0}, +{ 6, s_6_28, 0, 5, 0}, +{ 6, s_6_29, 0, 2, 0}, +{ 4, s_6_30, 0, 1, 0}, +{ 5, s_6_31, 0, 1, 0}, +{ 4, s_6_32, 0, 9, 0}, +{ 5, s_6_33, 0, 1, 0}, +{ 7, s_6_34, 0, 3, 0}, +{ 6, s_6_35, 0, 8, 0}, +{ 5, s_6_36, 0, 1, 0}, +{ 5, s_6_37, 0, 1, 0}, +{ 7, s_6_38, 0, 2, 0}, +{ 7, s_6_39, 0, 4, 0}, +{ 6, s_6_40, 0, 2, 0}, +{ 5, s_6_41, 0, 2, 0}, +{ 4, s_6_42, 0, 1, 0}, +{ 5, s_6_43, 0, 1, 0}, +{ 4, s_6_44, 0, 1, 0}, +{ 8, s_6_45, 0, 1, 0}, +{ 8, s_6_46, 0, 1, 0}, +{ 4, s_6_47, 0, 9, 0} +}; + +static const symbol s_7_0[2] = { 'y', 'a' }; +static const symbol s_7_1[2] = { 'y', 'e' }; +static const symbol s_7_2[3] = { 'y', 'a', 'n' }; +static const symbol s_7_3[3] = { 'y', 'e', 'n' }; +static const symbol s_7_4[5] = { 'y', 'e', 'r', 'o', 'n' }; +static const symbol s_7_5[5] = { 'y', 'e', 'n', 'd', 'o' }; +static const symbol s_7_6[2] = { 'y', 'o' }; +static const symbol s_7_7[3] = { 'y', 'a', 's' }; +static const symbol s_7_8[3] = { 'y', 'e', 's' }; +static const symbol s_7_9[4] = { 'y', 'a', 'i', 's' }; +static const symbol s_7_10[5] = { 'y', 'a', 'm', 'o', 's' }; +static const symbol s_7_11[3] = { 'y', 0xC3, 0xB3 }; +static const struct among a_7[12] = { +{ 2, s_7_0, 0, 1, 0}, +{ 2, s_7_1, 0, 1, 0}, +{ 3, s_7_2, 0, 1, 0}, +{ 3, s_7_3, 0, 1, 0}, +{ 5, s_7_4, 0, 1, 0}, +{ 5, s_7_5, 0, 1, 0}, +{ 2, s_7_6, 0, 1, 0}, +{ 3, s_7_7, 0, 1, 0}, +{ 3, s_7_8, 0, 1, 0}, +{ 4, s_7_9, 0, 1, 0}, +{ 5, s_7_10, 0, 1, 0}, +{ 3, s_7_11, 0, 1, 0} +}; + +static const symbol s_8_0[3] = { 'a', 'b', 'a' }; +static const symbol s_8_1[3] = { 'a', 'd', 'a' }; +static const symbol s_8_2[3] = { 'i', 'd', 'a' }; +static const symbol s_8_3[3] = { 'a', 'r', 'a' }; +static const symbol s_8_4[4] = { 'i', 'e', 'r', 'a' }; +static const symbol s_8_5[3] = { 0xC3, 0xAD, 'a' }; +static const symbol s_8_6[5] = { 'a', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_8_7[5] = { 'e', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_8_8[5] = { 'i', 'r', 0xC3, 0xAD, 'a' }; +static const symbol s_8_9[2] = { 'a', 'd' }; +static const symbol s_8_10[2] = { 'e', 'd' }; +static const symbol s_8_11[2] = { 'i', 'd' }; +static const symbol s_8_12[3] = { 'a', 's', 'e' }; +static const symbol s_8_13[4] = { 'i', 'e', 's', 'e' }; +static const symbol s_8_14[4] = { 'a', 's', 't', 'e' }; +static const symbol s_8_15[4] = { 'i', 's', 't', 'e' }; +static const symbol s_8_16[2] = { 'a', 'n' }; +static const symbol s_8_17[4] = { 'a', 'b', 'a', 'n' }; +static const symbol s_8_18[4] = { 'a', 'r', 'a', 'n' }; +static const symbol s_8_19[5] = { 'i', 'e', 'r', 'a', 'n' }; +static const symbol s_8_20[4] = { 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_8_21[6] = { 'a', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_8_22[6] = { 'e', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_8_23[6] = { 'i', 'r', 0xC3, 0xAD, 'a', 'n' }; +static const symbol s_8_24[2] = { 'e', 'n' }; +static const symbol s_8_25[4] = { 'a', 's', 'e', 'n' }; +static const symbol s_8_26[5] = { 'i', 'e', 's', 'e', 'n' }; +static const symbol s_8_27[4] = { 'a', 'r', 'o', 'n' }; +static const symbol s_8_28[5] = { 'i', 'e', 'r', 'o', 'n' }; +static const symbol s_8_29[5] = { 'a', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_8_30[5] = { 'e', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_8_31[5] = { 'i', 'r', 0xC3, 0xA1, 'n' }; +static const symbol s_8_32[3] = { 'a', 'd', 'o' }; +static const symbol s_8_33[3] = { 'i', 'd', 'o' }; +static const symbol s_8_34[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_8_35[5] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_8_36[2] = { 'a', 'r' }; +static const symbol s_8_37[2] = { 'e', 'r' }; +static const symbol s_8_38[2] = { 'i', 'r' }; +static const symbol s_8_39[2] = { 'a', 's' }; +static const symbol s_8_40[4] = { 'a', 'b', 'a', 's' }; +static const symbol s_8_41[4] = { 'a', 'd', 'a', 's' }; +static const symbol s_8_42[4] = { 'i', 'd', 'a', 's' }; +static const symbol s_8_43[4] = { 'a', 'r', 'a', 's' }; +static const symbol s_8_44[5] = { 'i', 'e', 'r', 'a', 's' }; +static const symbol s_8_45[4] = { 0xC3, 0xAD, 'a', 's' }; +static const symbol s_8_46[6] = { 'a', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_8_47[6] = { 'e', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_8_48[6] = { 'i', 'r', 0xC3, 0xAD, 'a', 's' }; +static const symbol s_8_49[2] = { 'e', 's' }; +static const symbol s_8_50[4] = { 'a', 's', 'e', 's' }; +static const symbol s_8_51[5] = { 'i', 'e', 's', 'e', 's' }; +static const symbol s_8_52[5] = { 'a', 'b', 'a', 'i', 's' }; +static const symbol s_8_53[5] = { 'a', 'r', 'a', 'i', 's' }; +static const symbol s_8_54[6] = { 'i', 'e', 'r', 'a', 'i', 's' }; +static const symbol s_8_55[5] = { 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_8_56[7] = { 'a', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_8_57[7] = { 'e', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_8_58[7] = { 'i', 'r', 0xC3, 0xAD, 'a', 'i', 's' }; +static const symbol s_8_59[5] = { 'a', 's', 'e', 'i', 's' }; +static const symbol s_8_60[6] = { 'i', 'e', 's', 'e', 'i', 's' }; +static const symbol s_8_61[6] = { 'a', 's', 't', 'e', 'i', 's' }; +static const symbol s_8_62[6] = { 'i', 's', 't', 'e', 'i', 's' }; +static const symbol s_8_63[4] = { 0xC3, 0xA1, 'i', 's' }; +static const symbol s_8_64[4] = { 0xC3, 0xA9, 'i', 's' }; +static const symbol s_8_65[6] = { 'a', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_8_66[6] = { 'e', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_8_67[6] = { 'i', 'r', 0xC3, 0xA9, 'i', 's' }; +static const symbol s_8_68[4] = { 'a', 'd', 'o', 's' }; +static const symbol s_8_69[4] = { 'i', 'd', 'o', 's' }; +static const symbol s_8_70[4] = { 'a', 'm', 'o', 's' }; +static const symbol s_8_71[7] = { 0xC3, 0xA1, 'b', 'a', 'm', 'o', 's' }; +static const symbol s_8_72[7] = { 0xC3, 0xA1, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_8_73[8] = { 'i', 0xC3, 0xA9, 'r', 'a', 'm', 'o', 's' }; +static const symbol s_8_74[6] = { 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_8_75[8] = { 'a', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_8_76[8] = { 'e', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_8_77[8] = { 'i', 'r', 0xC3, 0xAD, 'a', 'm', 'o', 's' }; +static const symbol s_8_78[4] = { 'e', 'm', 'o', 's' }; +static const symbol s_8_79[6] = { 'a', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_80[6] = { 'e', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_81[6] = { 'i', 'r', 'e', 'm', 'o', 's' }; +static const symbol s_8_82[7] = { 0xC3, 0xA1, 's', 'e', 'm', 'o', 's' }; +static const symbol s_8_83[8] = { 'i', 0xC3, 0xA9, 's', 'e', 'm', 'o', 's' }; +static const symbol s_8_84[4] = { 'i', 'm', 'o', 's' }; +static const symbol s_8_85[5] = { 'a', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_8_86[5] = { 'e', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_8_87[5] = { 'i', 'r', 0xC3, 0xA1, 's' }; +static const symbol s_8_88[3] = { 0xC3, 0xAD, 's' }; +static const symbol s_8_89[4] = { 'a', 'r', 0xC3, 0xA1 }; +static const symbol s_8_90[4] = { 'e', 'r', 0xC3, 0xA1 }; +static const symbol s_8_91[4] = { 'i', 'r', 0xC3, 0xA1 }; +static const symbol s_8_92[4] = { 'a', 'r', 0xC3, 0xA9 }; +static const symbol s_8_93[4] = { 'e', 'r', 0xC3, 0xA9 }; +static const symbol s_8_94[4] = { 'i', 'r', 0xC3, 0xA9 }; +static const symbol s_8_95[3] = { 'i', 0xC3, 0xB3 }; +static const struct among a_8[96] = { +{ 3, s_8_0, 0, 2, 0}, +{ 3, s_8_1, 0, 2, 0}, +{ 3, s_8_2, 0, 2, 0}, +{ 3, s_8_3, 0, 2, 0}, +{ 4, s_8_4, 0, 2, 0}, +{ 3, s_8_5, 0, 2, 0}, +{ 5, s_8_6, -1, 2, 0}, +{ 5, s_8_7, -2, 2, 0}, +{ 5, s_8_8, -3, 2, 0}, +{ 2, s_8_9, 0, 2, 0}, +{ 2, s_8_10, 0, 2, 0}, +{ 2, s_8_11, 0, 2, 0}, +{ 3, s_8_12, 0, 2, 0}, +{ 4, s_8_13, 0, 2, 0}, +{ 4, s_8_14, 0, 2, 0}, +{ 4, s_8_15, 0, 2, 0}, +{ 2, s_8_16, 0, 2, 0}, +{ 4, s_8_17, -1, 2, 0}, +{ 4, s_8_18, -2, 2, 0}, +{ 5, s_8_19, -3, 2, 0}, +{ 4, s_8_20, -4, 2, 0}, +{ 6, s_8_21, -1, 2, 0}, +{ 6, s_8_22, -2, 2, 0}, +{ 6, s_8_23, -3, 2, 0}, +{ 2, s_8_24, 0, 1, 0}, +{ 4, s_8_25, -1, 2, 0}, +{ 5, s_8_26, -2, 2, 0}, +{ 4, s_8_27, 0, 2, 0}, +{ 5, s_8_28, 0, 2, 0}, +{ 5, s_8_29, 0, 2, 0}, +{ 5, s_8_30, 0, 2, 0}, +{ 5, s_8_31, 0, 2, 0}, +{ 3, s_8_32, 0, 2, 0}, +{ 3, s_8_33, 0, 2, 0}, +{ 4, s_8_34, 0, 2, 0}, +{ 5, s_8_35, 0, 2, 0}, +{ 2, s_8_36, 0, 2, 0}, +{ 2, s_8_37, 0, 2, 0}, +{ 2, s_8_38, 0, 2, 0}, +{ 2, s_8_39, 0, 2, 0}, +{ 4, s_8_40, -1, 2, 0}, +{ 4, s_8_41, -2, 2, 0}, +{ 4, s_8_42, -3, 2, 0}, +{ 4, s_8_43, -4, 2, 0}, +{ 5, s_8_44, -5, 2, 0}, +{ 4, s_8_45, -6, 2, 0}, +{ 6, s_8_46, -1, 2, 0}, +{ 6, s_8_47, -2, 2, 0}, +{ 6, s_8_48, -3, 2, 0}, +{ 2, s_8_49, 0, 1, 0}, +{ 4, s_8_50, -1, 2, 0}, +{ 5, s_8_51, -2, 2, 0}, +{ 5, s_8_52, 0, 2, 0}, +{ 5, s_8_53, 0, 2, 0}, +{ 6, s_8_54, 0, 2, 0}, +{ 5, s_8_55, 0, 2, 0}, +{ 7, s_8_56, -1, 2, 0}, +{ 7, s_8_57, -2, 2, 0}, +{ 7, s_8_58, -3, 2, 0}, +{ 5, s_8_59, 0, 2, 0}, +{ 6, s_8_60, 0, 2, 0}, +{ 6, s_8_61, 0, 2, 0}, +{ 6, s_8_62, 0, 2, 0}, +{ 4, s_8_63, 0, 2, 0}, +{ 4, s_8_64, 0, 1, 0}, +{ 6, s_8_65, -1, 2, 0}, +{ 6, s_8_66, -2, 2, 0}, +{ 6, s_8_67, -3, 2, 0}, +{ 4, s_8_68, 0, 2, 0}, +{ 4, s_8_69, 0, 2, 0}, +{ 4, s_8_70, 0, 2, 0}, +{ 7, s_8_71, -1, 2, 0}, +{ 7, s_8_72, -2, 2, 0}, +{ 8, s_8_73, -3, 2, 0}, +{ 6, s_8_74, -4, 2, 0}, +{ 8, s_8_75, -1, 2, 0}, +{ 8, s_8_76, -2, 2, 0}, +{ 8, s_8_77, -3, 2, 0}, +{ 4, s_8_78, 0, 1, 0}, +{ 6, s_8_79, -1, 2, 0}, +{ 6, s_8_80, -2, 2, 0}, +{ 6, s_8_81, -3, 2, 0}, +{ 7, s_8_82, -4, 2, 0}, +{ 8, s_8_83, -5, 2, 0}, +{ 4, s_8_84, 0, 2, 0}, +{ 5, s_8_85, 0, 2, 0}, +{ 5, s_8_86, 0, 2, 0}, +{ 5, s_8_87, 0, 2, 0}, +{ 3, s_8_88, 0, 2, 0}, +{ 4, s_8_89, 0, 2, 0}, +{ 4, s_8_90, 0, 2, 0}, +{ 4, s_8_91, 0, 2, 0}, +{ 4, s_8_92, 0, 2, 0}, +{ 4, s_8_93, 0, 2, 0}, +{ 4, s_8_94, 0, 2, 0}, +{ 3, s_8_95, 0, 2, 0} +}; + +static const symbol s_9_0[1] = { 'a' }; +static const symbol s_9_1[1] = { 'e' }; +static const symbol s_9_2[1] = { 'o' }; +static const symbol s_9_3[2] = { 'o', 's' }; +static const symbol s_9_4[2] = { 0xC3, 0xA1 }; +static const symbol s_9_5[2] = { 0xC3, 0xA9 }; +static const symbol s_9_6[2] = { 0xC3, 0xAD }; +static const symbol s_9_7[2] = { 0xC3, 0xB3 }; +static const struct among a_9[8] = { +{ 1, s_9_0, 0, 1, 0}, +{ 1, s_9_1, 0, 2, 0}, +{ 1, s_9_2, 0, 1, 0}, +{ 2, s_9_3, 0, 1, 0}, +{ 2, s_9_4, 0, 1, 0}, +{ 2, s_9_5, 0, 2, 0}, +{ 2, s_9_6, 0, 1, 0}, +{ 2, s_9_7, 0, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 10 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { 'i', 'e', 'n', 'd', 'o' }; +static const symbol s_6[] = { 'a', 'n', 'd', 'o' }; +static const symbol s_7[] = { 'a', 'r' }; +static const symbol s_8[] = { 'e', 'r' }; +static const symbol s_9[] = { 'i', 'r' }; +static const symbol s_10[] = { 'i', 'c' }; +static const symbol s_11[] = { 'l', 'o', 'g' }; +static const symbol s_12[] = { 'u' }; +static const symbol s_13[] = { 'e', 'n', 't', 'e' }; +static const symbol s_14[] = { 'a', 't' }; +static const symbol s_15[] = { 'a', 't' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[2] = z->l; + z->I[1] = z->l; + z->I[0] = z->l; + { + int v_1 = z->c; + { + int v_2 = z->c; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab2; + { + int v_3 = z->c; + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab4; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = v_3; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab2; + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = v_2; + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab0; + { + int v_4 = z->c; + if (out_grouping_U(z, g_v, 97, 252, 0)) goto lab6; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = v_4; + if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab0; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + lab5: + ; + } + lab1: + z->I[2] = z->c; + lab0: + z->c = v_1; + } + { + int v_5 = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; + { + int ret = out_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 252, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[0] = z->c; + lab7: + z->c = v_5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while (1) { + int v_1 = z->c; + z->bra = z->c; + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 5 || !((67641858 >> (z->p[z->c + 1] & 0x1f)) & 1)) among_var = 6; else + among_var = find_among(z, a_0, 6); + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 1, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_3); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 1, s_4); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + break; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + return z->I[2] <= z->c; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R2(struct SN_env * z) { + return z->I[0] <= z->c; +} + +static int r_attached_pronoun(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((557090 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_1, 13)) return 0; + z->bra = z->c; + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 111 && z->p[z->c - 1] != 114)) return 0; + among_var = find_among_b(z, a_2, 11); + if (!among_var) return 0; + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + switch (among_var) { + case 1: + z->bra = z->c; + { + int ret = slice_from_s(z, 5, s_5); + if (ret < 0) return ret; + } + break; + case 2: + z->bra = z->c; + { + int ret = slice_from_s(z, 4, s_6); + if (ret < 0) return ret; + } + break; + case 3: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 4: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_8); + if (ret < 0) return ret; + } + break; + case 5: + z->bra = z->c; + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + if (z->c <= z->lb || z->p[z->c - 1] != 'u') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((835634 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_6, 48); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_10))) { z->c = z->l - v_1; goto lab0; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + case 3: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 3, s_11); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_13); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = r_R1(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718616 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_2; goto lab1; } + among_var = find_among_b(z, a_3, 4); + if (!among_var) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + switch (among_var) { + case 1: + z->ket = z->c; + if (!(eq_s_b(z, 2, s_14))) { z->c = z->l - v_2; goto lab1; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_2; goto lab1; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab1: + ; + } + break; + case 7: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + z->ket = z->c; + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 101) { z->c = z->l - v_3; goto lab2; } + if (!find_among_b(z, a_4, 3)) { z->c = z->l - v_3; goto lab2; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_3; goto lab2; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab2: + ; + } + break; + case 8: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_4; goto lab3; } + if (!find_among_b(z, a_5, 3)) { z->c = z->l - v_4; goto lab3; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_4; goto lab3; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + ; + } + break; + case 9: + { + int ret = r_R2(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - v_5; goto lab4; } + z->bra = z->c; + { + int ret = r_R2(z); + if (ret == 0) { z->c = z->l - v_5; goto lab4; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab4: + ; + } + break; + } + return 1; +} + +static int r_y_verb_suffix(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + if (!find_among_b(z, a_7, 12)) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + if (z->c <= z->lb || z->p[z->c - 1] != 'u') return 0; + z->c--; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[2]) return 0; + v_1 = z->lb; z->lb = z->I[2]; + z->ket = z->c; + among_var = find_among_b(z, a_8, 96); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') { z->c = z->l - v_2; goto lab0; } + z->c--; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') { z->c = z->l - v_2; goto lab0; } + z->c--; + z->c = z->l - v_3; + } + lab0: + ; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_9, 8); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_RV(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->bra = z->c; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') { z->c = z->l - v_1; goto lab0; } + z->c--; + z->c = z->l - v_2; + } + { + int ret = r_RV(z); + if (ret == 0) { z->c = z->l - v_1; goto lab0; } + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + ; + } + break; + } + return 1; +} + +extern int spanish_UTF_8_stem(struct SN_env * z) { + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_attached_pronoun(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_3; + { + int ret = r_y_verb_suffix(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + goto lab1; + lab3: + z->c = z->l - v_3; + { + int ret = r_verb_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + } + lab1: + lab0: + z->c = z->l - v_2; + } + { + int v_4 = z->l - z->c; + { + int ret = r_residual_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + { + int v_5 = z->c; + { + int ret = r_postlude(z); + if (ret < 0) return ret; + } + z->c = v_5; + } + return 1; +} + +extern struct SN_env * spanish_UTF_8_create_env(void) { return SN_create_env(0, 3); } + +extern void spanish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_spanish.h b/contrib/libs/snowball/src_c/stem_UTF_8_spanish.h new file mode 100644 index 000000000000..406d16f19e1f --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_spanish.h @@ -0,0 +1,15 @@ +/* Generated from spanish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_UTF_8_create_env(void); +extern void spanish_UTF_8_close_env(struct SN_env * z); + +extern int spanish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_swedish.c b/contrib/libs/snowball/src_c/stem_UTF_8_swedish.c new file mode 100644 index 000000000000..0e5c1f14b217 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_swedish.c @@ -0,0 +1,406 @@ +/* Generated from swedish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int swedish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_et_condition(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * swedish_UTF_8_create_env(void); +extern void swedish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'f', 'a', 'b' }; +static const symbol s_0_1[1] = { 'h' }; +static const symbol s_0_2[3] = { 'p', 'a', 'k' }; +static const symbol s_0_3[3] = { 'r', 'a', 'k' }; +static const symbol s_0_4[4] = { 's', 't', 'a', 'k' }; +static const symbol s_0_5[3] = { 'k', 'o', 'm' }; +static const symbol s_0_6[3] = { 'i', 'e', 't' }; +static const symbol s_0_7[3] = { 'c', 'i', 't' }; +static const symbol s_0_8[3] = { 'd', 'i', 't' }; +static const symbol s_0_9[4] = { 'a', 'l', 'i', 't' }; +static const symbol s_0_10[4] = { 'i', 'l', 'i', 't' }; +static const symbol s_0_11[3] = { 'm', 'i', 't' }; +static const symbol s_0_12[3] = { 'n', 'i', 't' }; +static const symbol s_0_13[3] = { 'p', 'i', 't' }; +static const symbol s_0_14[3] = { 'r', 'i', 't' }; +static const symbol s_0_15[3] = { 's', 'i', 't' }; +static const symbol s_0_16[3] = { 't', 'i', 't' }; +static const symbol s_0_17[3] = { 'u', 'i', 't' }; +static const symbol s_0_18[4] = { 'i', 'v', 'i', 't' }; +static const symbol s_0_19[4] = { 'k', 'v', 'i', 't' }; +static const symbol s_0_20[3] = { 'x', 'i', 't' }; +static const struct among a_0[21] = { +{ 3, s_0_0, 0, -1, 0}, +{ 1, s_0_1, 0, -1, 0}, +{ 3, s_0_2, 0, -1, 0}, +{ 3, s_0_3, 0, -1, 0}, +{ 4, s_0_4, 0, -1, 0}, +{ 3, s_0_5, 0, -1, 0}, +{ 3, s_0_6, 0, -1, 0}, +{ 3, s_0_7, 0, -1, 0}, +{ 3, s_0_8, 0, -1, 0}, +{ 4, s_0_9, 0, -1, 0}, +{ 4, s_0_10, 0, -1, 0}, +{ 3, s_0_11, 0, -1, 0}, +{ 3, s_0_12, 0, -1, 0}, +{ 3, s_0_13, 0, -1, 0}, +{ 3, s_0_14, 0, -1, 0}, +{ 3, s_0_15, 0, -1, 0}, +{ 3, s_0_16, 0, -1, 0}, +{ 3, s_0_17, 0, -1, 0}, +{ 4, s_0_18, 0, -1, 0}, +{ 4, s_0_19, 0, -1, 0}, +{ 3, s_0_20, 0, -1, 0} +}; + +static const symbol s_1_0[1] = { 'a' }; +static const symbol s_1_1[4] = { 'a', 'r', 'n', 'a' }; +static const symbol s_1_2[4] = { 'e', 'r', 'n', 'a' }; +static const symbol s_1_3[7] = { 'h', 'e', 't', 'e', 'r', 'n', 'a' }; +static const symbol s_1_4[4] = { 'o', 'r', 'n', 'a' }; +static const symbol s_1_5[2] = { 'a', 'd' }; +static const symbol s_1_6[1] = { 'e' }; +static const symbol s_1_7[3] = { 'a', 'd', 'e' }; +static const symbol s_1_8[4] = { 'a', 'n', 'd', 'e' }; +static const symbol s_1_9[4] = { 'a', 'r', 'n', 'e' }; +static const symbol s_1_10[3] = { 'a', 'r', 'e' }; +static const symbol s_1_11[4] = { 'a', 's', 't', 'e' }; +static const symbol s_1_12[2] = { 'e', 'n' }; +static const symbol s_1_13[5] = { 'a', 'n', 'd', 'e', 'n' }; +static const symbol s_1_14[4] = { 'a', 'r', 'e', 'n' }; +static const symbol s_1_15[5] = { 'h', 'e', 't', 'e', 'n' }; +static const symbol s_1_16[3] = { 'e', 'r', 'n' }; +static const symbol s_1_17[2] = { 'a', 'r' }; +static const symbol s_1_18[2] = { 'e', 'r' }; +static const symbol s_1_19[5] = { 'h', 'e', 't', 'e', 'r' }; +static const symbol s_1_20[2] = { 'o', 'r' }; +static const symbol s_1_21[1] = { 's' }; +static const symbol s_1_22[2] = { 'a', 's' }; +static const symbol s_1_23[5] = { 'a', 'r', 'n', 'a', 's' }; +static const symbol s_1_24[5] = { 'e', 'r', 'n', 'a', 's' }; +static const symbol s_1_25[5] = { 'o', 'r', 'n', 'a', 's' }; +static const symbol s_1_26[2] = { 'e', 's' }; +static const symbol s_1_27[4] = { 'a', 'd', 'e', 's' }; +static const symbol s_1_28[5] = { 'a', 'n', 'd', 'e', 's' }; +static const symbol s_1_29[3] = { 'e', 'n', 's' }; +static const symbol s_1_30[5] = { 'a', 'r', 'e', 'n', 's' }; +static const symbol s_1_31[6] = { 'h', 'e', 't', 'e', 'n', 's' }; +static const symbol s_1_32[4] = { 'e', 'r', 'n', 's' }; +static const symbol s_1_33[2] = { 'a', 't' }; +static const symbol s_1_34[2] = { 'e', 't' }; +static const symbol s_1_35[5] = { 'a', 'n', 'd', 'e', 't' }; +static const symbol s_1_36[3] = { 'h', 'e', 't' }; +static const symbol s_1_37[3] = { 'a', 's', 't' }; +static const struct among a_1[38] = { +{ 1, s_1_0, 0, 1, 0}, +{ 4, s_1_1, -1, 1, 0}, +{ 4, s_1_2, -2, 1, 0}, +{ 7, s_1_3, -1, 1, 0}, +{ 4, s_1_4, -4, 1, 0}, +{ 2, s_1_5, 0, 1, 0}, +{ 1, s_1_6, 0, 1, 0}, +{ 3, s_1_7, -1, 1, 0}, +{ 4, s_1_8, -2, 1, 0}, +{ 4, s_1_9, -3, 1, 0}, +{ 3, s_1_10, -4, 1, 0}, +{ 4, s_1_11, -5, 1, 0}, +{ 2, s_1_12, 0, 1, 0}, +{ 5, s_1_13, -1, 1, 0}, +{ 4, s_1_14, -2, 1, 0}, +{ 5, s_1_15, -3, 1, 0}, +{ 3, s_1_16, 0, 1, 0}, +{ 2, s_1_17, 0, 1, 0}, +{ 2, s_1_18, 0, 1, 0}, +{ 5, s_1_19, -1, 1, 0}, +{ 2, s_1_20, 0, 1, 0}, +{ 1, s_1_21, 0, 2, 0}, +{ 2, s_1_22, -1, 1, 0}, +{ 5, s_1_23, -1, 1, 0}, +{ 5, s_1_24, -2, 1, 0}, +{ 5, s_1_25, -3, 1, 0}, +{ 2, s_1_26, -5, 1, 0}, +{ 4, s_1_27, -1, 1, 0}, +{ 5, s_1_28, -2, 1, 0}, +{ 3, s_1_29, -8, 1, 0}, +{ 5, s_1_30, -1, 1, 0}, +{ 6, s_1_31, -2, 1, 0}, +{ 4, s_1_32, -11, 1, 0}, +{ 2, s_1_33, 0, 1, 0}, +{ 2, s_1_34, 0, 3, 0}, +{ 5, s_1_35, -1, 1, 0}, +{ 3, s_1_36, -2, 1, 0}, +{ 3, s_1_37, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'd' }; +static const symbol s_2_1[2] = { 'g', 'd' }; +static const symbol s_2_2[2] = { 'n', 'n' }; +static const symbol s_2_3[2] = { 'd', 't' }; +static const symbol s_2_4[2] = { 'g', 't' }; +static const symbol s_2_5[2] = { 'k', 't' }; +static const symbol s_2_6[2] = { 't', 't' }; +static const struct among a_2[7] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 2, s_2_2, 0, -1, 0}, +{ 2, s_2_3, 0, -1, 0}, +{ 2, s_2_4, 0, -1, 0}, +{ 2, s_2_5, 0, -1, 0}, +{ 2, s_2_6, 0, -1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'g' }; +static const symbol s_3_1[3] = { 'l', 'i', 'g' }; +static const symbol s_3_2[3] = { 'e', 'l', 's' }; +static const symbol s_3_3[5] = { 'f', 'u', 'l', 'l', 't' }; +static const symbol s_3_4[4] = { 0xC3, 0xB6, 's', 't' }; +static const struct among a_3[5] = { +{ 2, s_3_0, 0, 1, 0}, +{ 3, s_3_1, -1, 1, 0}, +{ 3, s_3_2, 0, 1, 0}, +{ 5, s_3_3, 0, 3, 0}, +{ 4, s_3_4, 0, 2, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 }; + +static const unsigned char g_s_ending[] = { 119, 127, 149 }; + +static const unsigned char g_ost_ending[] = { 173, 58 }; + +static const symbol s_0[] = { 'e', 't' }; +static const symbol s_1[] = { 0xC3, 0xB6, 's' }; +static const symbol s_2[] = { 'f', 'u', 'l', 'l' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_1; + } + { + int ret = out_grouping_U(z, g_v, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + { + int ret = in_grouping_U(z, g_v, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab0; + z->I[1] = z->I[0]; +lab0: + return 1; +} + +static int r_et_condition(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_v, 97, 246, 0)) return 0; + if (in_grouping_b_U(z, g_v, 97, 246, 0)) return 0; + if (z->c > z->lb) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1059076 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + if (!find_among_b(z, a_0, 21)) goto lab1; + return 0; + lab1: + z->c = z->l - v_2; + } + } + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851442 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_1, 38); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; + if (!(eq_s_b(z, 2, s_0))) goto lab1; + { + int ret = r_et_condition(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->bra = z->c; + goto lab0; + lab1: + z->c = z->l - v_2; + if (in_grouping_b_U(z, g_s_ending, 98, 121, 0)) return 0; + } + lab0: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_et_condition(z); + if (ret <= 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + { + int v_2 = z->l - z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1064976 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + if (!find_among_b(z, a_2, 7)) { z->lb = v_1; return 0; } + z->c = z->l - v_2; + z->ket = z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) { z->lb = v_1; return 0; } + z->c = ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + z->lb = v_1; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + + { + int v_1; + if (z->c < z->I[1]) return 0; + v_1 = z->lb; z->lb = z->I[1]; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; } + among_var = find_among_b(z, a_3, 5); + if (!among_var) { z->lb = v_1; return 0; } + z->bra = z->c; + z->lb = v_1; + } + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b_U(z, g_ost_ending, 105, 118, 0)) return 0; + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 4, s_2); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int swedish_UTF_8_stem(struct SN_env * z) { + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int v_2 = z->l - z->c; + { + int ret = r_main_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_consonant_pair(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + { + int v_4 = z->l - z->c; + { + int ret = r_other_suffix(z); + if (ret < 0) return ret; + } + z->c = z->l - v_4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * swedish_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void swedish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_swedish.h b/contrib/libs/snowball/src_c/stem_UTF_8_swedish.h new file mode 100644 index 000000000000..91d9342a8a28 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_swedish.h @@ -0,0 +1,15 @@ +/* Generated from swedish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_UTF_8_create_env(void); +extern void swedish_UTF_8_close_env(struct SN_env * z); + +extern int swedish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_tamil.c b/contrib/libs/snowball/src_c/stem_UTF_8_tamil.c new file mode 100644 index 000000000000..c1cb0bd170e7 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_tamil.c @@ -0,0 +1,1460 @@ +/* Generated from tamil.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int tamil_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_has_min_length(struct SN_env * z); +static int r_remove_common_word_endings(struct SN_env * z); +static int r_remove_tense_suffixes(struct SN_env * z); +static int r_remove_tense_suffix(struct SN_env * z); +static int r_fix_endings(struct SN_env * z); +static int r_fix_ending(struct SN_env * z); +static int r_fix_va_start(struct SN_env * z); +static int r_remove_vetrumai_urupukal(struct SN_env * z); +static int r_remove_um(struct SN_env * z); +static int r_remove_command_suffixes(struct SN_env * z); +static int r_remove_pronoun_prefixes(struct SN_env * z); +static int r_remove_question_prefixes(struct SN_env * z); +static int r_remove_question_suffixes(struct SN_env * z); +static int r_remove_plural_suffix(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * tamil_UTF_8_create_env(void); +extern void tamil_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x81 }; +static const symbol s_0_1[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x82 }; +static const symbol s_0_2[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x8A }; +static const symbol s_0_3[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x8B }; +static const struct among a_0[4] = { +{ 6, s_0_0, 0, 3, 0}, +{ 6, s_0_1, 0, 4, 0}, +{ 6, s_0_2, 0, 2, 0}, +{ 6, s_0_3, 0, 1, 0} +}; + +static const symbol s_1_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_1_1[3] = { 0xE0, 0xAE, 0x99 }; +static const symbol s_1_2[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_1_3[3] = { 0xE0, 0xAE, 0x9E }; +static const symbol s_1_4[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_1_5[3] = { 0xE0, 0xAE, 0xA8 }; +static const symbol s_1_6[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_1_7[3] = { 0xE0, 0xAE, 0xAE }; +static const symbol s_1_8[3] = { 0xE0, 0xAE, 0xAF }; +static const symbol s_1_9[3] = { 0xE0, 0xAE, 0xB5 }; +static const struct among a_1[10] = { +{ 3, s_1_0, 0, -1, 0}, +{ 3, s_1_1, 0, -1, 0}, +{ 3, s_1_2, 0, -1, 0}, +{ 3, s_1_3, 0, -1, 0}, +{ 3, s_1_4, 0, -1, 0}, +{ 3, s_1_5, 0, -1, 0}, +{ 3, s_1_6, 0, -1, 0}, +{ 3, s_1_7, 0, -1, 0}, +{ 3, s_1_8, 0, -1, 0}, +{ 3, s_1_9, 0, -1, 0} +}; + +static const symbol s_2_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_2_1[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_2_2[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_2[3] = { +{ 3, s_2_0, 0, -1, 0}, +{ 3, s_2_1, 0, -1, 0}, +{ 3, s_2_2, 0, -1, 0} +}; + +static const symbol s_3_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_3_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_3_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_3_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_3_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_3_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_3_6[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_3_7[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_3[8] = { +{ 3, s_3_0, 0, -1, 0}, +{ 3, s_3_1, 0, -1, 0}, +{ 3, s_3_2, 0, -1, 0}, +{ 3, s_3_3, 0, -1, 0}, +{ 3, s_3_4, 0, -1, 0}, +{ 3, s_3_5, 0, -1, 0}, +{ 3, s_3_6, 0, -1, 0}, +{ 3, s_3_7, 0, -1, 0} +}; + +static const symbol s_4_1[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_4_2[3] = { 0xE0, 0xAF, 0x8D }; +static const struct among a_4[3] = { +{ 0, 0, 0, 2, 0}, +{ 3, s_4_1, -1, 1, 0}, +{ 3, s_4_2, -2, 1, 0} +}; + +static const symbol s_5_0[6] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x81 }; +static const symbol s_5_1[9] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_2[15] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_3[12] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_4[12] = { 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_5[6] = { 0xE0, 0xAE, 0x99, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_6[12] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_7[12] = { 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_8[12] = { 0xE0, 0xAE, 0xA8, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_9[6] = { 0xE0, 0xAE, 0xA8, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_10[12] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xAA, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_11[6] = { 0xE0, 0xAE, 0xAF, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_12[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_13[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x8D }; +static const symbol s_5_14[9] = { 0xE0, 0xAE, 0xA8, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xA4 }; +static const symbol s_5_15[3] = { 0xE0, 0xAE, 0xAF }; +static const symbol s_5_16[3] = { 0xE0, 0xAE, 0xB5 }; +static const struct among a_5[17] = { +{ 6, s_5_0, 0, 8, 0}, +{ 9, s_5_1, 0, 7, 0}, +{ 15, s_5_2, 0, 7, 0}, +{ 12, s_5_3, 0, 3, 0}, +{ 12, s_5_4, 0, 4, 0}, +{ 6, s_5_5, 0, 9, 0}, +{ 12, s_5_6, 0, 5, 0}, +{ 12, s_5_7, 0, 6, 0}, +{ 12, s_5_8, 0, 1, 0}, +{ 6, s_5_9, 0, 1, 0}, +{ 12, s_5_10, 0, 3, 0}, +{ 6, s_5_11, 0, 2, 0}, +{ 12, s_5_12, 0, 4, 0}, +{ 6, s_5_13, 0, 1, 0}, +{ 9, s_5_14, 0, 1, 0}, +{ 3, s_5_15, 0, 1, 0}, +{ 3, s_5_16, 0, 1, 0} +}; + +static const symbol s_6_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_6_1[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_6_2[3] = { 0xE0, 0xAE, 0x9F }; +static const symbol s_6_3[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_6_4[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_6_5[3] = { 0xE0, 0xAE, 0xB1 }; +static const struct among a_6[6] = { +{ 3, s_6_0, 0, -1, 0}, +{ 3, s_6_1, 0, -1, 0}, +{ 3, s_6_2, 0, -1, 0}, +{ 3, s_6_3, 0, -1, 0}, +{ 3, s_6_4, 0, -1, 0}, +{ 3, s_6_5, 0, -1, 0} +}; + +static const symbol s_7_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_7_1[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_7_2[3] = { 0xE0, 0xAE, 0x9F }; +static const symbol s_7_3[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_7_4[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_7_5[3] = { 0xE0, 0xAE, 0xB1 }; +static const struct among a_7[6] = { +{ 3, s_7_0, 0, -1, 0}, +{ 3, s_7_1, 0, -1, 0}, +{ 3, s_7_2, 0, -1, 0}, +{ 3, s_7_3, 0, -1, 0}, +{ 3, s_7_4, 0, -1, 0}, +{ 3, s_7_5, 0, -1, 0} +}; + +static const symbol s_8_0[3] = { 0xE0, 0xAE, 0x9E }; +static const symbol s_8_1[3] = { 0xE0, 0xAE, 0xA3 }; +static const symbol s_8_2[3] = { 0xE0, 0xAE, 0xA8 }; +static const symbol s_8_3[3] = { 0xE0, 0xAE, 0xA9 }; +static const symbol s_8_4[3] = { 0xE0, 0xAE, 0xAE }; +static const symbol s_8_5[3] = { 0xE0, 0xAE, 0xAF }; +static const symbol s_8_6[3] = { 0xE0, 0xAE, 0xB0 }; +static const symbol s_8_7[3] = { 0xE0, 0xAE, 0xB2 }; +static const symbol s_8_8[3] = { 0xE0, 0xAE, 0xB3 }; +static const symbol s_8_9[3] = { 0xE0, 0xAE, 0xB4 }; +static const symbol s_8_10[3] = { 0xE0, 0xAE, 0xB5 }; +static const struct among a_8[11] = { +{ 3, s_8_0, 0, -1, 0}, +{ 3, s_8_1, 0, -1, 0}, +{ 3, s_8_2, 0, -1, 0}, +{ 3, s_8_3, 0, -1, 0}, +{ 3, s_8_4, 0, -1, 0}, +{ 3, s_8_5, 0, -1, 0}, +{ 3, s_8_6, 0, -1, 0}, +{ 3, s_8_7, 0, -1, 0}, +{ 3, s_8_8, 0, -1, 0}, +{ 3, s_8_9, 0, -1, 0}, +{ 3, s_8_10, 0, -1, 0} +}; + +static const symbol s_9_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_9_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_9_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_9_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_9_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_9_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_9_6[3] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_9_7[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_9_8[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_9[9] = { +{ 3, s_9_0, 0, -1, 0}, +{ 3, s_9_1, 0, -1, 0}, +{ 3, s_9_2, 0, -1, 0}, +{ 3, s_9_3, 0, -1, 0}, +{ 3, s_9_4, 0, -1, 0}, +{ 3, s_9_5, 0, -1, 0}, +{ 3, s_9_6, 0, -1, 0}, +{ 3, s_9_7, 0, -1, 0}, +{ 3, s_9_8, 0, -1, 0} +}; + +static const symbol s_10_0[3] = { 0xE0, 0xAE, 0x85 }; +static const symbol s_10_1[3] = { 0xE0, 0xAE, 0x87 }; +static const symbol s_10_2[3] = { 0xE0, 0xAE, 0x89 }; +static const struct among a_10[3] = { +{ 3, s_10_0, 0, -1, 0}, +{ 3, s_10_1, 0, -1, 0}, +{ 3, s_10_2, 0, -1, 0} +}; + +static const symbol s_11_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_11_1[3] = { 0xE0, 0xAE, 0x99 }; +static const symbol s_11_2[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_11_3[3] = { 0xE0, 0xAE, 0x9E }; +static const symbol s_11_4[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_11_5[3] = { 0xE0, 0xAE, 0xA8 }; +static const symbol s_11_6[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_11_7[3] = { 0xE0, 0xAE, 0xAE }; +static const symbol s_11_8[3] = { 0xE0, 0xAE, 0xAF }; +static const symbol s_11_9[3] = { 0xE0, 0xAE, 0xB5 }; +static const struct among a_11[10] = { +{ 3, s_11_0, 0, -1, 0}, +{ 3, s_11_1, 0, -1, 0}, +{ 3, s_11_2, 0, -1, 0}, +{ 3, s_11_3, 0, -1, 0}, +{ 3, s_11_4, 0, -1, 0}, +{ 3, s_11_5, 0, -1, 0}, +{ 3, s_11_6, 0, -1, 0}, +{ 3, s_11_7, 0, -1, 0}, +{ 3, s_11_8, 0, -1, 0}, +{ 3, s_11_9, 0, -1, 0} +}; + +static const symbol s_12_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_12_1[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_12_2[3] = { 0xE0, 0xAE, 0x9F }; +static const symbol s_12_3[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_12_4[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_12_5[3] = { 0xE0, 0xAE, 0xB1 }; +static const struct among a_12[6] = { +{ 3, s_12_0, 0, -1, 0}, +{ 3, s_12_1, 0, -1, 0}, +{ 3, s_12_2, 0, -1, 0}, +{ 3, s_12_3, 0, -1, 0}, +{ 3, s_12_4, 0, -1, 0}, +{ 3, s_12_5, 0, -1, 0} +}; + +static const symbol s_13_0[9] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_13_1[18] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x99, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_13_2[15] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_13_3[15] = { 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const struct among a_13[4] = { +{ 9, s_13_0, 0, 4, 0}, +{ 18, s_13_1, -1, 1, 0}, +{ 15, s_13_2, -2, 3, 0}, +{ 15, s_13_3, -3, 2, 0} +}; + +static const symbol s_14_0[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_14_1[3] = { 0xE0, 0xAF, 0x8B }; +static const symbol s_14_2[3] = { 0xE0, 0xAE, 0xBE }; +static const struct among a_14[3] = { +{ 3, s_14_0, 0, -1, 0}, +{ 3, s_14_1, 0, -1, 0}, +{ 3, s_14_2, 0, -1, 0} +}; + +static const symbol s_15_0[6] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xBF }; +static const symbol s_15_1[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xBF }; +static const struct among a_15[2] = { +{ 6, s_15_0, 0, -1, 0}, +{ 6, s_15_1, 0, -1, 0} +}; + +static const symbol s_16_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_16_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_16_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_16_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_16_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_16_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_16_6[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_16_7[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_16[8] = { +{ 3, s_16_0, 0, -1, 0}, +{ 3, s_16_1, 0, -1, 0}, +{ 3, s_16_2, 0, -1, 0}, +{ 3, s_16_3, 0, -1, 0}, +{ 3, s_16_4, 0, -1, 0}, +{ 3, s_16_5, 0, -1, 0}, +{ 3, s_16_6, 0, -1, 0}, +{ 3, s_16_7, 0, -1, 0} +}; + +static const symbol s_17_0[15] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_1[18] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_2[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_3[12] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_4[18] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_5[15] = { 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x81 }; +static const symbol s_17_6[9] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x88 }; +static const symbol s_17_7[15] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x88 }; +static const symbol s_17_8[12] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_17_9[15] = { 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_17_10[12] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_17_11[21] = { 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB2, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_17_12[12] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F }; +static const symbol s_17_13[15] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xA3 }; +static const symbol s_17_14[6] = { 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xA9 }; +static const symbol s_17_15[9] = { 0xE0, 0xAE, 0xA4, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA9 }; +static const symbol s_17_16[18] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA4, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA9 }; +static const symbol s_17_17[12] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x88, 0xE0, 0xAE, 0xAF }; +static const symbol s_17_18[12] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xAF }; +static const symbol s_17_19[15] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xB0, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xAF }; +static const symbol s_17_20[9] = { 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB2 }; +static const symbol s_17_21[12] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB3 }; +static const symbol s_17_22[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF }; +static const symbol s_17_23[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xBF }; +static const symbol s_17_24[15] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAE, 0xBF }; +static const symbol s_17_25[15] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAE, 0xBF }; +static const struct among a_17[26] = { +{ 15, s_17_0, 0, 3, 0}, +{ 18, s_17_1, 0, 3, 0}, +{ 9, s_17_2, 0, 3, 0}, +{ 12, s_17_3, 0, 3, 0}, +{ 18, s_17_4, 0, 3, 0}, +{ 15, s_17_5, 0, 1, 0}, +{ 9, s_17_6, 0, 1, 0}, +{ 15, s_17_7, 0, 1, 0}, +{ 12, s_17_8, 0, 1, 0}, +{ 15, s_17_9, 0, 1, 0}, +{ 12, s_17_10, 0, 1, 0}, +{ 21, s_17_11, 0, 3, 0}, +{ 12, s_17_12, 0, 3, 0}, +{ 15, s_17_13, 0, 3, 0}, +{ 6, s_17_14, 0, 1, 0}, +{ 9, s_17_15, 0, 3, 0}, +{ 18, s_17_16, -1, 3, 0}, +{ 12, s_17_17, 0, 1, 0}, +{ 12, s_17_18, 0, 1, 0}, +{ 15, s_17_19, 0, 3, 0}, +{ 9, s_17_20, 0, 2, 0}, +{ 12, s_17_21, 0, 1, 0}, +{ 9, s_17_22, 0, 1, 0}, +{ 9, s_17_23, 0, 3, 0}, +{ 15, s_17_24, 0, 1, 0}, +{ 15, s_17_25, 0, 3, 0} +}; + +static const symbol s_18_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_18_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_18_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_18_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_18_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_18_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_18_6[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_18_7[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_18[8] = { +{ 3, s_18_0, 0, -1, 0}, +{ 3, s_18_1, 0, -1, 0}, +{ 3, s_18_2, 0, -1, 0}, +{ 3, s_18_3, 0, -1, 0}, +{ 3, s_18_4, 0, -1, 0}, +{ 3, s_18_5, 0, -1, 0}, +{ 3, s_18_6, 0, -1, 0}, +{ 3, s_18_7, 0, -1, 0} +}; + +static const symbol s_19_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_19_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_19_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_19_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_19_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_19_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_19_6[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_19_7[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_19[8] = { +{ 3, s_19_0, 0, -1, 0}, +{ 3, s_19_1, 0, -1, 0}, +{ 3, s_19_2, 0, -1, 0}, +{ 3, s_19_3, 0, -1, 0}, +{ 3, s_19_4, 0, -1, 0}, +{ 3, s_19_5, 0, -1, 0}, +{ 3, s_19_6, 0, -1, 0}, +{ 3, s_19_7, 0, -1, 0} +}; + +static const symbol s_20_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_20_1[9] = { 0xE0, 0xAF, 0x8A, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_20_2[9] = { 0xE0, 0xAF, 0x8B, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_20_3[6] = { 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x81 }; +static const symbol s_20_4[21] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xA8, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x81 }; +static const symbol s_20_5[15] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x81 }; +static const symbol s_20_6[9] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x88 }; +static const symbol s_20_7[6] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x88 }; +static const symbol s_20_8[9] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xA3, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_9[12] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_10[9] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_11[12] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_12[12] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x87, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_13[9] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_14[6] = { 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_15[12] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x87, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_16[12] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xAE, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_17[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_18[9] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_19[9] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_20[12] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x80, 0xE0, 0xAE, 0xB4, 0xE0, 0xAF, 0x8D }; +static const symbol s_20_21[9] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0x9F }; +static const struct among a_20[22] = { +{ 3, s_20_0, 0, 7, 0}, +{ 9, s_20_1, 0, 2, 0}, +{ 9, s_20_2, 0, 2, 0}, +{ 6, s_20_3, 0, 6, 0}, +{ 21, s_20_4, -1, 2, 0}, +{ 15, s_20_5, 0, 2, 0}, +{ 9, s_20_6, 0, 2, 0}, +{ 6, s_20_7, 0, 1, 0}, +{ 9, s_20_8, 0, 1, 0}, +{ 12, s_20_9, 0, 1, 0}, +{ 9, s_20_10, 0, 3, 0}, +{ 12, s_20_11, 0, 4, 0}, +{ 12, s_20_12, 0, 1, 0}, +{ 9, s_20_13, 0, 2, 0}, +{ 6, s_20_14, 0, 5, 0}, +{ 12, s_20_15, -1, 1, 0}, +{ 12, s_20_16, -2, 2, 0}, +{ 9, s_20_17, -3, 2, 0}, +{ 9, s_20_18, -4, 2, 0}, +{ 9, s_20_19, 0, 2, 0}, +{ 12, s_20_20, 0, 1, 0}, +{ 9, s_20_21, 0, 2, 0} +}; + +static const symbol s_21_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_21_1[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_21_2[3] = { 0xE0, 0xAE, 0x9F }; +static const symbol s_21_3[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_21_4[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_21_5[3] = { 0xE0, 0xAE, 0xB1 }; +static const struct among a_21[6] = { +{ 3, s_21_0, 0, -1, 0}, +{ 3, s_21_1, 0, -1, 0}, +{ 3, s_21_2, 0, -1, 0}, +{ 3, s_21_3, 0, -1, 0}, +{ 3, s_21_4, 0, -1, 0}, +{ 3, s_21_5, 0, -1, 0} +}; + +static const symbol s_22_0[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_22_1[3] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_22_2[3] = { 0xE0, 0xAE, 0x9F }; +static const symbol s_22_3[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_22_4[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_22_5[3] = { 0xE0, 0xAE, 0xB1 }; +static const struct among a_22[6] = { +{ 3, s_22_0, 0, -1, 0}, +{ 3, s_22_1, 0, -1, 0}, +{ 3, s_22_2, 0, -1, 0}, +{ 3, s_22_3, 0, -1, 0}, +{ 3, s_22_4, 0, -1, 0}, +{ 3, s_22_5, 0, -1, 0} +}; + +static const symbol s_23_0[3] = { 0xE0, 0xAE, 0x85 }; +static const symbol s_23_1[3] = { 0xE0, 0xAE, 0x86 }; +static const symbol s_23_2[3] = { 0xE0, 0xAE, 0x87 }; +static const symbol s_23_3[3] = { 0xE0, 0xAE, 0x88 }; +static const symbol s_23_4[3] = { 0xE0, 0xAE, 0x89 }; +static const symbol s_23_5[3] = { 0xE0, 0xAE, 0x8A }; +static const symbol s_23_6[3] = { 0xE0, 0xAE, 0x8E }; +static const symbol s_23_7[3] = { 0xE0, 0xAE, 0x8F }; +static const symbol s_23_8[3] = { 0xE0, 0xAE, 0x90 }; +static const symbol s_23_9[3] = { 0xE0, 0xAE, 0x92 }; +static const symbol s_23_10[3] = { 0xE0, 0xAE, 0x93 }; +static const symbol s_23_11[3] = { 0xE0, 0xAE, 0x94 }; +static const struct among a_23[12] = { +{ 3, s_23_0, 0, -1, 0}, +{ 3, s_23_1, 0, -1, 0}, +{ 3, s_23_2, 0, -1, 0}, +{ 3, s_23_3, 0, -1, 0}, +{ 3, s_23_4, 0, -1, 0}, +{ 3, s_23_5, 0, -1, 0}, +{ 3, s_23_6, 0, -1, 0}, +{ 3, s_23_7, 0, -1, 0}, +{ 3, s_23_8, 0, -1, 0}, +{ 3, s_23_9, 0, -1, 0}, +{ 3, s_23_10, 0, -1, 0}, +{ 3, s_23_11, 0, -1, 0} +}; + +static const symbol s_24_0[3] = { 0xE0, 0xAF, 0x80 }; +static const symbol s_24_1[3] = { 0xE0, 0xAF, 0x81 }; +static const symbol s_24_2[3] = { 0xE0, 0xAF, 0x82 }; +static const symbol s_24_3[3] = { 0xE0, 0xAF, 0x86 }; +static const symbol s_24_4[3] = { 0xE0, 0xAF, 0x87 }; +static const symbol s_24_5[3] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_24_6[3] = { 0xE0, 0xAE, 0xBE }; +static const symbol s_24_7[3] = { 0xE0, 0xAE, 0xBF }; +static const struct among a_24[8] = { +{ 3, s_24_0, 0, -1, 0}, +{ 3, s_24_1, 0, -1, 0}, +{ 3, s_24_2, 0, -1, 0}, +{ 3, s_24_3, 0, -1, 0}, +{ 3, s_24_4, 0, -1, 0}, +{ 3, s_24_5, 0, -1, 0}, +{ 3, s_24_6, 0, -1, 0}, +{ 3, s_24_7, 0, -1, 0} +}; + +static const symbol s_25_0[6] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x81 }; +static const symbol s_25_1[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_25_2[6] = { 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x81 }; +static const symbol s_25_3[15] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x81 }; +static const symbol s_25_4[6] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x88 }; +static const symbol s_25_5[6] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAF, 0x88 }; +static const symbol s_25_6[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_7[9] = { 0xE0, 0xAF, 0x87, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_8[9] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_9[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_10[9] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_11[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_12[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_13[12] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_14[12] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_15[12] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_16[12] = { 0xE0, 0xAE, 0xA4, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_17[12] = { 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_18[9] = { 0xE0, 0xAF, 0x86, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_19[9] = { 0xE0, 0xAF, 0x87, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_20[9] = { 0xE0, 0xAF, 0x8B, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_21[9] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_22[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_23[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_24[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xAF, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_25[9] = { 0xE0, 0xAF, 0x80, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_26[9] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_27[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_28[12] = { 0xE0, 0xAF, 0x80, 0xE0, 0xAE, 0xAF, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_29[9] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_30[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_31[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_32[12] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_33[24] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAF, 0x8A, 0xE0, 0xAE, 0xA3, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_34[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB0, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_35[9] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_36[9] = { 0xE0, 0xAE, 0xAA, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_37[9] = { 0xE0, 0xAE, 0xB5, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_38[9] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_39[12] = { 0xE0, 0xAE, 0xA9, 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_25_40[3] = { 0xE0, 0xAE, 0x95 }; +static const symbol s_25_41[3] = { 0xE0, 0xAE, 0xA4 }; +static const symbol s_25_42[3] = { 0xE0, 0xAE, 0xA9 }; +static const symbol s_25_43[3] = { 0xE0, 0xAE, 0xAA }; +static const symbol s_25_44[3] = { 0xE0, 0xAE, 0xAF }; +static const symbol s_25_45[3] = { 0xE0, 0xAE, 0xBE }; +static const struct among a_25[46] = { +{ 6, s_25_0, 0, 6, 0}, +{ 9, s_25_1, 0, 1, 0}, +{ 6, s_25_2, 0, 3, 0}, +{ 15, s_25_3, 0, 1, 0}, +{ 6, s_25_4, 0, 1, 0}, +{ 6, s_25_5, 0, 1, 0}, +{ 12, s_25_6, 0, 1, 0}, +{ 9, s_25_7, 0, 5, 0}, +{ 9, s_25_8, 0, 1, 0}, +{ 9, s_25_9, 0, 1, 0}, +{ 9, s_25_10, 0, 2, 0}, +{ 9, s_25_11, 0, 4, 0}, +{ 12, s_25_12, -1, 1, 0}, +{ 12, s_25_13, 0, 1, 0}, +{ 12, s_25_14, 0, 1, 0}, +{ 12, s_25_15, 0, 5, 0}, +{ 12, s_25_16, 0, 1, 0}, +{ 12, s_25_17, 0, 1, 0}, +{ 9, s_25_18, 0, 5, 0}, +{ 9, s_25_19, 0, 5, 0}, +{ 9, s_25_20, 0, 5, 0}, +{ 9, s_25_21, 0, 1, 0}, +{ 9, s_25_22, 0, 1, 0}, +{ 9, s_25_23, 0, 5, 0}, +{ 9, s_25_24, 0, 5, 0}, +{ 9, s_25_25, 0, 5, 0}, +{ 9, s_25_26, 0, 1, 0}, +{ 9, s_25_27, 0, 1, 0}, +{ 12, s_25_28, 0, 5, 0}, +{ 9, s_25_29, 0, 1, 0}, +{ 9, s_25_30, 0, 5, 0}, +{ 12, s_25_31, -1, 1, 0}, +{ 12, s_25_32, -2, 1, 0}, +{ 24, s_25_33, 0, 1, 0}, +{ 12, s_25_34, 0, 5, 0}, +{ 9, s_25_35, 0, 1, 0}, +{ 9, s_25_36, 0, 1, 0}, +{ 9, s_25_37, 0, 1, 0}, +{ 9, s_25_38, 0, 5, 0}, +{ 12, s_25_39, -1, 1, 0}, +{ 3, s_25_40, 0, 1, 0}, +{ 3, s_25_41, 0, 1, 0}, +{ 3, s_25_42, 0, 1, 0}, +{ 3, s_25_43, 0, 1, 0}, +{ 3, s_25_44, 0, 1, 0}, +{ 3, s_25_45, 0, 5, 0} +}; + +static const symbol s_26_0[18] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_26_1[21] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA8, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_26_2[12] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB1, 0xE0, 0xAF, 0x8D }; +static const symbol s_26_3[15] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1 }; +static const symbol s_26_4[18] = { 0xE0, 0xAE, 0xBE, 0xE0, 0xAE, 0xA8, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D, 0xE0, 0xAE, 0xB1 }; +static const symbol s_26_5[9] = { 0xE0, 0xAE, 0x95, 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xB1 }; +static const struct among a_26[6] = { +{ 18, s_26_0, 0, -1, 0}, +{ 21, s_26_1, 0, -1, 0}, +{ 12, s_26_2, 0, -1, 0}, +{ 15, s_26_3, 0, -1, 0}, +{ 18, s_26_4, 0, -1, 0}, +{ 9, s_26_5, 0, -1, 0} +}; + +static const symbol s_0[] = { 0xE0, 0xAE, 0x93 }; +static const symbol s_1[] = { 0xE0, 0xAE, 0x92 }; +static const symbol s_2[] = { 0xE0, 0xAE, 0x89 }; +static const symbol s_3[] = { 0xE0, 0xAE, 0x8A }; +static const symbol s_4[] = { 0xE0, 0xAE, 0x8E }; +static const symbol s_5[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_6[] = { 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_7[] = { 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_8[] = { 0xE0, 0xAE, 0x9F, 0xE0, 0xAF, 0x81 }; +static const symbol s_9[] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_10[] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_11[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_12[] = { 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_13[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_14[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_15[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_16[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_17[] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0x99, 0xE0, 0xAF, 0x8D }; +static const symbol s_18[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_19[] = { 0xE0, 0xAE, 0xB2, 0xE0, 0xAF, 0x8D }; +static const symbol s_20[] = { 0xE0, 0xAE, 0xB3, 0xE0, 0xAF, 0x8D }; +static const symbol s_21[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_22[] = { 0xE0, 0xAF, 0x81, 0xE0, 0xAE, 0xAE, 0xE0, 0xAF, 0x8D }; +static const symbol s_23[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_24[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_25[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_26[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_27[] = { 0xE0, 0xAE, 0xAE }; +static const symbol s_28[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_29[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_30[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_31[] = { 0xE0, 0xAE, 0xBF }; +static const symbol s_32[] = { 0xE0, 0xAF, 0x88 }; +static const symbol s_33[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_34[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_35[] = { 0xE0, 0xAE, 0xBF, 0xE0, 0xAE, 0xA9, 0xE0, 0xAF, 0x8D }; +static const symbol s_36[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_37[] = { 0xE0, 0xAE, 0x9A }; +static const symbol s_38[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_39[] = { 0xE0, 0xAF, 0x8D }; +static const symbol s_40[] = { 0xE0, 0xAF, 0x8D }; + +static int r_has_min_length(struct SN_env * z) { + return len_utf8(z->p) > 4; +} + +static int r_fix_va_start(struct SN_env * z) { + int among_var; + z->bra = z->c; + if (z->c + 5 >= z->l || z->p[z->c + 5] >> 5 != 4 || !((3078 >> (z->p[z->c + 5] & 0x1f)) & 1)) return 0; + among_var = find_among(z, a_0, 4); + if (!among_var) return 0; + z->ket = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_0); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_1); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 3, s_2); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 3, s_3); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_fix_endings(struct SN_env * z) { + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + { + int ret = r_fix_ending(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + return 1; +} + +static int r_remove_question_prefixes(struct SN_env * z) { + z->bra = z->c; + if (!(eq_s(z, 3, s_4))) return 0; + if (!find_among(z, a_1, 10)) return 0; + if (!(eq_s(z, 3, s_5))) return 0; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->c; + { + int ret = r_fix_va_start(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + return 1; +} + +static int r_fix_ending(struct SN_env * z) { + int among_var; + if (len_utf8(z->p) <= 3) return 0; + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_5, 17); + if (!among_var) goto lab1; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_2 = z->l - z->c; + if (!find_among_b(z, a_2, 3)) goto lab1; + z->c = z->l - v_2; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 6, s_6); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 6, s_7); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 6, s_8); + if (ret < 0) return ret; + } + break; + case 6: + if (!(z->I[0])) goto lab1; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 3, s_9))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + } + { + int ret = slice_from_s(z, 6, s_10); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_11); + if (ret < 0) return ret; + } + break; + case 8: + { + int v_4 = z->l - z->c; + if (!find_among_b(z, a_3, 8)) goto lab3; + goto lab1; + lab3: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 9: + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 136 && z->p[z->c - 1] != 141)) among_var = 2; else + among_var = find_among_b(z, a_4, 3); + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 6, s_12); + if (ret < 0) return ret; + } + break; + } + break; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + if (!(eq_s_b(z, 3, s_13))) return 0; + { + int v_5 = z->l - z->c; + if (!find_among_b(z, a_6, 6)) goto lab5; + { + int v_6 = z->l - z->c; + if (!(eq_s_b(z, 3, s_14))) { z->c = z->l - v_6; goto lab6; } + if (!find_among_b(z, a_7, 6)) { z->c = z->l - v_6; goto lab6; } + lab6: + ; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - v_5; + if (!find_among_b(z, a_8, 11)) goto lab7; + z->bra = z->c; + if (!(eq_s_b(z, 3, s_15))) goto lab7; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab4; + lab7: + z->c = z->l - v_5; + { + int v_7 = z->l - z->c; + if (!find_among_b(z, a_9, 9)) return 0; + z->c = z->l - v_7; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab4: + ; + } +lab0: + z->c = z->lb; + return 1; +} + +static int r_remove_pronoun_prefixes(struct SN_env * z) { + z->bra = z->c; + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 4 || !((672 >> (z->p[z->c + 2] & 0x1f)) & 1)) return 0; + if (!find_among(z, a_10, 3)) return 0; + if (!find_among(z, a_11, 10)) return 0; + if (!(eq_s(z, 3, s_16))) return 0; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_1 = z->c; + { + int ret = r_fix_va_start(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + return 1; +} + +static int r_remove_plural_suffix(struct SN_env * z) { + int among_var; + z->lb = z->c; z->c = z->l; + z->ket = z->c; + if (z->c - 8 <= z->lb || z->p[z->c - 1] != 141) return 0; + among_var = find_among_b(z, a_13, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int v_1 = z->l - z->c; + if (!find_among_b(z, a_12, 6)) goto lab1; + { + int ret = slice_from_s(z, 9, s_17); + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int ret = slice_from_s(z, 3, s_18); + if (ret < 0) return ret; + } + } + lab0: + break; + case 2: + { + int ret = slice_from_s(z, 6, s_19); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 6, s_20); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->c = z->lb; + return 1; +} + +static int r_remove_question_suffixes(struct SN_env * z) { + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + z->ket = z->c; + if (!find_among_b(z, a_14, 3)) goto lab0; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_21); + if (ret < 0) return ret; + } + lab0: + z->c = z->l - v_1; + } + z->c = z->lb; + { + int ret = r_fix_endings(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_remove_command_suffixes(struct SN_env * z) { + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + z->ket = z->c; + if (z->c - 5 <= z->lb || z->p[z->c - 1] != 191) return 0; + if (!find_among_b(z, a_15, 2)) return 0; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->c = z->lb; + return 1; +} + +static int r_remove_um(struct SN_env * z) { + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + z->ket = z->c; + if (!(eq_s_b(z, 9, s_22))) return 0; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_23); + if (ret < 0) return ret; + } + z->c = z->lb; + { + int v_1 = z->c; + { + int ret = r_fix_ending(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + return 1; +} + +static int r_remove_common_word_endings(struct SN_env * z) { + int among_var; + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + z->ket = z->c; + among_var = find_among_b(z, a_17, 26); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 3, s_24); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_1 = z->l - z->c; + if (!find_among_b(z, a_16, 8)) goto lab0; + return 0; + lab0: + z->c = z->l - v_1; + } + { + int ret = slice_from_s(z, 3, s_25); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->c = z->lb; + { + int ret = r_fix_endings(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_remove_vetrumai_urupukal(struct SN_env * z) { + int among_var; + z->I[0] = 0; + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + z->ket = z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 4 || !((-2147475197 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_20, 22); + if (!among_var) goto lab1; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 3, s_26); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 3, s_27))) goto lab2; + goto lab1; + lab2: + z->c = z->l - v_3; + } + { + int ret = slice_from_s(z, 3, s_28); + if (ret < 0) return ret; + } + break; + case 4: + if (len_utf8(z->p) < 7) goto lab1; + { + int ret = slice_from_s(z, 3, s_29); + if (ret < 0) return ret; + } + break; + case 5: + { + int v_4 = z->l - z->c; + if (!find_among_b(z, a_18, 8)) goto lab3; + goto lab1; + lab3: + z->c = z->l - v_4; + } + { + int ret = slice_from_s(z, 3, s_30); + if (ret < 0) return ret; + } + break; + case 6: + { + int v_5 = z->l - z->c; + if (!find_among_b(z, a_19, 8)) goto lab4; + goto lab1; + lab4: + z->c = z->l - v_5; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 3, s_31); + if (ret < 0) return ret; + } + break; + } + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_6 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 3, s_32))) return 0; + { + int v_7 = z->l - z->c; + { + int v_8 = z->l - z->c; + if (!find_among_b(z, a_21, 6)) goto lab7; + goto lab6; + lab7: + z->c = z->l - v_8; + } + goto lab5; + lab6: + z->c = z->l - v_7; + { + int v_9 = z->l - z->c; + if (!find_among_b(z, a_22, 6)) return 0; + if (!(eq_s_b(z, 3, s_33))) return 0; + z->c = z->l - v_9; + } + } + lab5: + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_34); + if (ret < 0) return ret; + } + z->c = z->l - v_6; + } + } +lab0: + z->I[0] = 1; + { + int v_10 = z->l - z->c; + z->ket = z->c; + if (!(eq_s_b(z, 9, s_35))) goto lab8; + z->bra = z->c; + { + int ret = slice_from_s(z, 3, s_36); + if (ret < 0) return ret; + } + lab8: + z->c = z->l - v_10; + } + z->c = z->lb; + { + int ret = r_fix_endings(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_remove_tense_suffixes(struct SN_env * z) { + while (1) { + int v_1 = z->c; + { + int ret = r_remove_tense_suffix(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + continue; + lab0: + z->c = v_1; + break; + } + return 1; +} + +static int r_remove_tense_suffix(struct SN_env * z) { + int among_var; + z->I[1] = 0; + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_25, 46); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_3 = z->l - z->c; + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 4 || !((1951712 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + if (!find_among_b(z, a_23, 12)) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_3; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_4 = z->l - z->c; + if (!find_among_b(z, a_24, 8)) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_4; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 4: + { + int v_5 = z->l - z->c; + if (!(eq_s_b(z, 3, s_37))) goto lab3; + goto lab0; + lab3: + z->c = z->l - v_5; + } + { + int ret = slice_from_s(z, 3, s_38); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 3, s_39); + if (ret < 0) return ret; + } + break; + case 6: + { + int v_6 = z->l - z->c; + if (!(eq_s_b(z, 3, s_40))) goto lab0; + z->c = z->l - v_6; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + z->I[1] = 1; + z->c = z->l - v_2; + } + lab0: + z->c = z->l - v_1; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c - 8 <= z->lb || (z->p[z->c - 1] != 141 && z->p[z->c - 1] != 177)) goto lab4; + if (!find_among_b(z, a_26, 6)) goto lab4; + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->I[1] = 1; + lab4: + z->c = z->l - v_7; + } + z->c = z->lb; + { + int ret = r_fix_endings(z); + if (ret < 0) return ret; + } + if (!(z->I[1])) return 0; + return 1; +} + +extern int tamil_UTF_8_stem(struct SN_env * z) { + z->I[0] = 0; + { + int v_1 = z->c; + { + int ret = r_fix_ending(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + { + int ret = r_has_min_length(z); + if (ret <= 0) return ret; + } + { + int v_2 = z->c; + { + int ret = r_remove_question_prefixes(z); + if (ret < 0) return ret; + } + z->c = v_2; + } + { + int v_3 = z->c; + { + int ret = r_remove_pronoun_prefixes(z); + if (ret < 0) return ret; + } + z->c = v_3; + } + { + int v_4 = z->c; + { + int ret = r_remove_question_suffixes(z); + if (ret < 0) return ret; + } + z->c = v_4; + } + { + int v_5 = z->c; + { + int ret = r_remove_um(z); + if (ret < 0) return ret; + } + z->c = v_5; + } + { + int v_6 = z->c; + { + int ret = r_remove_common_word_endings(z); + if (ret < 0) return ret; + } + z->c = v_6; + } + { + int v_7 = z->c; + { + int ret = r_remove_vetrumai_urupukal(z); + if (ret < 0) return ret; + } + z->c = v_7; + } + { + int v_8 = z->c; + { + int ret = r_remove_plural_suffix(z); + if (ret < 0) return ret; + } + z->c = v_8; + } + { + int v_9 = z->c; + { + int ret = r_remove_command_suffixes(z); + if (ret < 0) return ret; + } + z->c = v_9; + } + { + int v_10 = z->c; + { + int ret = r_remove_tense_suffixes(z); + if (ret < 0) return ret; + } + z->c = v_10; + } + return 1; +} + +extern struct SN_env * tamil_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void tamil_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_tamil.h b/contrib/libs/snowball/src_c/stem_UTF_8_tamil.h new file mode 100644 index 000000000000..373fc0095bee --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_tamil.h @@ -0,0 +1,15 @@ +/* Generated from tamil.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * tamil_UTF_8_create_env(void); +extern void tamil_UTF_8_close_env(struct SN_env * z); + +extern int tamil_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_turkish.c b/contrib/libs/snowball/src_c/stem_UTF_8_turkish.c new file mode 100644 index 000000000000..8d6641b5f62a --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_turkish.c @@ -0,0 +1,2356 @@ +/* Generated from turkish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int turkish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_stem_suffix_chain_before_ki(struct SN_env * z); +static int r_stem_noun_suffixes(struct SN_env * z); +static int r_stem_nominal_verb_suffixes(struct SN_env * z); +static int r_remove_proper_noun_suffix(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_post_process_last_consonants(struct SN_env * z); +static int r_more_than_one_syllable_word(struct SN_env * z); +static int r_mark_suffix_with_optional_s_consonant(struct SN_env * z); +static int r_mark_suffix_with_optional_n_consonant(struct SN_env * z); +static int r_mark_suffix_with_optional_U_vowel(struct SN_env * z); +static int r_mark_suffix_with_optional_y_consonant(struct SN_env * z); +static int r_mark_ysA(struct SN_env * z); +static int r_mark_ymUs_(struct SN_env * z); +static int r_mark_yken(struct SN_env * z); +static int r_mark_yDU(struct SN_env * z); +static int r_mark_yUz(struct SN_env * z); +static int r_mark_yUm(struct SN_env * z); +static int r_mark_yU(struct SN_env * z); +static int r_mark_ylA(struct SN_env * z); +static int r_mark_yA(struct SN_env * z); +static int r_mark_possessives(struct SN_env * z); +static int r_mark_sUnUz(struct SN_env * z); +static int r_mark_sUn(struct SN_env * z); +static int r_mark_sU(struct SN_env * z); +static int r_mark_nUz(struct SN_env * z); +static int r_mark_nUn(struct SN_env * z); +static int r_mark_nU(struct SN_env * z); +static int r_mark_ndAn(struct SN_env * z); +static int r_mark_ndA(struct SN_env * z); +static int r_mark_ncA(struct SN_env * z); +static int r_mark_nA(struct SN_env * z); +static int r_mark_lArI(struct SN_env * z); +static int r_mark_lAr(struct SN_env * z); +static int r_mark_ki(struct SN_env * z); +static int r_mark_DUr(struct SN_env * z); +static int r_mark_DAn(struct SN_env * z); +static int r_mark_DA(struct SN_env * z); +static int r_mark_cAsInA(struct SN_env * z); +static int r_is_reserved_word(struct SN_env * z); +static int r_check_vowel_harmony(struct SN_env * z); +static int r_append_U_to_stems_ending_with_d_or_g(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * turkish_UTF_8_create_env(void); +extern void turkish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 'm' }; +static const symbol s_0_1[1] = { 'n' }; +static const symbol s_0_2[3] = { 'm', 'i', 'z' }; +static const symbol s_0_3[3] = { 'n', 'i', 'z' }; +static const symbol s_0_4[3] = { 'm', 'u', 'z' }; +static const symbol s_0_5[3] = { 'n', 'u', 'z' }; +static const symbol s_0_6[4] = { 'm', 0xC4, 0xB1, 'z' }; +static const symbol s_0_7[4] = { 'n', 0xC4, 0xB1, 'z' }; +static const symbol s_0_8[4] = { 'm', 0xC3, 0xBC, 'z' }; +static const symbol s_0_9[4] = { 'n', 0xC3, 0xBC, 'z' }; +static const struct among a_0[10] = { +{ 1, s_0_0, 0, -1, 0}, +{ 1, s_0_1, 0, -1, 0}, +{ 3, s_0_2, 0, -1, 0}, +{ 3, s_0_3, 0, -1, 0}, +{ 3, s_0_4, 0, -1, 0}, +{ 3, s_0_5, 0, -1, 0}, +{ 4, s_0_6, 0, -1, 0}, +{ 4, s_0_7, 0, -1, 0}, +{ 4, s_0_8, 0, -1, 0}, +{ 4, s_0_9, 0, -1, 0} +}; + +static const symbol s_1_0[4] = { 'l', 'e', 'r', 'i' }; +static const symbol s_1_1[5] = { 'l', 'a', 'r', 0xC4, 0xB1 }; +static const struct among a_1[2] = { +{ 4, s_1_0, 0, -1, 0}, +{ 5, s_1_1, 0, -1, 0} +}; + +static const symbol s_2_0[2] = { 'n', 'i' }; +static const symbol s_2_1[2] = { 'n', 'u' }; +static const symbol s_2_2[3] = { 'n', 0xC4, 0xB1 }; +static const symbol s_2_3[3] = { 'n', 0xC3, 0xBC }; +static const struct among a_2[4] = { +{ 2, s_2_0, 0, -1, 0}, +{ 2, s_2_1, 0, -1, 0}, +{ 3, s_2_2, 0, -1, 0}, +{ 3, s_2_3, 0, -1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'n' }; +static const symbol s_3_1[2] = { 'u', 'n' }; +static const symbol s_3_2[3] = { 0xC4, 0xB1, 'n' }; +static const symbol s_3_3[3] = { 0xC3, 0xBC, 'n' }; +static const struct among a_3[4] = { +{ 2, s_3_0, 0, -1, 0}, +{ 2, s_3_1, 0, -1, 0}, +{ 3, s_3_2, 0, -1, 0}, +{ 3, s_3_3, 0, -1, 0} +}; + +static const symbol s_4_0[1] = { 'a' }; +static const symbol s_4_1[1] = { 'e' }; +static const struct among a_4[2] = { +{ 1, s_4_0, 0, -1, 0}, +{ 1, s_4_1, 0, -1, 0} +}; + +static const symbol s_5_0[2] = { 'n', 'a' }; +static const symbol s_5_1[2] = { 'n', 'e' }; +static const struct among a_5[2] = { +{ 2, s_5_0, 0, -1, 0}, +{ 2, s_5_1, 0, -1, 0} +}; + +static const symbol s_6_0[2] = { 'd', 'a' }; +static const symbol s_6_1[2] = { 't', 'a' }; +static const symbol s_6_2[2] = { 'd', 'e' }; +static const symbol s_6_3[2] = { 't', 'e' }; +static const struct among a_6[4] = { +{ 2, s_6_0, 0, -1, 0}, +{ 2, s_6_1, 0, -1, 0}, +{ 2, s_6_2, 0, -1, 0}, +{ 2, s_6_3, 0, -1, 0} +}; + +static const symbol s_7_0[3] = { 'n', 'd', 'a' }; +static const symbol s_7_1[3] = { 'n', 'd', 'e' }; +static const struct among a_7[2] = { +{ 3, s_7_0, 0, -1, 0}, +{ 3, s_7_1, 0, -1, 0} +}; + +static const symbol s_8_0[3] = { 'd', 'a', 'n' }; +static const symbol s_8_1[3] = { 't', 'a', 'n' }; +static const symbol s_8_2[3] = { 'd', 'e', 'n' }; +static const symbol s_8_3[3] = { 't', 'e', 'n' }; +static const struct among a_8[4] = { +{ 3, s_8_0, 0, -1, 0}, +{ 3, s_8_1, 0, -1, 0}, +{ 3, s_8_2, 0, -1, 0}, +{ 3, s_8_3, 0, -1, 0} +}; + +static const symbol s_9_0[4] = { 'n', 'd', 'a', 'n' }; +static const symbol s_9_1[4] = { 'n', 'd', 'e', 'n' }; +static const struct among a_9[2] = { +{ 4, s_9_0, 0, -1, 0}, +{ 4, s_9_1, 0, -1, 0} +}; + +static const symbol s_10_0[2] = { 'l', 'a' }; +static const symbol s_10_1[2] = { 'l', 'e' }; +static const struct among a_10[2] = { +{ 2, s_10_0, 0, -1, 0}, +{ 2, s_10_1, 0, -1, 0} +}; + +static const symbol s_11_0[2] = { 'c', 'a' }; +static const symbol s_11_1[2] = { 'c', 'e' }; +static const struct among a_11[2] = { +{ 2, s_11_0, 0, -1, 0}, +{ 2, s_11_1, 0, -1, 0} +}; + +static const symbol s_12_0[2] = { 'i', 'm' }; +static const symbol s_12_1[2] = { 'u', 'm' }; +static const symbol s_12_2[3] = { 0xC4, 0xB1, 'm' }; +static const symbol s_12_3[3] = { 0xC3, 0xBC, 'm' }; +static const struct among a_12[4] = { +{ 2, s_12_0, 0, -1, 0}, +{ 2, s_12_1, 0, -1, 0}, +{ 3, s_12_2, 0, -1, 0}, +{ 3, s_12_3, 0, -1, 0} +}; + +static const symbol s_13_0[3] = { 's', 'i', 'n' }; +static const symbol s_13_1[3] = { 's', 'u', 'n' }; +static const symbol s_13_2[4] = { 's', 0xC4, 0xB1, 'n' }; +static const symbol s_13_3[4] = { 's', 0xC3, 0xBC, 'n' }; +static const struct among a_13[4] = { +{ 3, s_13_0, 0, -1, 0}, +{ 3, s_13_1, 0, -1, 0}, +{ 4, s_13_2, 0, -1, 0}, +{ 4, s_13_3, 0, -1, 0} +}; + +static const symbol s_14_0[2] = { 'i', 'z' }; +static const symbol s_14_1[2] = { 'u', 'z' }; +static const symbol s_14_2[3] = { 0xC4, 0xB1, 'z' }; +static const symbol s_14_3[3] = { 0xC3, 0xBC, 'z' }; +static const struct among a_14[4] = { +{ 2, s_14_0, 0, -1, 0}, +{ 2, s_14_1, 0, -1, 0}, +{ 3, s_14_2, 0, -1, 0}, +{ 3, s_14_3, 0, -1, 0} +}; + +static const symbol s_15_0[5] = { 's', 'i', 'n', 'i', 'z' }; +static const symbol s_15_1[5] = { 's', 'u', 'n', 'u', 'z' }; +static const symbol s_15_2[7] = { 's', 0xC4, 0xB1, 'n', 0xC4, 0xB1, 'z' }; +static const symbol s_15_3[7] = { 's', 0xC3, 0xBC, 'n', 0xC3, 0xBC, 'z' }; +static const struct among a_15[4] = { +{ 5, s_15_0, 0, -1, 0}, +{ 5, s_15_1, 0, -1, 0}, +{ 7, s_15_2, 0, -1, 0}, +{ 7, s_15_3, 0, -1, 0} +}; + +static const symbol s_16_0[3] = { 'l', 'a', 'r' }; +static const symbol s_16_1[3] = { 'l', 'e', 'r' }; +static const struct among a_16[2] = { +{ 3, s_16_0, 0, -1, 0}, +{ 3, s_16_1, 0, -1, 0} +}; + +static const symbol s_17_0[3] = { 'n', 'i', 'z' }; +static const symbol s_17_1[3] = { 'n', 'u', 'z' }; +static const symbol s_17_2[4] = { 'n', 0xC4, 0xB1, 'z' }; +static const symbol s_17_3[4] = { 'n', 0xC3, 0xBC, 'z' }; +static const struct among a_17[4] = { +{ 3, s_17_0, 0, -1, 0}, +{ 3, s_17_1, 0, -1, 0}, +{ 4, s_17_2, 0, -1, 0}, +{ 4, s_17_3, 0, -1, 0} +}; + +static const symbol s_18_0[3] = { 'd', 'i', 'r' }; +static const symbol s_18_1[3] = { 't', 'i', 'r' }; +static const symbol s_18_2[3] = { 'd', 'u', 'r' }; +static const symbol s_18_3[3] = { 't', 'u', 'r' }; +static const symbol s_18_4[4] = { 'd', 0xC4, 0xB1, 'r' }; +static const symbol s_18_5[4] = { 't', 0xC4, 0xB1, 'r' }; +static const symbol s_18_6[4] = { 'd', 0xC3, 0xBC, 'r' }; +static const symbol s_18_7[4] = { 't', 0xC3, 0xBC, 'r' }; +static const struct among a_18[8] = { +{ 3, s_18_0, 0, -1, 0}, +{ 3, s_18_1, 0, -1, 0}, +{ 3, s_18_2, 0, -1, 0}, +{ 3, s_18_3, 0, -1, 0}, +{ 4, s_18_4, 0, -1, 0}, +{ 4, s_18_5, 0, -1, 0}, +{ 4, s_18_6, 0, -1, 0}, +{ 4, s_18_7, 0, -1, 0} +}; + +static const symbol s_19_0[7] = { 'c', 'a', 's', 0xC4, 0xB1, 'n', 'a' }; +static const symbol s_19_1[6] = { 'c', 'e', 's', 'i', 'n', 'e' }; +static const struct among a_19[2] = { +{ 7, s_19_0, 0, -1, 0}, +{ 6, s_19_1, 0, -1, 0} +}; + +static const symbol s_20_0[2] = { 'd', 'i' }; +static const symbol s_20_1[2] = { 't', 'i' }; +static const symbol s_20_2[3] = { 'd', 'i', 'k' }; +static const symbol s_20_3[3] = { 't', 'i', 'k' }; +static const symbol s_20_4[3] = { 'd', 'u', 'k' }; +static const symbol s_20_5[3] = { 't', 'u', 'k' }; +static const symbol s_20_6[4] = { 'd', 0xC4, 0xB1, 'k' }; +static const symbol s_20_7[4] = { 't', 0xC4, 0xB1, 'k' }; +static const symbol s_20_8[4] = { 'd', 0xC3, 0xBC, 'k' }; +static const symbol s_20_9[4] = { 't', 0xC3, 0xBC, 'k' }; +static const symbol s_20_10[3] = { 'd', 'i', 'm' }; +static const symbol s_20_11[3] = { 't', 'i', 'm' }; +static const symbol s_20_12[3] = { 'd', 'u', 'm' }; +static const symbol s_20_13[3] = { 't', 'u', 'm' }; +static const symbol s_20_14[4] = { 'd', 0xC4, 0xB1, 'm' }; +static const symbol s_20_15[4] = { 't', 0xC4, 0xB1, 'm' }; +static const symbol s_20_16[4] = { 'd', 0xC3, 0xBC, 'm' }; +static const symbol s_20_17[4] = { 't', 0xC3, 0xBC, 'm' }; +static const symbol s_20_18[3] = { 'd', 'i', 'n' }; +static const symbol s_20_19[3] = { 't', 'i', 'n' }; +static const symbol s_20_20[3] = { 'd', 'u', 'n' }; +static const symbol s_20_21[3] = { 't', 'u', 'n' }; +static const symbol s_20_22[4] = { 'd', 0xC4, 0xB1, 'n' }; +static const symbol s_20_23[4] = { 't', 0xC4, 0xB1, 'n' }; +static const symbol s_20_24[4] = { 'd', 0xC3, 0xBC, 'n' }; +static const symbol s_20_25[4] = { 't', 0xC3, 0xBC, 'n' }; +static const symbol s_20_26[2] = { 'd', 'u' }; +static const symbol s_20_27[2] = { 't', 'u' }; +static const symbol s_20_28[3] = { 'd', 0xC4, 0xB1 }; +static const symbol s_20_29[3] = { 't', 0xC4, 0xB1 }; +static const symbol s_20_30[3] = { 'd', 0xC3, 0xBC }; +static const symbol s_20_31[3] = { 't', 0xC3, 0xBC }; +static const struct among a_20[32] = { +{ 2, s_20_0, 0, -1, 0}, +{ 2, s_20_1, 0, -1, 0}, +{ 3, s_20_2, 0, -1, 0}, +{ 3, s_20_3, 0, -1, 0}, +{ 3, s_20_4, 0, -1, 0}, +{ 3, s_20_5, 0, -1, 0}, +{ 4, s_20_6, 0, -1, 0}, +{ 4, s_20_7, 0, -1, 0}, +{ 4, s_20_8, 0, -1, 0}, +{ 4, s_20_9, 0, -1, 0}, +{ 3, s_20_10, 0, -1, 0}, +{ 3, s_20_11, 0, -1, 0}, +{ 3, s_20_12, 0, -1, 0}, +{ 3, s_20_13, 0, -1, 0}, +{ 4, s_20_14, 0, -1, 0}, +{ 4, s_20_15, 0, -1, 0}, +{ 4, s_20_16, 0, -1, 0}, +{ 4, s_20_17, 0, -1, 0}, +{ 3, s_20_18, 0, -1, 0}, +{ 3, s_20_19, 0, -1, 0}, +{ 3, s_20_20, 0, -1, 0}, +{ 3, s_20_21, 0, -1, 0}, +{ 4, s_20_22, 0, -1, 0}, +{ 4, s_20_23, 0, -1, 0}, +{ 4, s_20_24, 0, -1, 0}, +{ 4, s_20_25, 0, -1, 0}, +{ 2, s_20_26, 0, -1, 0}, +{ 2, s_20_27, 0, -1, 0}, +{ 3, s_20_28, 0, -1, 0}, +{ 3, s_20_29, 0, -1, 0}, +{ 3, s_20_30, 0, -1, 0}, +{ 3, s_20_31, 0, -1, 0} +}; + +static const symbol s_21_0[2] = { 's', 'a' }; +static const symbol s_21_1[2] = { 's', 'e' }; +static const symbol s_21_2[3] = { 's', 'a', 'k' }; +static const symbol s_21_3[3] = { 's', 'e', 'k' }; +static const symbol s_21_4[3] = { 's', 'a', 'm' }; +static const symbol s_21_5[3] = { 's', 'e', 'm' }; +static const symbol s_21_6[3] = { 's', 'a', 'n' }; +static const symbol s_21_7[3] = { 's', 'e', 'n' }; +static const struct among a_21[8] = { +{ 2, s_21_0, 0, -1, 0}, +{ 2, s_21_1, 0, -1, 0}, +{ 3, s_21_2, 0, -1, 0}, +{ 3, s_21_3, 0, -1, 0}, +{ 3, s_21_4, 0, -1, 0}, +{ 3, s_21_5, 0, -1, 0}, +{ 3, s_21_6, 0, -1, 0}, +{ 3, s_21_7, 0, -1, 0} +}; + +static const symbol s_22_0[4] = { 'm', 'i', 0xC5, 0x9F }; +static const symbol s_22_1[4] = { 'm', 'u', 0xC5, 0x9F }; +static const symbol s_22_2[5] = { 'm', 0xC4, 0xB1, 0xC5, 0x9F }; +static const symbol s_22_3[5] = { 'm', 0xC3, 0xBC, 0xC5, 0x9F }; +static const struct among a_22[4] = { +{ 4, s_22_0, 0, -1, 0}, +{ 4, s_22_1, 0, -1, 0}, +{ 5, s_22_2, 0, -1, 0}, +{ 5, s_22_3, 0, -1, 0} +}; + +static const symbol s_23_0[1] = { 'b' }; +static const symbol s_23_1[1] = { 'c' }; +static const symbol s_23_2[1] = { 'd' }; +static const symbol s_23_3[2] = { 0xC4, 0x9F }; +static const struct among a_23[4] = { +{ 1, s_23_0, 0, 1, 0}, +{ 1, s_23_1, 0, 2, 0}, +{ 1, s_23_2, 0, 3, 0}, +{ 2, s_23_3, 0, 4, 0} +}; + +static const unsigned char g_vowel[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8, 0, 0, 0, 0, 0, 0, 1 }; + +static const unsigned char g_U[] = { 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1 }; + +static const unsigned char g_vowel1[] = { 1, 64, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + +static const unsigned char g_vowel2[] = { 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130 }; + +static const unsigned char g_vowel3[] = { 1, 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, 1 }; + +static const unsigned char g_vowel4[] = { 17 }; + +static const unsigned char g_vowel5[] = { 65 }; + +static const unsigned char g_vowel6[] = { 65 }; + +static const symbol s_0[] = { 0xC4, 0xB1 }; +static const symbol s_1[] = { 0xC3, 0xB6 }; +static const symbol s_2[] = { 0xC3, 0xBC }; +static const symbol s_3[] = { 'k', 'i' }; +static const symbol s_4[] = { 'k', 'e', 'n' }; +static const symbol s_5[] = { 'p' }; +static const symbol s_6[] = { 0xC3, 0xA7 }; +static const symbol s_7[] = { 't' }; +static const symbol s_8[] = { 'k' }; +static const symbol s_9[] = { 0xC4, 0xB1 }; +static const symbol s_10[] = { 0xC4, 0xB1 }; +static const symbol s_11[] = { 'i' }; +static const symbol s_12[] = { 'u' }; +static const symbol s_13[] = { 0xC3, 0xB6 }; +static const symbol s_14[] = { 0xC3, 0xBC }; +static const symbol s_15[] = { 0xC3, 0xBC }; +static const symbol s_16[] = { 'a', 'd' }; +static const symbol s_17[] = { 's', 'o', 'y' }; + +static int r_check_vowel_harmony(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (out_grouping_b_U(z, g_vowel, 97, 305, 1) < 0) return 0; + { + int v_2 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'a') goto lab1; + z->c--; + if (out_grouping_b_U(z, g_vowel1, 97, 305, 1) < 0) goto lab1; + goto lab0; + lab1: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab2; + z->c--; + if (out_grouping_b_U(z, g_vowel2, 101, 252, 1) < 0) goto lab2; + goto lab0; + lab2: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_0))) goto lab3; + if (out_grouping_b_U(z, g_vowel3, 97, 305, 1) < 0) goto lab3; + goto lab0; + lab3: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab4; + z->c--; + if (out_grouping_b_U(z, g_vowel4, 101, 105, 1) < 0) goto lab4; + goto lab0; + lab4: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab5; + z->c--; + if (out_grouping_b_U(z, g_vowel5, 111, 117, 1) < 0) goto lab5; + goto lab0; + lab5: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_1))) goto lab6; + if (out_grouping_b_U(z, g_vowel6, 246, 252, 1) < 0) goto lab6; + goto lab0; + lab6: + z->c = z->l - v_2; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab7; + z->c--; + if (out_grouping_b_U(z, g_vowel5, 111, 117, 1) < 0) goto lab7; + goto lab0; + lab7: + z->c = z->l - v_2; + if (!(eq_s_b(z, 2, s_2))) return 0; + if (out_grouping_b_U(z, g_vowel6, 246, 252, 1) < 0) return 0; + } + lab0: + z->c = z->l - v_1; + } + return 1; +} + +static int r_mark_suffix_with_optional_n_consonant(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') goto lab1; + z->c--; + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) goto lab1; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'n') goto lab2; + z->c--; + z->c = z->l - v_4; + } + return 0; + lab2: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) return 0; + z->c = z->l - v_5; + } + } +lab0: + return 1; +} + +static int r_mark_suffix_with_optional_s_consonant(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab1; + z->c--; + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) goto lab1; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 's') goto lab2; + z->c--; + z->c = z->l - v_4; + } + return 0; + lab2: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) return 0; + z->c = z->l - v_5; + } + } +lab0: + return 1; +} + +static int r_mark_suffix_with_optional_y_consonant(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab1; + z->c--; + { + int v_2 = z->l - z->c; + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) goto lab1; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'y') goto lab2; + z->c--; + z->c = z->l - v_4; + } + return 0; + lab2: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + if (in_grouping_b_U(z, g_vowel, 97, 305, 0)) return 0; + z->c = z->l - v_5; + } + } +lab0: + return 1; +} + +static int r_mark_suffix_with_optional_U_vowel(struct SN_env * z) { + { + int v_1 = z->l - z->c; + if (in_grouping_b_U(z, g_U, 105, 305, 0)) goto lab1; + { + int v_2 = z->l - z->c; + if (out_grouping_b_U(z, g_vowel, 97, 305, 0)) goto lab1; + z->c = z->l - v_2; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + if (in_grouping_b_U(z, g_U, 105, 305, 0)) goto lab2; + z->c = z->l - v_4; + } + return 0; + lab2: + z->c = z->l - v_3; + } + { + int v_5 = z->l - z->c; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) return 0; + z->c = ret; + } + if (out_grouping_b_U(z, g_vowel, 97, 305, 0)) return 0; + z->c = z->l - v_5; + } + } +lab0: + return 1; +} + +static int r_mark_possessives(struct SN_env * z) { + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((67133440 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_0, 10)) return 0; + { + int ret = r_mark_suffix_with_optional_U_vowel(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_sU(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (in_grouping_b_U(z, g_U, 105, 305, 0)) return 0; + { + int ret = r_mark_suffix_with_optional_s_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_lArI(struct SN_env * z) { + if (z->c - 3 <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 177)) return 0; + if (!find_among_b(z, a_1, 2)) return 0; + return 1; +} + +static int r_mark_yU(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (in_grouping_b_U(z, g_U, 105, 305, 0)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_nU(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (!find_among_b(z, a_2, 4)) return 0; + return 1; +} + +static int r_mark_nUn(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 110) return 0; + if (!find_among_b(z, a_3, 4)) return 0; + { + int ret = r_mark_suffix_with_optional_n_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_yA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_4, 2)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_nA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_5, 2)) return 0; + return 1; +} + +static int r_mark_DA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_6, 4)) return 0; + return 1; +} + +static int r_mark_ndA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_7, 2)) return 0; + return 1; +} + +static int r_mark_DAn(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 110) return 0; + if (!find_among_b(z, a_8, 4)) return 0; + return 1; +} + +static int r_mark_ndAn(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 110) return 0; + if (!find_among_b(z, a_9, 2)) return 0; + return 1; +} + +static int r_mark_ylA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_10, 2)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_ki(struct SN_env * z) { + if (!(eq_s_b(z, 2, s_3))) return 0; + return 1; +} + +static int r_mark_ncA(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_11, 2)) return 0; + { + int ret = r_mark_suffix_with_optional_n_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_yUm(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 109) return 0; + if (!find_among_b(z, a_12, 4)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_sUn(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 110) return 0; + if (!find_among_b(z, a_13, 4)) return 0; + return 1; +} + +static int r_mark_yUz(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 122) return 0; + if (!find_among_b(z, a_14, 4)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_sUnUz(struct SN_env * z) { + if (z->c - 4 <= z->lb || z->p[z->c - 1] != 122) return 0; + if (!find_among_b(z, a_15, 4)) return 0; + return 1; +} + +static int r_mark_lAr(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 114) return 0; + if (!find_among_b(z, a_16, 2)) return 0; + return 1; +} + +static int r_mark_nUz(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 122) return 0; + if (!find_among_b(z, a_17, 4)) return 0; + return 1; +} + +static int r_mark_DUr(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 114) return 0; + if (!find_among_b(z, a_18, 8)) return 0; + return 1; +} + +static int r_mark_cAsInA(struct SN_env * z) { + if (z->c - 5 <= z->lb || (z->p[z->c - 1] != 97 && z->p[z->c - 1] != 101)) return 0; + if (!find_among_b(z, a_19, 2)) return 0; + return 1; +} + +static int r_mark_yDU(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (!find_among_b(z, a_20, 32)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_ysA(struct SN_env * z) { + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((26658 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!find_among_b(z, a_21, 8)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_ymUs_(struct SN_env * z) { + { + int ret = r_check_vowel_harmony(z); + if (ret <= 0) return ret; + } + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 159) return 0; + if (!find_among_b(z, a_22, 4)) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_mark_yken(struct SN_env * z) { + if (!(eq_s_b(z, 3, s_4))) return 0; + { + int ret = r_mark_suffix_with_optional_y_consonant(z); + if (ret <= 0) return ret; + } + return 1; +} + +static int r_stem_nominal_verb_suffixes(struct SN_env * z) { + z->ket = z->c; + z->I[0] = 1; + { + int v_1 = z->l - z->c; + { + int v_2 = z->l - z->c; + { + int ret = r_mark_ymUs_(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = z->l - v_2; + { + int ret = r_mark_yDU(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + goto lab2; + lab4: + z->c = z->l - v_2; + { + int ret = r_mark_ysA(z); + if (ret == 0) goto lab5; + if (ret < 0) return ret; + } + goto lab2; + lab5: + z->c = z->l - v_2; + { + int ret = r_mark_yken(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + } + lab2: + goto lab0; + lab1: + z->c = z->l - v_1; + { + int ret = r_mark_cAsInA(z); + if (ret == 0) goto lab6; + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + { + int ret = r_mark_sUnUz(z); + if (ret == 0) goto lab8; + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - v_3; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + goto lab7; + lab9: + z->c = z->l - v_3; + { + int ret = r_mark_yUm(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + goto lab7; + lab10: + z->c = z->l - v_3; + { + int ret = r_mark_sUn(z); + if (ret == 0) goto lab11; + if (ret < 0) return ret; + } + goto lab7; + lab11: + z->c = z->l - v_3; + { + int ret = r_mark_yUz(z); + if (ret == 0) goto lab12; + if (ret < 0) return ret; + } + goto lab7; + lab12: + z->c = z->l - v_3; + } + lab7: + { + int ret = r_mark_ymUs_(z); + if (ret == 0) goto lab6; + if (ret < 0) return ret; + } + goto lab0; + lab6: + z->c = z->l - v_1; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + z->ket = z->c; + { + int v_5 = z->l - z->c; + { + int ret = r_mark_DUr(z); + if (ret == 0) goto lab16; + if (ret < 0) return ret; + } + goto lab15; + lab16: + z->c = z->l - v_5; + { + int ret = r_mark_yDU(z); + if (ret == 0) goto lab17; + if (ret < 0) return ret; + } + goto lab15; + lab17: + z->c = z->l - v_5; + { + int ret = r_mark_ysA(z); + if (ret == 0) goto lab18; + if (ret < 0) return ret; + } + goto lab15; + lab18: + z->c = z->l - v_5; + { + int ret = r_mark_ymUs_(z); + if (ret == 0) { z->c = z->l - v_4; goto lab14; } + if (ret < 0) return ret; + } + } + lab15: + lab14: + ; + } + z->I[0] = 0; + goto lab0; + lab13: + z->c = z->l - v_1; + { + int ret = r_mark_nUz(z); + if (ret == 0) goto lab19; + if (ret < 0) return ret; + } + { + int v_6 = z->l - z->c; + { + int ret = r_mark_yDU(z); + if (ret == 0) goto lab21; + if (ret < 0) return ret; + } + goto lab20; + lab21: + z->c = z->l - v_6; + { + int ret = r_mark_ysA(z); + if (ret == 0) goto lab19; + if (ret < 0) return ret; + } + } + lab20: + goto lab0; + lab19: + z->c = z->l - v_1; + { + int v_7 = z->l - z->c; + { + int ret = r_mark_sUnUz(z); + if (ret == 0) goto lab24; + if (ret < 0) return ret; + } + goto lab23; + lab24: + z->c = z->l - v_7; + { + int ret = r_mark_yUz(z); + if (ret == 0) goto lab25; + if (ret < 0) return ret; + } + goto lab23; + lab25: + z->c = z->l - v_7; + { + int ret = r_mark_sUn(z); + if (ret == 0) goto lab26; + if (ret < 0) return ret; + } + goto lab23; + lab26: + z->c = z->l - v_7; + { + int ret = r_mark_yUm(z); + if (ret == 0) goto lab22; + if (ret < 0) return ret; + } + } + lab23: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_ymUs_(z); + if (ret == 0) { z->c = z->l - v_8; goto lab27; } + if (ret < 0) return ret; + } + lab27: + ; + } + goto lab0; + lab22: + z->c = z->l - v_1; + { + int ret = r_mark_DUr(z); + if (ret <= 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_9 = z->l - z->c; + z->ket = z->c; + { + int v_10 = z->l - z->c; + { + int ret = r_mark_sUnUz(z); + if (ret == 0) goto lab30; + if (ret < 0) return ret; + } + goto lab29; + lab30: + z->c = z->l - v_10; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab31; + if (ret < 0) return ret; + } + goto lab29; + lab31: + z->c = z->l - v_10; + { + int ret = r_mark_yUm(z); + if (ret == 0) goto lab32; + if (ret < 0) return ret; + } + goto lab29; + lab32: + z->c = z->l - v_10; + { + int ret = r_mark_sUn(z); + if (ret == 0) goto lab33; + if (ret < 0) return ret; + } + goto lab29; + lab33: + z->c = z->l - v_10; + { + int ret = r_mark_yUz(z); + if (ret == 0) goto lab34; + if (ret < 0) return ret; + } + goto lab29; + lab34: + z->c = z->l - v_10; + } + lab29: + { + int ret = r_mark_ymUs_(z); + if (ret == 0) { z->c = z->l - v_9; goto lab28; } + if (ret < 0) return ret; + } + lab28: + ; + } + } +lab0: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + return 1; +} + +static int r_stem_suffix_chain_before_ki(struct SN_env * z) { + z->ket = z->c; + { + int ret = r_mark_ki(z); + if (ret <= 0) return ret; + } + { + int v_1 = z->l - z->c; + { + int ret = r_mark_DA(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + z->ket = z->c; + { + int v_3 = z->l - z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab4; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_4 = z->l - z->c; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_4; goto lab5; } + if (ret < 0) return ret; + } + lab5: + ; + } + goto lab3; + lab4: + z->c = z->l - v_3; + { + int ret = r_mark_possessives(z); + if (ret == 0) { z->c = z->l - v_2; goto lab2; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_5 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_5; goto lab6; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_5; goto lab6; } + if (ret < 0) return ret; + } + lab6: + ; + } + } + lab3: + lab2: + ; + } + goto lab0; + lab1: + z->c = z->l - v_1; + { + int ret = r_mark_nUn(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_6 = z->l - z->c; + z->ket = z->c; + { + int v_7 = z->l - z->c; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab9; + lab10: + z->c = z->l - v_7; + z->ket = z->c; + { + int v_8 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - v_8; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab11; + if (ret < 0) return ret; + } + } + lab12: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_9 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_9; goto lab14; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_9; goto lab14; } + if (ret < 0) return ret; + } + lab14: + ; + } + goto lab9; + lab11: + z->c = z->l - v_7; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_6; goto lab8; } + if (ret < 0) return ret; + } + } + lab9: + lab8: + ; + } + goto lab0; + lab7: + z->c = z->l - v_1; + { + int ret = r_mark_ndA(z); + if (ret <= 0) return ret; + } + { + int v_10 = z->l - z->c; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab16; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab15; + lab16: + z->c = z->l - v_10; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab17; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_11 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_11; goto lab18; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_11; goto lab18; } + if (ret < 0) return ret; + } + lab18: + ; + } + goto lab15; + lab17: + z->c = z->l - v_10; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret <= 0) return ret; + } + } + lab15: + ; + } +lab0: + return 1; +} + +static int r_stem_noun_suffixes(struct SN_env * z) { + { + int v_1 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab1; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_2 = z->l - z->c; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_2; goto lab2; } + if (ret < 0) return ret; + } + lab2: + ; + } + goto lab0; + lab1: + z->c = z->l - v_1; + z->ket = z->c; + { + int ret = r_mark_ncA(z); + if (ret == 0) goto lab3; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_3 = z->l - z->c; + { + int v_4 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab6; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab5; + lab6: + z->c = z->l - v_4; + z->ket = z->c; + { + int v_5 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + goto lab8; + lab9: + z->c = z->l - v_5; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab7; + if (ret < 0) return ret; + } + } + lab8: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_6 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_6; goto lab10; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_6; goto lab10; } + if (ret < 0) return ret; + } + lab10: + ; + } + goto lab5; + lab7: + z->c = z->l - v_4; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_3; goto lab4; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_3; goto lab4; } + if (ret < 0) return ret; + } + } + lab5: + lab4: + ; + } + goto lab0; + lab3: + z->c = z->l - v_1; + z->ket = z->c; + { + int v_7 = z->l - z->c; + { + int ret = r_mark_ndA(z); + if (ret == 0) goto lab13; + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - v_7; + { + int ret = r_mark_nA(z); + if (ret == 0) goto lab11; + if (ret < 0) return ret; + } + } + lab12: + { + int v_8 = z->l - z->c; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab15; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab14; + lab15: + z->c = z->l - v_8; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab16; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_9 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_9; goto lab17; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_9; goto lab17; } + if (ret < 0) return ret; + } + lab17: + ; + } + goto lab14; + lab16: + z->c = z->l - v_8; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) goto lab11; + if (ret < 0) return ret; + } + } + lab14: + goto lab0; + lab11: + z->c = z->l - v_1; + z->ket = z->c; + { + int v_10 = z->l - z->c; + { + int ret = r_mark_ndAn(z); + if (ret == 0) goto lab20; + if (ret < 0) return ret; + } + goto lab19; + lab20: + z->c = z->l - v_10; + { + int ret = r_mark_nU(z); + if (ret == 0) goto lab18; + if (ret < 0) return ret; + } + } + lab19: + { + int v_11 = z->l - z->c; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab22; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_12 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_12; goto lab23; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_12; goto lab23; } + if (ret < 0) return ret; + } + lab23: + ; + } + goto lab21; + lab22: + z->c = z->l - v_11; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab18; + if (ret < 0) return ret; + } + } + lab21: + goto lab0; + lab18: + z->c = z->l - v_1; + z->ket = z->c; + { + int ret = r_mark_DAn(z); + if (ret == 0) goto lab24; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_13 = z->l - z->c; + z->ket = z->c; + { + int v_14 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab27; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_15 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_15; goto lab28; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_15; goto lab28; } + if (ret < 0) return ret; + } + lab28: + ; + } + goto lab26; + lab27: + z->c = z->l - v_14; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab29; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_16 = z->l - z->c; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_16; goto lab30; } + if (ret < 0) return ret; + } + lab30: + ; + } + goto lab26; + lab29: + z->c = z->l - v_14; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_13; goto lab25; } + if (ret < 0) return ret; + } + } + lab26: + lab25: + ; + } + goto lab0; + lab24: + z->c = z->l - v_1; + z->ket = z->c; + { + int v_17 = z->l - z->c; + { + int ret = r_mark_nUn(z); + if (ret == 0) goto lab33; + if (ret < 0) return ret; + } + goto lab32; + lab33: + z->c = z->l - v_17; + { + int ret = r_mark_ylA(z); + if (ret == 0) goto lab31; + if (ret < 0) return ret; + } + } + lab32: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_18 = z->l - z->c; + { + int v_19 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) goto lab36; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) goto lab36; + if (ret < 0) return ret; + } + goto lab35; + lab36: + z->c = z->l - v_19; + z->ket = z->c; + { + int v_20 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab39; + if (ret < 0) return ret; + } + goto lab38; + lab39: + z->c = z->l - v_20; + { + int ret = r_mark_sU(z); + if (ret == 0) goto lab37; + if (ret < 0) return ret; + } + } + lab38: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_21 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_21; goto lab40; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_21; goto lab40; } + if (ret < 0) return ret; + } + lab40: + ; + } + goto lab35; + lab37: + z->c = z->l - v_19; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_18; goto lab34; } + if (ret < 0) return ret; + } + } + lab35: + lab34: + ; + } + goto lab0; + lab31: + z->c = z->l - v_1; + z->ket = z->c; + { + int ret = r_mark_lArI(z); + if (ret == 0) goto lab41; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab0; + lab41: + z->c = z->l - v_1; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) goto lab42; + if (ret < 0) return ret; + } + goto lab0; + lab42: + z->c = z->l - v_1; + z->ket = z->c; + { + int v_22 = z->l - z->c; + { + int ret = r_mark_DA(z); + if (ret == 0) goto lab45; + if (ret < 0) return ret; + } + goto lab44; + lab45: + z->c = z->l - v_22; + { + int ret = r_mark_yU(z); + if (ret == 0) goto lab46; + if (ret < 0) return ret; + } + goto lab44; + lab46: + z->c = z->l - v_22; + { + int ret = r_mark_yA(z); + if (ret == 0) goto lab43; + if (ret < 0) return ret; + } + } + lab44: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_23 = z->l - z->c; + z->ket = z->c; + { + int v_24 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab49; + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_25 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_25; goto lab50; } + if (ret < 0) return ret; + } + lab50: + ; + } + goto lab48; + lab49: + z->c = z->l - v_24; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_23; goto lab47; } + if (ret < 0) return ret; + } + } + lab48: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_23; goto lab47; } + if (ret < 0) return ret; + } + lab47: + ; + } + goto lab0; + lab43: + z->c = z->l - v_1; + z->ket = z->c; + { + int v_26 = z->l - z->c; + { + int ret = r_mark_possessives(z); + if (ret == 0) goto lab52; + if (ret < 0) return ret; + } + goto lab51; + lab52: + z->c = z->l - v_26; + { + int ret = r_mark_sU(z); + if (ret <= 0) return ret; + } + } + lab51: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int v_27 = z->l - z->c; + z->ket = z->c; + { + int ret = r_mark_lAr(z); + if (ret == 0) { z->c = z->l - v_27; goto lab53; } + if (ret < 0) return ret; + } + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + { + int ret = r_stem_suffix_chain_before_ki(z); + if (ret == 0) { z->c = z->l - v_27; goto lab53; } + if (ret < 0) return ret; + } + lab53: + ; + } + } +lab0: + return 1; +} + +static int r_post_process_last_consonants(struct SN_env * z) { + int among_var; + z->ket = z->c; + among_var = find_among_b(z, a_23, 4); + if (!among_var) return 0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 1, s_5); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 2, s_6); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 1, s_7); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 1, s_8); + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_append_U_to_stems_ending_with_d_or_g(struct SN_env * z) { + z->ket = z->c; + z->bra = z->c; + { + int v_1 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'd') goto lab1; + z->c--; + goto lab0; + lab1: + z->c = z->l - v_1; + if (z->c <= z->lb || z->p[z->c - 1] != 'g') return 0; + z->c--; + } +lab0: + if (out_grouping_b_U(z, g_vowel, 97, 305, 1) < 0) return 0; + { + int v_2 = z->l - z->c; + { + int v_3 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'a') goto lab5; + z->c--; + goto lab4; + lab5: + z->c = z->l - v_3; + if (!(eq_s_b(z, 2, s_9))) goto lab3; + } + lab4: + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + goto lab2; + lab3: + z->c = z->l - v_2; + { + int v_4 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab8; + z->c--; + goto lab7; + lab8: + z->c = z->l - v_4; + if (z->c <= z->lb || z->p[z->c - 1] != 'i') goto lab6; + z->c--; + } + lab7: + { + int ret = slice_from_s(z, 1, s_11); + if (ret < 0) return ret; + } + goto lab2; + lab6: + z->c = z->l - v_2; + { + int v_5 = z->l - z->c; + if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab11; + z->c--; + goto lab10; + lab11: + z->c = z->l - v_5; + if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab9; + z->c--; + } + lab10: + { + int ret = slice_from_s(z, 1, s_12); + if (ret < 0) return ret; + } + goto lab2; + lab9: + z->c = z->l - v_2; + { + int v_6 = z->l - z->c; + if (!(eq_s_b(z, 2, s_13))) goto lab13; + goto lab12; + lab13: + z->c = z->l - v_6; + if (!(eq_s_b(z, 2, s_14))) return 0; + } + lab12: + { + int ret = slice_from_s(z, 2, s_15); + if (ret < 0) return ret; + } + } +lab2: + return 1; +} + +static int r_is_reserved_word(struct SN_env * z) { + if (!(eq_s_b(z, 2, s_16))) return 0; + { + int v_1 = z->l - z->c; + if (!(eq_s_b(z, 3, s_17))) { z->c = z->l - v_1; goto lab0; } + lab0: + ; + } + if (z->c > z->lb) return 0; + return 1; +} + +static int r_remove_proper_noun_suffix(struct SN_env * z) { + { + int v_1 = z->c; + z->bra = z->c; + while (1) { + int v_2 = z->c; + { + int v_3 = z->c; + if (z->c == z->l || z->p[z->c] != '\'') goto lab2; + z->c++; + goto lab1; + lab2: + z->c = v_3; + } + z->c = v_2; + break; + lab1: + z->c = v_2; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab0; + z->c = ret; + } + } + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab0: + z->c = v_1; + } + { + int v_4 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 2); + if (ret < 0) goto lab3; + z->c = ret; + } + while (1) { + int v_5 = z->c; + if (z->c == z->l || z->p[z->c] != '\'') goto lab4; + z->c++; + z->c = v_5; + break; + lab4: + z->c = v_5; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab3; + z->c = ret; + } + } + z->bra = z->c; + z->c = z->l; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + lab3: + z->c = v_4; + } + return 1; +} + +static int r_more_than_one_syllable_word(struct SN_env * z) { + { + int v_1 = z->c; + { + int i; for (i = 2; i > 0; i--) { + { + int ret = out_grouping_U(z, g_vowel, 97, 305, 1); + if (ret < 0) return 0; + z->c += ret; + } + } + } + z->c = v_1; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_is_reserved_word(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + return 0; + lab0: + z->c = z->l - v_1; + } + { + int v_2 = z->l - z->c; + { + int ret = r_append_U_to_stems_ending_with_d_or_g(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + { + int v_3 = z->l - z->c; + { + int ret = r_post_process_last_consonants(z); + if (ret < 0) return ret; + } + z->c = z->l - v_3; + } + z->c = z->lb; + return 1; +} + +extern int turkish_UTF_8_stem(struct SN_env * z) { + { + int ret = r_remove_proper_noun_suffix(z); + if (ret < 0) return ret; + } + { + int ret = r_more_than_one_syllable_word(z); + if (ret <= 0) return ret; + } + z->lb = z->c; z->c = z->l; + { + int v_1 = z->l - z->c; + { + int ret = r_stem_nominal_verb_suffixes(z); + if (ret < 0) return ret; + } + z->c = z->l - v_1; + } + if (!(z->I[0])) return 0; + { + int v_2 = z->l - z->c; + { + int ret = r_stem_noun_suffixes(z); + if (ret < 0) return ret; + } + z->c = z->l - v_2; + } + z->c = z->lb; + { + int ret = r_postlude(z); + if (ret <= 0) return ret; + } + return 1; +} + +extern struct SN_env * turkish_UTF_8_create_env(void) { return SN_create_env(0, 1); } + +extern void turkish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_turkish.h b/contrib/libs/snowball/src_c/stem_UTF_8_turkish.h new file mode 100644 index 000000000000..18d20fa97aac --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_turkish.h @@ -0,0 +1,15 @@ +/* Generated from turkish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * turkish_UTF_8_create_env(void); +extern void turkish_UTF_8_close_env(struct SN_env * z); + +extern int turkish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.c b/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.c new file mode 100644 index 000000000000..df8a2c7ffacf --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.c @@ -0,0 +1,1338 @@ +/* Generated from yiddish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#include "../runtime/header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int yiddish_UTF_8_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_R1plus3(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * yiddish_UTF_8_create_env(void); +extern void yiddish_UTF_8_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[4] = { 0xD7, 0x95, 0xD7, 0x95 }; +static const symbol s_0_1[4] = { 0xD7, 0x95, 0xD7, 0x99 }; +static const symbol s_0_2[4] = { 0xD7, 0x99, 0xD7, 0x99 }; +static const symbol s_0_3[2] = { 0xD7, 0x9A }; +static const symbol s_0_4[2] = { 0xD7, 0x9D }; +static const symbol s_0_5[2] = { 0xD7, 0x9F }; +static const symbol s_0_6[2] = { 0xD7, 0xA3 }; +static const symbol s_0_7[2] = { 0xD7, 0xA5 }; +static const struct among a_0[8] = { +{ 4, s_0_0, 0, 1, 0}, +{ 4, s_0_1, 0, 2, 0}, +{ 4, s_0_2, 0, 3, 0}, +{ 2, s_0_3, 0, 4, 0}, +{ 2, s_0_4, 0, 5, 0}, +{ 2, s_0_5, 0, 6, 0}, +{ 2, s_0_6, 0, 7, 0}, +{ 2, s_0_7, 0, 8, 0} +}; + +static const symbol s_1_0[10] = { 0xD7, 0x90, 0xD7, 0x93, 0xD7, 0x95, 0xD7, 0xA8, 0xD7, 0x9B }; +static const symbol s_1_1[8] = { 0xD7, 0x90, 0xD7, 0x94, 0xD7, 0x99, 0xD7, 0xA0 }; +static const symbol s_1_2[8] = { 0xD7, 0x90, 0xD7, 0x94, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_3[8] = { 0xD7, 0x90, 0xD7, 0x94, 0xD7, 0xB2, 0xD7, 0x9E }; +static const symbol s_1_4[6] = { 0xD7, 0x90, 0xD7, 0x95, 0xD7, 0x9E }; +static const symbol s_1_5[12] = { 0xD7, 0x90, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_6[10] = { 0xD7, 0x90, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_7[4] = { 0xD7, 0x90, 0xD7, 0xA0 }; +static const symbol s_1_8[6] = { 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x98 }; +static const symbol s_1_9[14] = { 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x98, 0xD7, 0xA7, 0xD7, 0xA2, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_1_10[12] = { 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x99, 0xD7, 0x93, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_11[4] = { 0xD7, 0x90, 0xD7, 0xA4 }; +static const symbol s_1_12[8] = { 0xD7, 0x90, 0xD7, 0xA4, 0xD7, 0x99, 0xD7, 0xA8 }; +static const symbol s_1_13[10] = { 0xD7, 0x90, 0xD7, 0xA7, 0xD7, 0xA2, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_1_14[8] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x90, 0xD7, 0xA4 }; +static const symbol s_1_15[8] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x95, 0xD7, 0x9E }; +static const symbol s_1_16[14] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_17[12] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_18[8] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0xB1, 0xD7, 0xA1 }; +static const symbol s_1_19[8] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0xB1, 0xD7, 0xA4 }; +static const symbol s_1_20[8] = { 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0xA0 }; +static const symbol s_1_21[8] = { 0xD7, 0x90, 0xD7, 0xB0, 0xD7, 0xA2, 0xD7, 0xA7 }; +static const symbol s_1_22[6] = { 0xD7, 0x90, 0xD7, 0xB1, 0xD7, 0xA1 }; +static const symbol s_1_23[6] = { 0xD7, 0x90, 0xD7, 0xB1, 0xD7, 0xA4 }; +static const symbol s_1_24[6] = { 0xD7, 0x90, 0xD7, 0xB2, 0xD7, 0xA0 }; +static const symbol s_1_25[4] = { 0xD7, 0x91, 0xD7, 0x90 }; +static const symbol s_1_26[4] = { 0xD7, 0x91, 0xD7, 0xB2 }; +static const symbol s_1_27[8] = { 0xD7, 0x93, 0xD7, 0x95, 0xD7, 0xA8, 0xD7, 0x9B }; +static const symbol s_1_28[6] = { 0xD7, 0x93, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_29[6] = { 0xD7, 0x9E, 0xD7, 0x99, 0xD7, 0x98 }; +static const symbol s_1_30[6] = { 0xD7, 0xA0, 0xD7, 0x90, 0xD7, 0x9B }; +static const symbol s_1_31[6] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8 }; +static const symbol s_1_32[10] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x91, 0xD7, 0xB2 }; +static const symbol s_1_33[10] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0xB1, 0xD7, 0xA1 }; +static const symbol s_1_34[16] = { 0xD7, 0xA4, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x93, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_1_35[4] = { 0xD7, 0xA6, 0xD7, 0x95 }; +static const symbol s_1_36[14] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0x96, 0xD7, 0x90, 0xD7, 0x9E, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_1_37[10] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0xB1, 0xD7, 0xA4 }; +static const symbol s_1_38[10] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_1_39[4] = { 0xD7, 0xA6, 0xD7, 0xA2 }; +static const struct among a_1[40] = { +{ 10, s_1_0, 0, 1, 0}, +{ 8, s_1_1, 0, 1, 0}, +{ 8, s_1_2, 0, 1, 0}, +{ 8, s_1_3, 0, 1, 0}, +{ 6, s_1_4, 0, 1, 0}, +{ 12, s_1_5, 0, 1, 0}, +{ 10, s_1_6, 0, 1, 0}, +{ 4, s_1_7, 0, 1, 0}, +{ 6, s_1_8, -1, 1, 0}, +{ 14, s_1_9, -1, 1, 0}, +{ 12, s_1_10, -3, 1, 0}, +{ 4, s_1_11, 0, 1, 0}, +{ 8, s_1_12, -1, 1, 0}, +{ 10, s_1_13, 0, 1, 0}, +{ 8, s_1_14, 0, 1, 0}, +{ 8, s_1_15, 0, 1, 0}, +{ 14, s_1_16, 0, 1, 0}, +{ 12, s_1_17, 0, 1, 0}, +{ 8, s_1_18, 0, 1, 0}, +{ 8, s_1_19, 0, 1, 0}, +{ 8, s_1_20, 0, 1, 0}, +{ 8, s_1_21, 0, 1, 0}, +{ 6, s_1_22, 0, 1, 0}, +{ 6, s_1_23, 0, 1, 0}, +{ 6, s_1_24, 0, 1, 0}, +{ 4, s_1_25, 0, 1, 0}, +{ 4, s_1_26, 0, 1, 0}, +{ 8, s_1_27, 0, 1, 0}, +{ 6, s_1_28, 0, 1, 0}, +{ 6, s_1_29, 0, 1, 0}, +{ 6, s_1_30, 0, 1, 0}, +{ 6, s_1_31, 0, 1, 0}, +{ 10, s_1_32, -1, 1, 0}, +{ 10, s_1_33, -2, 1, 0}, +{ 16, s_1_34, 0, 1, 0}, +{ 4, s_1_35, 0, 1, 0}, +{ 14, s_1_36, -1, 1, 0}, +{ 10, s_1_37, -2, 1, 0}, +{ 10, s_1_38, -3, 1, 0}, +{ 4, s_1_39, 0, 1, 0} +}; + +static const symbol s_2_0[6] = { 0xD7, 0x93, 0xD7, 0x96, 0xD7, 0xA9 }; +static const symbol s_2_1[6] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0xA8 }; +static const symbol s_2_2[6] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0xA9 }; +static const symbol s_2_3[6] = { 0xD7, 0xA9, 0xD7, 0xA4, 0xD7, 0xA8 }; +static const struct among a_2[4] = { +{ 6, s_2_0, 0, -1, 0}, +{ 6, s_2_1, 0, -1, 0}, +{ 6, s_2_2, 0, -1, 0}, +{ 6, s_2_3, 0, -1, 0} +}; + +static const symbol s_3_0[8] = { 0xD7, 0xA7, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0x91 }; +static const symbol s_3_1[6] = { 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91 }; +static const symbol s_3_2[8] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91 }; +static const symbol s_3_3[8] = { 0xD7, 0xA9, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91 }; +static const symbol s_3_4[6] = { 0xD7, 0x94, 0xD7, 0xB1, 0xD7, 0x91 }; +static const symbol s_3_5[8] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x92 }; +static const symbol s_3_6[8] = { 0xD7, 0x92, 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_3_7[8] = { 0xD7, 0x96, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_3_8[10] = { 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_3_9[10] = { 0xD7, 0xA6, 0xD7, 0xB0, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_3_10[6] = { 0xD7, 0x91, 0xD7, 0xB1, 0xD7, 0x92 }; +static const symbol s_3_11[8] = { 0xD7, 0x91, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x93 }; +static const symbol s_3_12[6] = { 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x96 }; +static const symbol s_3_13[6] = { 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0x98 }; +static const symbol s_3_14[6] = { 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0x98 }; +static const symbol s_3_15[6] = { 0xD7, 0x9E, 0xD7, 0x99, 0xD7, 0x98 }; +static const symbol s_3_16[8] = { 0xD7, 0xA9, 0xD7, 0xA0, 0xD7, 0x99, 0xD7, 0x98 }; +static const symbol s_3_17[6] = { 0xD7, 0xA0, 0xD7, 0x95, 0xD7, 0x9E }; +static const symbol s_3_18[8] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0x90, 0xD7, 0xA0 }; +static const symbol s_3_19[6] = { 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0xA1 }; +static const symbol s_3_20[8] = { 0xD7, 0xA9, 0xD7, 0x9E, 0xD7, 0x99, 0xD7, 0xA1 }; +static const symbol s_3_21[6] = { 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0xA1 }; +static const symbol s_3_22[10] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0xA7 }; +static const symbol s_3_23[12] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x9C, 0xD7, 0xB1, 0xD7, 0xA8 }; +static const symbol s_3_24[8] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xB1, 0xD7, 0xA8 }; +static const symbol s_3_25[8] = { 0xD7, 0xB0, 0xD7, 0x95, 0xD7, 0x98, 0xD7, 0xA9 }; +static const struct among a_3[26] = { +{ 8, s_3_0, 0, 9, 0}, +{ 6, s_3_1, 0, 10, 0}, +{ 8, s_3_2, -1, 7, 0}, +{ 8, s_3_3, -2, 15, 0}, +{ 6, s_3_4, 0, 23, 0}, +{ 8, s_3_5, 0, 12, 0}, +{ 8, s_3_6, 0, 1, 0}, +{ 8, s_3_7, 0, 18, 0}, +{ 10, s_3_8, 0, 21, 0}, +{ 10, s_3_9, 0, 20, 0}, +{ 6, s_3_10, 0, 22, 0}, +{ 8, s_3_11, 0, 16, 0}, +{ 6, s_3_12, 0, 6, 0}, +{ 6, s_3_13, 0, 4, 0}, +{ 6, s_3_14, 0, 8, 0}, +{ 6, s_3_15, 0, 3, 0}, +{ 8, s_3_16, 0, 14, 0}, +{ 6, s_3_17, 0, 2, 0}, +{ 8, s_3_18, 0, 25, 0}, +{ 6, s_3_19, 0, 5, 0}, +{ 8, s_3_20, 0, 13, 0}, +{ 6, s_3_21, 0, 11, 0}, +{ 10, s_3_22, 0, 19, 0}, +{ 12, s_3_23, 0, 24, 0}, +{ 8, s_3_24, 0, 26, 0}, +{ 8, s_3_25, 0, 17, 0} +}; + +static const symbol s_4_0[6] = { 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_4_1[6] = { 0xD7, 0xA1, 0xD7, 0x98, 0xD7, 0x95 }; +static const symbol s_4_2[2] = { 0xD7, 0x98 }; +static const symbol s_4_3[10] = { 0xD7, 0x91, 0xD7, 0xA8, 0xD7, 0x90, 0xD7, 0x9B, 0xD7, 0x98 }; +static const symbol s_4_4[4] = { 0xD7, 0xA1, 0xD7, 0x98 }; +static const symbol s_4_5[6] = { 0xD7, 0x99, 0xD7, 0xA1, 0xD7, 0x98 }; +static const symbol s_4_6[4] = { 0xD7, 0xA2, 0xD7, 0x98 }; +static const symbol s_4_7[8] = { 0xD7, 0xA9, 0xD7, 0x90, 0xD7, 0xA4, 0xD7, 0x98 }; +static const symbol s_4_8[6] = { 0xD7, 0x94, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_4_9[6] = { 0xD7, 0xA7, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_4_10[8] = { 0xD7, 0x99, 0xD7, 0xA7, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_4_11[6] = { 0xD7, 0x9C, 0xD7, 0xA2, 0xD7, 0x9B }; +static const symbol s_4_12[8] = { 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0xA2, 0xD7, 0x9B }; +static const symbol s_4_13[6] = { 0xD7, 0x99, 0xD7, 0x96, 0xD7, 0x9E }; +static const symbol s_4_14[4] = { 0xD7, 0x99, 0xD7, 0x9E }; +static const symbol s_4_15[4] = { 0xD7, 0xA2, 0xD7, 0x9E }; +static const symbol s_4_16[8] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0x9E }; +static const symbol s_4_17[10] = { 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0x9E }; +static const symbol s_4_18[2] = { 0xD7, 0xA0 }; +static const symbol s_4_19[10] = { 0xD7, 0xA7, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_4_20[8] = { 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_4_21[10] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_4_22[10] = { 0xD7, 0xA9, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_4_23[8] = { 0xD7, 0x94, 0xD7, 0xB1, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_4_24[10] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_4_25[10] = { 0xD7, 0x96, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_4_26[12] = { 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_4_27[12] = { 0xD7, 0xA6, 0xD7, 0xB0, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_4_28[8] = { 0xD7, 0x91, 0xD7, 0xB1, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_4_29[10] = { 0xD7, 0x91, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x93, 0xD7, 0xA0 }; +static const symbol s_4_30[8] = { 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x96, 0xD7, 0xA0 }; +static const symbol s_4_31[4] = { 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_32[10] = { 'G', 'E', 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_33[10] = { 'G', 'E', 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_34[10] = { 'G', 'E', 0xD7, 0x9E, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_35[10] = { 0xD7, 0xA9, 0xD7, 0xA0, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_36[6] = { 0xD7, 0xA1, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_37[8] = { 0xD7, 0x99, 0xD7, 0xA1, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_38[6] = { 0xD7, 0xA2, 0xD7, 0x98, 0xD7, 0xA0 }; +static const symbol s_4_39[10] = { 'G', 'E', 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0xA1, 0xD7, 0xA0 }; +static const symbol s_4_40[10] = { 0xD7, 0xA9, 0xD7, 0x9E, 0xD7, 0x99, 0xD7, 0xA1, 0xD7, 0xA0 }; +static const symbol s_4_41[10] = { 'G', 'E', 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0xA1, 0xD7, 0xA0 }; +static const symbol s_4_42[4] = { 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_43[12] = { 0xD7, 0x92, 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0x92, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_44[8] = { 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_45[10] = { 0xD7, 0xA0, 0xD7, 0x95, 0xD7, 0x9E, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_46[10] = { 0xD7, 0x99, 0xD7, 0x96, 0xD7, 0x9E, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_47[12] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0x90, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0xA0 }; +static const symbol s_4_48[12] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0xA7, 0xD7, 0xA0 }; +static const symbol s_4_49[14] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x9C, 0xD7, 0xB1, 0xD7, 0xA8, 0xD7, 0xA0 }; +static const symbol s_4_50[10] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xB1, 0xD7, 0xA8, 0xD7, 0xA0 }; +static const symbol s_4_51[10] = { 0xD7, 0xB0, 0xD7, 0x95, 0xD7, 0x98, 0xD7, 0xA9, 0xD7, 0xA0 }; +static const symbol s_4_52[6] = { 0xD7, 0x92, 0xD7, 0xB2, 0xD7, 0xA0 }; +static const symbol s_4_53[2] = { 0xD7, 0xA1 }; +static const symbol s_4_54[4] = { 0xD7, 0x98, 0xD7, 0xA1 }; +static const symbol s_4_55[6] = { 0xD7, 0xA2, 0xD7, 0x98, 0xD7, 0xA1 }; +static const symbol s_4_56[4] = { 0xD7, 0xA0, 0xD7, 0xA1 }; +static const symbol s_4_57[6] = { 0xD7, 0x98, 0xD7, 0xA0, 0xD7, 0xA1 }; +static const symbol s_4_58[6] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA1 }; +static const symbol s_4_59[4] = { 0xD7, 0xA2, 0xD7, 0xA1 }; +static const symbol s_4_60[6] = { 0xD7, 0x99, 0xD7, 0xA2, 0xD7, 0xA1 }; +static const symbol s_4_61[8] = { 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0xA2, 0xD7, 0xA1 }; +static const symbol s_4_62[6] = { 0xD7, 0xA2, 0xD7, 0xA8, 0xD7, 0xA1 }; +static const symbol s_4_63[10] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0xA8, 0xD7, 0xA1 }; +static const symbol s_4_64[2] = { 0xD7, 0xA2 }; +static const symbol s_4_65[4] = { 0xD7, 0x98, 0xD7, 0xA2 }; +static const symbol s_4_66[6] = { 0xD7, 0xA1, 0xD7, 0x98, 0xD7, 0xA2 }; +static const symbol s_4_67[6] = { 0xD7, 0xA2, 0xD7, 0x98, 0xD7, 0xA2 }; +static const symbol s_4_68[4] = { 0xD7, 0x99, 0xD7, 0xA2 }; +static const symbol s_4_69[6] = { 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0xA2 }; +static const symbol s_4_70[6] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2 }; +static const symbol s_4_71[8] = { 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2 }; +static const symbol s_4_72[4] = { 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_73[6] = { 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_74[8] = { 0xD7, 0xA1, 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_75[8] = { 0xD7, 0xA2, 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_76[8] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_77[10] = { 0xD7, 0x98, 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_4_78[4] = { 0xD7, 0x95, 0xD7, 0xAA }; +static const struct among a_4[79] = { +{ 6, s_4_0, 0, 1, 0}, +{ 6, s_4_1, 0, 1, 0}, +{ 2, s_4_2, 0, 1, 0}, +{ 10, s_4_3, -1, 31, 0}, +{ 4, s_4_4, -2, 1, 0}, +{ 6, s_4_5, -1, 33, 0}, +{ 4, s_4_6, -4, 1, 0}, +{ 8, s_4_7, -5, 1, 0}, +{ 6, s_4_8, -6, 1, 0}, +{ 6, s_4_9, -7, 1, 0}, +{ 8, s_4_10, -1, 1, 0}, +{ 6, s_4_11, 0, 1, 0}, +{ 8, s_4_12, -1, 1, 0}, +{ 6, s_4_13, 0, 1, 0}, +{ 4, s_4_14, 0, 1, 0}, +{ 4, s_4_15, 0, 1, 0}, +{ 8, s_4_16, -1, 3, 0}, +{ 10, s_4_17, -1, 4, 0}, +{ 2, s_4_18, 0, 1, 0}, +{ 10, s_4_19, -1, 14, 0}, +{ 8, s_4_20, -2, 15, 0}, +{ 10, s_4_21, -1, 12, 0}, +{ 10, s_4_22, -2, 7, 0}, +{ 8, s_4_23, -5, 27, 0}, +{ 10, s_4_24, -6, 17, 0}, +{ 10, s_4_25, -7, 22, 0}, +{ 12, s_4_26, -8, 25, 0}, +{ 12, s_4_27, -9, 24, 0}, +{ 8, s_4_28, -10, 26, 0}, +{ 10, s_4_29, -11, 20, 0}, +{ 8, s_4_30, -12, 11, 0}, +{ 4, s_4_31, -13, 4, 0}, +{ 10, s_4_32, -1, 9, 0}, +{ 10, s_4_33, -2, 13, 0}, +{ 10, s_4_34, -3, 8, 0}, +{ 10, s_4_35, -4, 19, 0}, +{ 6, s_4_36, -5, 1, 0}, +{ 8, s_4_37, -1, 1, 0}, +{ 6, s_4_38, -7, 1, 0}, +{ 10, s_4_39, -21, 10, 0}, +{ 10, s_4_40, -22, 18, 0}, +{ 10, s_4_41, -23, 16, 0}, +{ 4, s_4_42, -24, 1, 0}, +{ 12, s_4_43, -1, 5, 0}, +{ 8, s_4_44, -2, 1, 0}, +{ 10, s_4_45, -3, 6, 0}, +{ 10, s_4_46, -4, 1, 0}, +{ 12, s_4_47, -5, 29, 0}, +{ 12, s_4_48, -30, 23, 0}, +{ 14, s_4_49, -31, 28, 0}, +{ 10, s_4_50, -32, 30, 0}, +{ 10, s_4_51, -33, 21, 0}, +{ 6, s_4_52, -34, 5, 0}, +{ 2, s_4_53, 0, 1, 0}, +{ 4, s_4_54, -1, 4, 0}, +{ 6, s_4_55, -1, 1, 0}, +{ 4, s_4_56, -3, 1, 0}, +{ 6, s_4_57, -1, 4, 0}, +{ 6, s_4_58, -2, 3, 0}, +{ 4, s_4_59, -6, 1, 0}, +{ 6, s_4_60, -1, 2, 0}, +{ 8, s_4_61, -2, 1, 0}, +{ 6, s_4_62, -9, 1, 0}, +{ 10, s_4_63, -1, 1, 0}, +{ 2, s_4_64, 0, 1, 0}, +{ 4, s_4_65, -1, 4, 0}, +{ 6, s_4_66, -1, 1, 0}, +{ 6, s_4_67, -2, 1, 0}, +{ 4, s_4_68, -4, -1, 0}, +{ 6, s_4_69, -5, 1, 0}, +{ 6, s_4_70, -6, 3, 0}, +{ 8, s_4_71, -1, 4, 0}, +{ 4, s_4_72, 0, 1, 0}, +{ 6, s_4_73, -1, 4, 0}, +{ 8, s_4_74, -1, 1, 0}, +{ 8, s_4_75, -2, 1, 0}, +{ 8, s_4_76, -4, 3, 0}, +{ 10, s_4_77, -1, 4, 0}, +{ 4, s_4_78, 0, 32, 0} +}; + +static const symbol s_5_0[6] = { 0xD7, 0x95, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_5_1[8] = { 0xD7, 0xA9, 0xD7, 0x90, 0xD7, 0xA4, 0xD7, 0x98 }; +static const symbol s_5_2[6] = { 0xD7, 0x94, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_5_3[6] = { 0xD7, 0xA7, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_5_4[8] = { 0xD7, 0x99, 0xD7, 0xA7, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_5_5[2] = { 0xD7, 0x9C }; +static const struct among a_5[6] = { +{ 6, s_5_0, 0, 1, 0}, +{ 8, s_5_1, 0, 1, 0}, +{ 6, s_5_2, 0, 1, 0}, +{ 6, s_5_3, 0, 1, 0}, +{ 8, s_5_4, -1, 1, 0}, +{ 2, s_5_5, 0, 2, 0} +}; + +static const symbol s_6_0[4] = { 0xD7, 0x99, 0xD7, 0x92 }; +static const symbol s_6_1[4] = { 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_2[6] = { 0xD7, 0x93, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_3[8] = { 0xD7, 0xA0, 0xD7, 0x93, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_4[10] = { 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0x93, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_5[8] = { 0xD7, 0x91, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_6[8] = { 0xD7, 0x92, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_7[6] = { 0xD7, 0xA0, 0xD7, 0x99, 0xD7, 0xA7 }; +static const symbol s_6_8[4] = { 0xD7, 0x99, 0xD7, 0xA9 }; +static const struct among a_6[9] = { +{ 4, s_6_0, 0, 1, 0}, +{ 4, s_6_1, 0, 1, 0}, +{ 6, s_6_2, -1, 1, 0}, +{ 8, s_6_3, -1, 1, 0}, +{ 10, s_6_4, -1, 1, 0}, +{ 8, s_6_5, -4, -1, 0}, +{ 8, s_6_6, -5, -1, 0}, +{ 6, s_6_7, -6, 1, 0}, +{ 4, s_6_8, 0, 1, 0} +}; + +static const unsigned char g_niked[] = { 255, 155, 6 }; + +static const unsigned char g_vowel[] = { 33, 2, 4, 0, 6 }; + +static const unsigned char g_consonant[] = { 239, 254, 253, 131 }; + +static const symbol s_0[] = { 0xD6, 0xBC }; +static const symbol s_1[] = { 0xD7, 0xB0 }; +static const symbol s_2[] = { 0xD6, 0xB4 }; +static const symbol s_3[] = { 0xD7, 0xB1 }; +static const symbol s_4[] = { 0xD6, 0xB4 }; +static const symbol s_5[] = { 0xD7, 0xB2 }; +static const symbol s_6[] = { 0xD7, 0x9B }; +static const symbol s_7[] = { 0xD7, 0x9E }; +static const symbol s_8[] = { 0xD7, 0xA0 }; +static const symbol s_9[] = { 0xD7, 0xA4 }; +static const symbol s_10[] = { 0xD7, 0xA6 }; +static const symbol s_11[] = { 0xD7, 0x92, 0xD7, 0xA2 }; +static const symbol s_12[] = { 0xD7, 0x9C, 0xD7, 0x98 }; +static const symbol s_13[] = { 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_14[] = { 'G', 'E' }; +static const symbol s_15[] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0x92, 0xD7, 0xA0 }; +static const symbol s_16[] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0xA7, 0xD7, 0x98 }; +static const symbol s_17[] = { 0xD7, 0xA6, 0xD7, 0x95, 0xD7, 0xA7, 0xD7, 0xA0 }; +static const symbol s_18[] = { 0xD7, 0x92, 0xD7, 0xA2, 0xD7, 0x91, 0xD7, 0xA0 }; +static const symbol s_19[] = { 0xD7, 0x92, 0xD7, 0xA2 }; +static const symbol s_20[] = { 'G', 'E' }; +static const symbol s_21[] = { 0xD7, 0xA6, 0xD7, 0x95 }; +static const symbol s_22[] = { 'T', 'S', 'U' }; +static const symbol s_23[] = { 0xD7, 0x99, 0xD7, 0xA2 }; +static const symbol s_24[] = { 0xD7, 0x92, 0xD7, 0xB2 }; +static const symbol s_25[] = { 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0x9E }; +static const symbol s_26[] = { 0xD7, 0x9E, 0xD7, 0xB2, 0xD7, 0x93 }; +static const symbol s_27[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_28[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_29[] = { 0xD7, 0xB0, 0xD7, 0xB2, 0xD7, 0x96 }; +static const symbol s_30[] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_31[] = { 0xD7, 0x9C, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_32[] = { 0xD7, 0xA7, 0xD7, 0x9C, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_33[] = { 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_34[] = { 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_35[] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xB2, 0xD7, 0x92 }; +static const symbol s_36[] = { 0xD7, 0xA9, 0xD7, 0x9E, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_37[] = { 0xD7, 0xA9, 0xD7, 0xA0, 0xD7, 0xB2, 0xD7, 0x93 }; +static const symbol s_38[] = { 0xD7, 0xA9, 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_39[] = { 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x93 }; +static const symbol s_40[] = { 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA9 }; +static const symbol s_41[] = { 0xD7, 0x96, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_42[] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0xA7 }; +static const symbol s_43[] = { 0xD7, 0xA6, 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_44[] = { 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_45[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0x92 }; +static const symbol s_46[] = { 0xD7, 0x94, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_47[] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA8 }; +static const symbol s_48[] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0xB2 }; +static const symbol s_49[] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_50[] = { 0xD7, 0x98 }; +static const symbol s_51[] = { 0xD7, 0x91, 0xD7, 0xA8, 0xD7, 0x90, 0xD7, 0x9B }; +static const symbol s_52[] = { 0xD7, 0x92, 0xD7, 0xA2 }; +static const symbol s_53[] = { 0xD7, 0x91, 0xD7, 0xA8, 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_54[] = { 0xD7, 0x92, 0xD7, 0xB2 }; +static const symbol s_55[] = { 0xD7, 0xA0, 0xD7, 0xA2, 0xD7, 0x9E }; +static const symbol s_56[] = { 0xD7, 0xA9, 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_57[] = { 0xD7, 0x9E, 0xD7, 0xB2, 0xD7, 0x93 }; +static const symbol s_58[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_59[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_60[] = { 0xD7, 0xB0, 0xD7, 0xB2, 0xD7, 0x96 }; +static const symbol s_61[] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_62[] = { 0xD7, 0x9C, 0xD7, 0xB2, 0xD7, 0x98 }; +static const symbol s_63[] = { 0xD7, 0xA7, 0xD7, 0x9C, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_64[] = { 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_65[] = { 0xD7, 0xA8, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_66[] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xB2, 0xD7, 0x92 }; +static const symbol s_67[] = { 0xD7, 0xA9, 0xD7, 0x9E, 0xD7, 0xB2, 0xD7, 0xA1 }; +static const symbol s_68[] = { 0xD7, 0xA9, 0xD7, 0xA0, 0xD7, 0xB2, 0xD7, 0x93 }; +static const symbol s_69[] = { 0xD7, 0x91, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x93 }; +static const symbol s_70[] = { 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0x98, 0xD7, 0xA9 }; +static const symbol s_71[] = { 0xD7, 0x96, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_72[] = { 0xD7, 0x98, 0xD7, 0xA8, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0xA7 }; +static const symbol s_73[] = { 0xD7, 0xA6, 0xD7, 0xB0, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_74[] = { 0xD7, 0xA9, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_75[] = { 0xD7, 0x91, 0xD7, 0xB2, 0xD7, 0x92 }; +static const symbol s_76[] = { 0xD7, 0x94, 0xD7, 0xB2, 0xD7, 0x91 }; +static const symbol s_77[] = { 0xD7, 0xA4, 0xD7, 0x90, 0xD7, 0xA8, 0xD7, 0x9C, 0xD7, 0x99, 0xD7, 0xA8 }; +static const symbol s_78[] = { 0xD7, 0xA9, 0xD7, 0x98, 0xD7, 0xB2 }; +static const symbol s_79[] = { 0xD7, 0xA9, 0xD7, 0xB0, 0xD7, 0xA2, 0xD7, 0xA8 }; +static const symbol s_80[] = { 0xD7, 0x91, 0xD7, 0xA8, 0xD7, 0xA2, 0xD7, 0xA0, 0xD7, 0x92 }; +static const symbol s_81[] = { 0xD7, 0x94 }; +static const symbol s_82[] = { 0xD7, 0x92 }; +static const symbol s_83[] = { 0xD7, 0xA9 }; +static const symbol s_84[] = { 0xD7, 0x99, 0xD7, 0xA1 }; +static const symbol s_85[] = { 'G', 'E' }; +static const symbol s_86[] = { 'T', 'S', 'U' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { + int v_1 = z->c; + while (1) { + int v_2 = z->c; + while (1) { + int v_3 = z->c; + z->bra = z->c; + among_var = find_among(z, a_0, 8); + if (!among_var) goto lab2; + z->ket = z->c; + switch (among_var) { + case 1: + { + int v_4 = z->c; + if (!(eq_s(z, 2, s_0))) goto lab3; + goto lab2; + lab3: + z->c = v_4; + } + { + int ret = slice_from_s(z, 2, s_1); + if (ret < 0) return ret; + } + break; + case 2: + { + int v_5 = z->c; + if (!(eq_s(z, 2, s_2))) goto lab4; + goto lab2; + lab4: + z->c = v_5; + } + { + int ret = slice_from_s(z, 2, s_3); + if (ret < 0) return ret; + } + break; + case 3: + { + int v_6 = z->c; + if (!(eq_s(z, 2, s_4))) goto lab5; + goto lab2; + lab5: + z->c = v_6; + } + { + int ret = slice_from_s(z, 2, s_5); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 2, s_6); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 2, s_7); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 2, s_8); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 2, s_9); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 2, s_10); + if (ret < 0) return ret; + } + break; + } + z->c = v_3; + break; + lab2: + z->c = v_3; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab1; + z->c = ret; + } + } + continue; + lab1: + z->c = v_2; + break; + } + z->c = v_1; + } + { + int v_7 = z->c; + while (1) { + int v_8 = z->c; + while (1) { + int v_9 = z->c; + z->bra = z->c; + if (in_grouping_U(z, g_niked, 1456, 1474, 0)) goto lab8; + z->ket = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->c = v_9; + break; + lab8: + z->c = v_9; + { + int ret = skip_utf8(z->p, z->c, z->l, 1); + if (ret < 0) goto lab7; + z->c = ret; + } + } + continue; + lab7: + z->c = v_8; + break; + } + z->c = v_7; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[1] = z->l; + { + int v_1 = z->c; + z->bra = z->c; + if (!(eq_s(z, 4, s_11))) { z->c = v_1; goto lab0; } + z->ket = z->c; + { + int v_2 = z->c; + { + int v_3 = z->c; + if (!(eq_s(z, 4, s_12))) goto lab3; + goto lab2; + lab3: + z->c = v_3; + if (!(eq_s(z, 4, s_13))) goto lab4; + goto lab2; + lab4: + z->c = v_3; + if (z->c < z->l) goto lab1; + } + lab2: + { z->c = v_1; goto lab0; } + lab1: + z->c = v_2; + } + { + int ret = slice_from_s(z, 2, s_14); + if (ret < 0) return ret; + } + lab0: + ; + } + { + int v_4 = z->c; + if (!find_among(z, a_1, 40)) { z->c = v_4; goto lab5; } + { + int v_5 = z->c; + { + int v_6 = z->c; + { + int v_7 = z->c; + if (!(eq_s(z, 8, s_15))) goto lab9; + goto lab8; + lab9: + z->c = v_7; + if (!(eq_s(z, 8, s_16))) goto lab10; + goto lab8; + lab10: + z->c = v_7; + if (!(eq_s(z, 8, s_17))) goto lab7; + } + lab8: + if (z->c < z->l) goto lab7; + z->c = v_6; + } + goto lab6; + lab7: + z->c = v_5; + { + int v_8 = z->c; + if (!(eq_s(z, 8, s_18))) goto lab11; + z->c = v_8; + } + goto lab6; + lab11: + z->c = v_5; + z->bra = z->c; + if (!(eq_s(z, 4, s_19))) goto lab12; + z->ket = z->c; + { + int ret = slice_from_s(z, 2, s_20); + if (ret < 0) return ret; + } + goto lab6; + lab12: + z->c = v_5; + z->bra = z->c; + if (!(eq_s(z, 4, s_21))) { z->c = v_4; goto lab5; } + z->ket = z->c; + { + int ret = slice_from_s(z, 3, s_22); + if (ret < 0) return ret; + } + } + lab6: + lab5: + ; + } + { + int v_9 = z->c; + { + int ret = skip_utf8(z->p, z->c, z->l, 3); + if (ret < 0) return 0; + z->c = ret; + } + z->I[0] = z->c; + z->c = v_9; + } + { + int v_10 = z->c; + if (z->c + 5 >= z->l || (z->p[z->c + 5] != 169 && z->p[z->c + 5] != 168)) { z->c = v_10; goto lab13; } + if (!find_among(z, a_2, 4)) { z->c = v_10; goto lab13; } + lab13: + ; + } + { + int v_11 = z->c; + if (in_grouping_U(z, g_consonant, 1489, 1520, 0)) goto lab14; + if (in_grouping_U(z, g_consonant, 1489, 1520, 0)) goto lab14; + if (in_grouping_U(z, g_consonant, 1489, 1520, 0)) goto lab14; + z->I[1] = z->c; + return 0; + lab14: + z->c = v_11; + } + { + int ret = out_grouping_U(z, g_vowel, 1488, 1522, 1); + if (ret < 0) return 0; + z->c += ret; + } + if (in_grouping_U(z, g_vowel, 1488, 1522, 1) < 0) return 0; + z->I[1] = z->c; + if (z->I[1] >= z->I[0]) goto lab15; + z->I[1] = z->I[0]; +lab15: + return 1; +} + +static int r_R1(struct SN_env * z) { + return z->I[1] <= z->c; +} + +static int r_R1plus3(struct SN_env * z) { + return z->I[1] <= (z->c + 6); +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { + int v_1 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_4, 79); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_23); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->ket = z->c; + among_var = find_among_b(z, a_3, 26); + if (!among_var) goto lab0; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = slice_from_s(z, 4, s_24); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = slice_from_s(z, 6, s_25); + if (ret < 0) return ret; + } + break; + case 3: + { + int ret = slice_from_s(z, 6, s_26); + if (ret < 0) return ret; + } + break; + case 4: + { + int ret = slice_from_s(z, 6, s_27); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 6, s_28); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_29); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 8, s_30); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 6, s_31); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 8, s_32); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 6, s_33); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 6, s_34); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 8, s_35); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 8, s_36); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 8, s_37); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 8, s_38); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 8, s_39); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 8, s_40); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 8, s_41); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 10, s_42); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 10, s_43); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 10, s_44); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 6, s_45); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 6, s_46); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 12, s_47); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 6, s_48); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 8, s_49); + if (ret < 0) return ret; + } + break; + } + break; + case 4: + { + int v_2 = z->l - z->c; + { + int ret = r_R1(z); + if (ret == 0) goto lab2; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - v_2; + { + int ret = slice_from_s(z, 2, s_50); + if (ret < 0) return ret; + } + } + lab1: + z->ket = z->c; + if (!(eq_s_b(z, 8, s_51))) goto lab0; + { + int v_3 = z->l - z->c; + if (!(eq_s_b(z, 4, s_52))) { z->c = z->l - v_3; goto lab3; } + lab3: + ; + } + z->bra = z->c; + { + int ret = slice_from_s(z, 10, s_53); + if (ret < 0) return ret; + } + break; + case 5: + { + int ret = slice_from_s(z, 4, s_54); + if (ret < 0) return ret; + } + break; + case 6: + { + int ret = slice_from_s(z, 6, s_55); + if (ret < 0) return ret; + } + break; + case 7: + { + int ret = slice_from_s(z, 8, s_56); + if (ret < 0) return ret; + } + break; + case 8: + { + int ret = slice_from_s(z, 6, s_57); + if (ret < 0) return ret; + } + break; + case 9: + { + int ret = slice_from_s(z, 6, s_58); + if (ret < 0) return ret; + } + break; + case 10: + { + int ret = slice_from_s(z, 6, s_59); + if (ret < 0) return ret; + } + break; + case 11: + { + int ret = slice_from_s(z, 6, s_60); + if (ret < 0) return ret; + } + break; + case 12: + { + int ret = slice_from_s(z, 8, s_61); + if (ret < 0) return ret; + } + break; + case 13: + { + int ret = slice_from_s(z, 6, s_62); + if (ret < 0) return ret; + } + break; + case 14: + { + int ret = slice_from_s(z, 8, s_63); + if (ret < 0) return ret; + } + break; + case 15: + { + int ret = slice_from_s(z, 6, s_64); + if (ret < 0) return ret; + } + break; + case 16: + { + int ret = slice_from_s(z, 6, s_65); + if (ret < 0) return ret; + } + break; + case 17: + { + int ret = slice_from_s(z, 8, s_66); + if (ret < 0) return ret; + } + break; + case 18: + { + int ret = slice_from_s(z, 8, s_67); + if (ret < 0) return ret; + } + break; + case 19: + { + int ret = slice_from_s(z, 8, s_68); + if (ret < 0) return ret; + } + break; + case 20: + { + int ret = slice_from_s(z, 8, s_69); + if (ret < 0) return ret; + } + break; + case 21: + { + int ret = slice_from_s(z, 8, s_70); + if (ret < 0) return ret; + } + break; + case 22: + { + int ret = slice_from_s(z, 8, s_71); + if (ret < 0) return ret; + } + break; + case 23: + { + int ret = slice_from_s(z, 10, s_72); + if (ret < 0) return ret; + } + break; + case 24: + { + int ret = slice_from_s(z, 10, s_73); + if (ret < 0) return ret; + } + break; + case 25: + { + int ret = slice_from_s(z, 10, s_74); + if (ret < 0) return ret; + } + break; + case 26: + { + int ret = slice_from_s(z, 6, s_75); + if (ret < 0) return ret; + } + break; + case 27: + { + int ret = slice_from_s(z, 6, s_76); + if (ret < 0) return ret; + } + break; + case 28: + { + int ret = slice_from_s(z, 12, s_77); + if (ret < 0) return ret; + } + break; + case 29: + { + int ret = slice_from_s(z, 6, s_78); + if (ret < 0) return ret; + } + break; + case 30: + { + int ret = slice_from_s(z, 8, s_79); + if (ret < 0) return ret; + } + break; + case 31: + { + int ret = slice_from_s(z, 10, s_80); + if (ret < 0) return ret; + } + break; + case 32: + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 2, s_81); + if (ret < 0) return ret; + } + break; + case 33: + { + int v_4 = z->l - z->c; + { + int v_5 = z->l - z->c; + if (!(eq_s_b(z, 2, s_82))) goto lab7; + goto lab6; + lab7: + z->c = z->l - v_5; + if (!(eq_s_b(z, 2, s_83))) goto lab5; + } + lab6: + { + int v_6 = z->l - z->c; + { + int ret = r_R1plus3(z); + if (ret == 0) { z->c = z->l - v_6; goto lab8; } + if (ret < 0) return ret; + } + { + int ret = slice_from_s(z, 4, s_84); + if (ret < 0) return ret; + } + lab8: + ; + } + goto lab4; + lab5: + z->c = z->l - v_4; + { + int ret = r_R1(z); + if (ret == 0) goto lab0; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + } + lab4: + break; + } + lab0: + z->c = z->l - v_1; + } + { + int v_7 = z->l - z->c; + z->ket = z->c; + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 4 || !((285474816 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab9; + among_var = find_among_b(z, a_5, 6); + if (!among_var) goto lab9; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + case 2: + { + int ret = r_R1(z); + if (ret == 0) goto lab9; + if (ret < 0) return ret; + } + if (in_grouping_b_U(z, g_consonant, 1489, 1520, 0)) goto lab9; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab9: + z->c = z->l - v_7; + } + { + int v_8 = z->l - z->c; + z->ket = z->c; + among_var = find_among_b(z, a_6, 9); + if (!among_var) goto lab10; + z->bra = z->c; + switch (among_var) { + case 1: + { + int ret = r_R1(z); + if (ret == 0) goto lab10; + if (ret < 0) return ret; + } + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + break; + } + lab10: + z->c = z->l - v_8; + } + { + int v_9 = z->l - z->c; + while (1) { + int v_10 = z->l - z->c; + while (1) { + int v_11 = z->l - z->c; + z->ket = z->c; + { + int v_12 = z->l - z->c; + if (!(eq_s_b(z, 2, s_85))) goto lab15; + goto lab14; + lab15: + z->c = z->l - v_12; + if (!(eq_s_b(z, 3, s_86))) goto lab13; + } + lab14: + z->bra = z->c; + { + int ret = slice_del(z); + if (ret < 0) return ret; + } + z->c = z->l - v_11; + break; + lab13: + z->c = z->l - v_11; + { + int ret = skip_b_utf8(z->p, z->c, z->lb, 1); + if (ret < 0) goto lab12; + z->c = ret; + } + } + continue; + lab12: + z->c = z->l - v_10; + break; + } + z->c = z->l - v_9; + } + return 1; +} + +extern int yiddish_UTF_8_stem(struct SN_env * z) { + { + int ret = r_prelude(z); + if (ret < 0) return ret; + } + { + int v_1 = z->c; + { + int ret = r_mark_regions(z); + if (ret < 0) return ret; + } + z->c = v_1; + } + z->lb = z->c; z->c = z->l; + { + int ret = r_standard_suffix(z); + if (ret < 0) return ret; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * yiddish_UTF_8_create_env(void) { return SN_create_env(0, 2); } + +extern void yiddish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.h b/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.h new file mode 100644 index 000000000000..941ba84d0b81 --- /dev/null +++ b/contrib/libs/snowball/src_c/stem_UTF_8_yiddish.h @@ -0,0 +1,15 @@ +/* Generated from yiddish.sbl by Snowball 3.0.1 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * yiddish_UTF_8_create_env(void); +extern void yiddish_UTF_8_close_env(struct SN_env * z); + +extern int yiddish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libs/snowball/ya.make b/contrib/libs/snowball/ya.make new file mode 100644 index 000000000000..cf4bb70118cb --- /dev/null +++ b/contrib/libs/snowball/ya.make @@ -0,0 +1,23 @@ +# Generated by devtools/yamaker/ym2 + +LIBRARY() + +LICENSE(BSD-3-Clause) + +LICENSE_TEXTS(.yandex_meta/licenses.list.txt) + +VERSION(3.0.1) + +ORIGINAL_SOURCE(https://snowballstem.org/dist/libstemmer_c-3.0.1.tar.gz) + +NO_COMPILER_WARNINGS() + +NO_RUNTIME() + +ADDINCL( + GLOBAL contrib/libs/snowball +) + +INCLUDE(ya.make.inc) + +END() diff --git a/contrib/libs/snowball/ya.make.inc b/contrib/libs/snowball/ya.make.inc new file mode 100644 index 000000000000..1c9ee4905c97 --- /dev/null +++ b/contrib/libs/snowball/ya.make.inc @@ -0,0 +1,56 @@ +SRCS( +src_c/stem_UTF_8_arabic.c +src_c/stem_UTF_8_armenian.c +src_c/stem_ISO_8859_1_basque.c +src_c/stem_UTF_8_basque.c +src_c/stem_ISO_8859_1_catalan.c +src_c/stem_UTF_8_catalan.c +src_c/stem_ISO_8859_1_danish.c +src_c/stem_UTF_8_danish.c +src_c/stem_ISO_8859_1_dutch.c +src_c/stem_UTF_8_dutch.c +src_c/stem_ISO_8859_1_dutch_porter.c +src_c/stem_UTF_8_dutch_porter.c +src_c/stem_ISO_8859_1_english.c +src_c/stem_UTF_8_english.c +src_c/stem_UTF_8_esperanto.c +src_c/stem_UTF_8_estonian.c +src_c/stem_ISO_8859_1_finnish.c +src_c/stem_UTF_8_finnish.c +src_c/stem_ISO_8859_1_french.c +src_c/stem_UTF_8_french.c +src_c/stem_ISO_8859_1_german.c +src_c/stem_UTF_8_german.c +src_c/stem_UTF_8_greek.c +src_c/stem_UTF_8_hindi.c +src_c/stem_ISO_8859_2_hungarian.c +src_c/stem_UTF_8_hungarian.c +src_c/stem_ISO_8859_1_indonesian.c +src_c/stem_UTF_8_indonesian.c +src_c/stem_ISO_8859_1_irish.c +src_c/stem_UTF_8_irish.c +src_c/stem_ISO_8859_1_italian.c +src_c/stem_UTF_8_italian.c +src_c/stem_UTF_8_lithuanian.c +src_c/stem_UTF_8_nepali.c +src_c/stem_ISO_8859_1_norwegian.c +src_c/stem_UTF_8_norwegian.c +src_c/stem_ISO_8859_1_porter.c +src_c/stem_UTF_8_porter.c +src_c/stem_ISO_8859_1_portuguese.c +src_c/stem_UTF_8_portuguese.c +src_c/stem_UTF_8_romanian.c +src_c/stem_KOI8_R_russian.c +src_c/stem_UTF_8_russian.c +src_c/stem_UTF_8_serbian.c +src_c/stem_ISO_8859_1_spanish.c +src_c/stem_UTF_8_spanish.c +src_c/stem_ISO_8859_1_swedish.c +src_c/stem_UTF_8_swedish.c +src_c/stem_UTF_8_tamil.c +src_c/stem_UTF_8_turkish.c +src_c/stem_UTF_8_yiddish.c +runtime/api.c +runtime/utilities.c +libstemmer/libstemmer.c +) From 5700ad652966da6232d9553b52ea9591443ffafa Mon Sep 17 00:00:00 2001 From: alexpaniman Date: Wed, 12 Nov 2025 08:47:47 +0000 Subject: [PATCH 17/17] Add CBO parameter to force Shuffle Elimination --- ydb/core/kqp/opt/logical/kqp_opt_log.cpp | 8 +++++-- ydb/core/kqp/provider/yql_kikimr_settings.cpp | 1 + ydb/core/kqp/provider/yql_kikimr_settings.h | 1 + .../yql/dq/opt/dq_opt_join_cbo_factory.cpp | 4 ++-- .../yql/dq/opt/dq_opt_join_cost_based.cpp | 14 +++++------ .../yql/dq/opt/dq_opt_join_cost_based.h | 2 +- ydb/library/yql/dq/opt/ut/dq_cbo_ut.cpp | 23 ++++++++++++++----- .../yql/dq/opt/ut/dq_opt_hypergraph_ut.cpp | 4 +++- .../yql/providers/dq/common/yql_dq_settings.h | 1 + 9 files changed, 39 insertions(+), 19 deletions(-) diff --git a/ydb/core/kqp/opt/logical/kqp_opt_log.cpp b/ydb/core/kqp/opt/logical/kqp_opt_log.cpp index 22fb922a0dcd..a27d5fa12906 100644 --- a/ydb/core/kqp/opt/logical/kqp_opt_log.cpp +++ b/ydb/core/kqp/opt/logical/kqp_opt_log.cpp @@ -175,13 +175,17 @@ class TKqpLogicalOptTransformer : public TOptimizeTransformerBase { } TMaybeNode OptimizeEquiJoinWithCosts(TExprBase node, TExprContext& ctx) { - auto maxDPhypDPTableSize = Config->MaxDPHypDPTableSize.Get().GetOrElse(TDqSettings::TDefault::MaxDPHypDPTableSize); + TCBOSettings settings { + .MaxDPhypDPTableSize = Config->MaxDPHypDPTableSize.Get().GetOrElse(TDqSettings::TDefault::MaxDPHypDPTableSize), + .ForceShuffleElimination = Config->ForceShuffleElimination.Get().GetOrElse(TDqSettings::TDefault::ForceShuffleElimination) + }; + auto optLevel = Config->CostBasedOptimizationLevel.Get().GetOrElse(Config->DefaultCostBasedOptimizationLevel); bool enableShuffleElimination = KqpCtx.Config->OptShuffleElimination.Get().GetOrElse(KqpCtx.Config->DefaultEnableShuffleElimination); auto providerCtx = TKqpProviderContext(KqpCtx, optLevel); auto stats = TypesCtx.GetStats(node.Raw()); TTableAliasMap* tableAliases = stats? stats->TableAliases.Get(): nullptr; - auto opt = std::unique_ptr(MakeNativeOptimizerNew(providerCtx, maxDPhypDPTableSize, ctx, enableShuffleElimination, TypesCtx.OrderingsFSM, tableAliases)); + auto opt = std::unique_ptr(MakeNativeOptimizerNew(providerCtx, settings, ctx, enableShuffleElimination, TypesCtx.OrderingsFSM, tableAliases)); TExprBase output = DqOptimizeEquiJoinWithCosts(node, ctx, TypesCtx, optLevel, *opt, [](auto& rels, auto label, auto node, auto stat) { rels.emplace_back(std::make_shared(TString(label), *stat, node)); diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.cpp b/ydb/core/kqp/provider/yql_kikimr_settings.cpp index 7f98090f2750..620beb2939c5 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_settings.cpp @@ -124,6 +124,7 @@ TKikimrConfiguration::TKikimrConfiguration() { REGISTER_SETTING(*this, UseBlockReader); REGISTER_SETTING(*this, MaxDPHypDPTableSize); + REGISTER_SETTING(*this, ForceShuffleElimination); REGISTER_SETTING(*this, MaxTasksPerStage); REGISTER_SETTING(*this, DataSizePerPartition); diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h index e622adcfd8ff..002337d55964 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.h +++ b/ydb/core/kqp/provider/yql_kikimr_settings.h @@ -92,6 +92,7 @@ struct TKikimrSettings { NCommon::TConfSetting ColumnShardHashShuffleFuncType; NCommon::TConfSetting MaxDPHypDPTableSize; + NCommon::TConfSetting ForceShuffleElimination; NCommon::TConfSetting MaxTasksPerStage; NCommon::TConfSetting DataSizePerPartition; diff --git a/ydb/library/yql/dq/opt/dq_opt_join_cbo_factory.cpp b/ydb/library/yql/dq/opt/dq_opt_join_cbo_factory.cpp index 83608fddbc4c..46f6bba25420 100644 --- a/ydb/library/yql/dq/opt/dq_opt_join_cbo_factory.cpp +++ b/ydb/library/yql/dq/opt/dq_opt_join_cbo_factory.cpp @@ -9,8 +9,8 @@ namespace NYql::NDq { namespace { class TDqOptimizerFactory : public IOptimizerFactory { public: - virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ectx, const TNativeSettings& settings) const override { - return IOptimizerNew::TPtr(MakeNativeOptimizerNew(pctx, settings.MaxDPhypDPTableSize, ectx, false, nullptr)); + virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerNative(IProviderContext& pctx, TExprContext& ectx, const TCBOSettings& settings) const override { + return IOptimizerNew::TPtr(MakeNativeOptimizerNew(pctx, settings, ectx, false, nullptr)); } virtual IOptimizerNew::TPtr MakeJoinCostBasedOptimizerPG(IProviderContext& pctx, TExprContext& ctx, const TPGSettings& settings) const override { diff --git a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp index 6588d89eb856..f97b47b3c638 100644 --- a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp +++ b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp @@ -314,14 +314,14 @@ class TOptimizerNativeNew: public IOptimizerNew { public: TOptimizerNativeNew( IProviderContext& ctx, - ui32 maxDPhypDPTableSize, + const TCBOSettings &optimizerSettings, TExprContext& exprCtx, bool enableShuffleElimination, TSimpleSharedPtr orderingsFSM, TTableAliasMap* tableAliases ) : IOptimizerNew(ctx) - , MaxDPHypTableSize_(maxDPhypDPTableSize) + , OptimizerSettings_(optimizerSettings) , ExprCtx(exprCtx) , EnableShuffleElimination(enableShuffleElimination && orderingsFSM != nullptr) , OrderingsFSM(orderingsFSM) @@ -334,7 +334,7 @@ class TOptimizerNativeNew: public IOptimizerNew { ) override { auto relsCount = joinTree->Labels().size(); - if (EnableShuffleElimination && relsCount <= 14) { + if (EnableShuffleElimination && (relsCount <= 14 || OptimizerSettings_.ForceShuffleElimination)) { return JoinSearchImpl>(joinTree, false, hints); } else if (relsCount <= 64) { // The algorithm is more efficient. return JoinSearchImpl>(joinTree, EnableShuffleElimination, hints); @@ -382,7 +382,7 @@ class TOptimizerNativeNew: public IOptimizerNew { TJoinHypergraph hypergraph = MakeJoinHypergraph(joinTree, hints); TDPHypImpl solver = GetDPHypImpl(hypergraph); YQL_CLOG(TRACE, CoreDq) << "Enumeration algorithm chosen: " << solver.Type(); - if (solver.CountCC(MaxDPHypTableSize_) >= MaxDPHypTableSize_) { + if (solver.CountCC(OptimizerSettings_.MaxDPhypDPTableSize) >= OptimizerSettings_.MaxDPhypDPTableSize) { YQL_CLOG(TRACE, CoreDq) << "Maximum DPhyp threshold exceeded"; ExprCtx.AddWarning( YqlIssue( @@ -506,7 +506,7 @@ class TOptimizerNativeNew: public IOptimizerNew { } private: - ui32 MaxDPHypTableSize_; + TCBOSettings OptimizerSettings_; TExprContext& ExprCtx; bool EnableShuffleElimination; @@ -516,13 +516,13 @@ class TOptimizerNativeNew: public IOptimizerNew { IOptimizerNew* MakeNativeOptimizerNew( IProviderContext& pctx, - const ui32 maxDPhypDPTableSize, + const TCBOSettings &settings, TExprContext& ectx, bool enableShuffleElimination, TSimpleSharedPtr orderingsFSM, TTableAliasMap* tableAliases ) { - return new TOptimizerNativeNew(pctx, maxDPhypDPTableSize, ectx, enableShuffleElimination, orderingsFSM, tableAliases); + return new TOptimizerNativeNew(pctx, settings, ectx, enableShuffleElimination, orderingsFSM, tableAliases); } void CollectInterestingOrderingsFromJoinTree( diff --git a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.h b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.h index 1c386af4362f..9ba43bceee26 100644 --- a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.h +++ b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.h @@ -50,7 +50,7 @@ void CollectInterestingOrderingsFromJoinTree( IOptimizerNew* MakeNativeOptimizerNew( IProviderContext& ctx, - const ui32 maxDPHypDPTableSize, + const TCBOSettings &settings, TExprContext& ectx, bool enableShuffleElimination, TSimpleSharedPtr orderingsFSM = nullptr, diff --git a/ydb/library/yql/dq/opt/ut/dq_cbo_ut.cpp b/ydb/library/yql/dq/opt/ut/dq_cbo_ut.cpp index f5628a8b0d1d..6b08d5e9cc24 100644 --- a/ydb/library/yql/dq/opt/ut/dq_cbo_ut.cpp +++ b/ydb/library/yql/dq/opt/ut/dq_cbo_ut.cpp @@ -34,13 +34,17 @@ Y_UNIT_TEST_SUITE(DQCBO) { Y_UNIT_TEST(Empty) { TBaseProviderContext pctx; TExprContext dummyCtx; - std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, 100000, dummyCtx, false)); + + TCBOSettings settings{}; + std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, settings, dummyCtx, false)); } Y_UNIT_TEST(JoinSearch2Rels) { TBaseProviderContext pctx; TExprContext dummyCtx; - std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, 100000, dummyCtx, false)); + + TCBOSettings settings{}; + std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, settings, dummyCtx, false)); auto rel1 = std::make_shared( "a", @@ -74,7 +78,9 @@ Y_UNIT_TEST(JoinSearch2Rels) { Y_UNIT_TEST(JoinSearch3Rels) { TBaseProviderContext pctx; TExprContext dummyCtx; - std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, 100000, dummyCtx, false)); + + TCBOSettings settings{}; + std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, settings, dummyCtx, false)); auto rel1 = std::make_shared("a", TOptimizerStatistics(BaseTable, 100000, 1, 0, 1000000)); @@ -121,7 +127,9 @@ Y_UNIT_TEST(JoinSearchYQL19363) { // Verify that JoinSearch() correctly handles dot and comma characters. TBaseProviderContext pctx; TExprContext dummyCtx; - std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, 100000, dummyCtx, false)); + + TCBOSettings settings{}; + std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, settings, dummyCtx, false)); TString relName1 = "a,b.c"; TString colName1 = "a.x"; @@ -228,7 +236,9 @@ struct TMockProviderContextYT24403 : public TBaseProviderContext { Y_UNIT_TEST(JoinSearchYT24403) { TMockProviderContextYT24403 pctx; TExprContext dummyCtx; - std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, 100000, dummyCtx, false)); + + TCBOSettings settings{}; + std::unique_ptr optimizer = std::unique_ptr(MakeNativeOptimizerNew(pctx, settings, dummyCtx, false)); const TString relName1 = "a"; const TString relName2 = "b"; @@ -368,7 +378,8 @@ Y_UNIT_TEST(DqOptimizeEquiJoinWithCostsNative) { TExprContext ctx; TBaseProviderContext pctx; std::function optFactory = [&]() { - return MakeNativeOptimizerNew(pctx, 100000, ctx, false); + TCBOSettings settings{}; + return MakeNativeOptimizerNew(pctx, settings, ctx, false); }; _DqOptimizeEquiJoinWithCosts(optFactory, ctx); } diff --git a/ydb/library/yql/dq/opt/ut/dq_opt_hypergraph_ut.cpp b/ydb/library/yql/dq/opt/ut/dq_opt_hypergraph_ut.cpp index 5b1176aaa5e9..1c1795fd0fb6 100644 --- a/ydb/library/yql/dq/opt/ut/dq_opt_hypergraph_ut.cpp +++ b/ydb/library/yql/dq/opt/ut/dq_opt_hypergraph_ut.cpp @@ -52,8 +52,10 @@ template std::shared_ptr Enumerate(const std::shared_ptr& root, const TOptimizerHints& hints = {}) { auto ctx = TProviderContext(); TExprContext dummyCtx; + + TCBOSettings settings{}; auto optimizer = - std::unique_ptr(MakeNativeOptimizerNew(ctx, std::numeric_limits::max(), dummyCtx, false)); + std::unique_ptr(MakeNativeOptimizerNew(ctx, settings, dummyCtx, false)); Y_ENSURE(root->Kind == EOptimizerNodeKind::JoinNodeType); auto res = optimizer->JoinSearch(std::static_pointer_cast(root), hints); diff --git a/ydb/library/yql/providers/dq/common/yql_dq_settings.h b/ydb/library/yql/providers/dq/common/yql_dq_settings.h index 4919fcbe905d..c56b1379187a 100644 --- a/ydb/library/yql/providers/dq/common/yql_dq_settings.h +++ b/ydb/library/yql/providers/dq/common/yql_dq_settings.h @@ -64,6 +64,7 @@ struct TDqSettings { static constexpr ESpillingEngine SpillingEngine = ESpillingEngine::Disable; static constexpr ui32 CostBasedOptimizationLevel = 4; static constexpr ui32 MaxDPHypDPTableSize = 95'000U; + static constexpr bool ForceShuffleElimination = false; static constexpr ui64 MaxAttachmentsSize = 2_GB; static constexpr bool SplitStageOnDqReplicate = true; static constexpr ui64 EnableSpillingNodes = 0;