/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/uri/encodefsm.rl6
51 строка
930 B
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#include <library/cpp/uri/encode.h> #ifdef __clang__ #pragma clang diagnostic ignored "-Wunused-variable" #endif namespace NUri { namespace NEncode { %%{ machine TEncoder; hex = ( digit >{ HexDigit(fc); } | [A-F] >{ HexUpper(fc); } | [a-f] >{ HexLower(fc); } ); escaped = ( "%" hex hex ) > { HexReset(); } % { DoHex(); }; bad_escaped = ( "%" hex ) % { DoSym(*(fpc - 2)); DoSym(*(fpc - 1)); }; sym = (any - bad_escaped - escaped) %{ DoSym(*(fpc - 1)); }; main := ( escaped | bad_escaped | sym )**; write data; }%% ui64 TEncoder::ReEncode(const TStringBuf &url) { const char *p = url.data(); const char *pe = p + url.length(); const char *eof = pe; int cs; OutFlags = 0; %% write init; %% write exec; return OutFlags; } } }