|
Ada 4.1.1
Fast spec-compliant URL parser
|
Includes the definitions for validation functions. More...
Namespaces | |
| namespace | detail |
Functions | |
| constexpr bool | is_digit (char x) noexcept |
| constexpr bool | is_ipv4_number_char (char x) noexcept |
| constexpr bool | last_label_may_be_a_number (std::string_view view) noexcept |
| constexpr char | to_lower (char x) noexcept |
| constexpr bool | is_alpha (char x) noexcept |
| constexpr bool | is_windows_drive_letter (std::string_view input) noexcept |
| constexpr bool | is_normalized_windows_drive_letter (std::string_view input) noexcept |
| ada_really_inline uint64_t | try_parse_ipv4_fast (std::string_view input) noexcept |
Variables | |
| constexpr uint64_t | ipv4_fast_fail = uint64_t(1) << 32 |
| static constexpr std::array< uint8_t, 256 > | path_signature_table |
Includes the definitions for validation functions.
These functions are not part of our public API and may change at any time.
|
constexprnoexcept |
Returns true if the character is an ASCII letter. Equivalent to std::isalpha but more likely to be inlined by the compiler.
Definition at line 56 of file checkers-inl.h.
References to_lower().
Referenced by is_normalized_windows_drive_letter(), is_windows_drive_letter(), LLVMFuzzerTestOneInput(), ada::parser::parse_url_impl(), ada::url::set_protocol(), ada::url_aggregator::set_protocol(), and ada::anonymous_namespace{implementation.cpp}::try_can_parse_absolute_fast().
|
constexprnoexcept |
Check whether x is an ASCII digit. More likely to be inlined than std::isdigit.
Definition at line 21 of file checkers-inl.h.
Referenced by last_label_may_be_a_number(), and LLVMFuzzerTestOneInput().
|
constexprnoexcept |
Definition at line 23 of file checkers-inl.h.
Referenced by last_label_may_be_a_number().
|
inlineconstexprnoexcept |
A normalized Windows drive letter is a Windows drive letter of which the second code point is U+003A (:).
Definition at line 67 of file checkers-inl.h.
References is_alpha().
Referenced by LLVMFuzzerTestOneInput(), and ada::parser::parse_url_impl().
|
inlineconstexprnoexcept |
A string starts with a Windows drive letter if all of the following are true:
https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
Definition at line 60 of file checkers-inl.h.
References is_alpha().
Referenced by LLVMFuzzerTestOneInput(), and ada::parser::parse_url_impl().
|
constexprnoexcept |
Cheap pre-check for the WHATWG "ends in a number" / IPv4-host cases. False means the host cannot be IPv4: the last label is empty, does not start with an ASCII digit, or contains a character other than a hex digit or x/X. True means the slower IPv4 parsers should run.
Safe on mixed-case input (unlike is_ipv4, which expects a lowercased host).
Definition at line 29 of file checkers-inl.h.
References is_digit(), and is_ipv4_number_char().
Referenced by ada::anonymous_namespace{implementation.cpp}::try_can_parse_absolute_fast(), ada::anonymous_namespace{implementation.cpp}::try_can_parse_clean_http(), and ada::parser::try_parse_simple_absolute().
|
constexprnoexcept |
Assuming that x is an ASCII letter, this function returns the lower case equivalent.
More likely to be inlined by the compiler and constexpr.
Definition at line 54 of file checkers-inl.h.
Referenced by is_alpha(), and LLVMFuzzerTestOneInput().
|
noexcept |
Fast pure-decimal IPv4 parse. Returns packed address or ipv4_fast_fail. Accepts an optional single trailing dot.
On AVX-512BW+VL+VBMI2 targets, uses a table-free SIMD parse (masked load, no source over-read) based on parse_ipv4_avx512vl_notab5. Otherwise uses an unrolled scalar path (typically faster than SSE2/NEON pre-validation for these 7-16 byte hosts).
Fast-path parser for pure decimal IPv4 addresses (e.g., "192.168.1.1"). Returns the packed 32-bit IPv4 address on success, or a value > 0xFFFFFFFF to indicate failure (caller should fall back to general parser). This is optimized for the common case where the input is a well-formed decimal IPv4 address with exactly 4 octets.
Definition at line 235 of file checkers-inl.h.
References ipv4_fast_fail, and ada::checkers::detail::parse_ipv4_decimal_scalar().
Referenced by LLVMFuzzerTestOneInput(), and ada::anonymous_namespace{implementation.cpp}::try_can_parse_absolute_fast().
|
constexpr |
Sentinel value indicating try_parse_ipv4_fast() did not succeed. Any value > 0xFFFFFFFF indicates the fast path should not be used.
Definition at line 128 of file checkers.h.
Referenced by ada::checkers::detail::parse_ipv4_decimal_scalar(), ada::anonymous_namespace{implementation.cpp}::try_can_parse_absolute_fast(), and try_parse_ipv4_fast().
|
staticconstexpr |
Definition at line 55 of file checkers.cpp.