summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex
AgeCommit message (Collapse)Author
2021-06-06LibRegex: Fix compilation errors on my host machineLinus Groh
I have no idea *why*, but this stopped working suddenly: return { { .code_point = '-', .is_character_class = false } }; Fails with: error: could not convert ‘{{'-', false}}’ from ‘<brace-enclosed initializer list>’ to ‘AK::Optional<regex::CharClassRangeElement> Might be related to 66f15c2 somehow, going one past that commit makes the build work again, however reverting the commit doesn't. Not sure what's up with that. Consider this patch a band-aid until we can find the reason and an actual fix... Compiler version: gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
2021-06-03Everywhere: Replace ctype.h to avoid narrowing conversionsMax Wipfli
This replaces ctype.h with CharacterType.h everywhere I could find issues with narrowing conversions. While using it will probably make sense almost everywhere in the future, the most critical places should have been addressed.
2021-06-02LibRegex: Hide stray dbgln() behind REGEX_DEBUGLinus Groh
2021-06-01Everywhere: codepoint => code pointAndreas Kling
2021-05-31LibRegex: Replace fprintf()/printf() with warnln()/outln()/dbgln()Linus Groh
2021-05-21Revert "Userland: static vs non-static constexpr variables"Linus Groh
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a. Booting the system no longer worked after these changes.
2021-05-21Userland: static vs non-static constexpr variablesLenny Maiorani
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
2021-05-07LibRegex: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
2021-05-06Tests: Move LibRegex tests to Tests/LibRegexBrian Gianforcaro
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
2021-04-29Build: Remove unused ${REGEX_SOURCES} from the tests CMakeLists.txtBrian Gianforcaro
2021-04-25Everywhere: Remove empty line after function body opening curly braceLinus Groh
2021-04-25AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMakeAndrew Kaster
As many macros as possible are moved to Macros.h, while the macros to create a test case are moved to TestCase.h. TestCase is now the only user-facing header for creating a test case. TestSuite and its helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN macro to be instantiated into the test file, a TestMain.cpp file is provided instead that will be linked against each test. This has the side effect that, if we wanted to have test cases split across multiple files, it's as simple as adding them all to the same executable. The test main should be portable to kernel mode as well, so if there's a set of tests that should be run in self-test mode in kernel space, we can accomodate that. A new serenity_test CMake function streamlines adding a new test with arguments for the test source file, subdirectory under /usr/Tests to install the test application and an optional list of libraries to link against the test application. To accomodate future test where the provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN parameter can be passed to the function to not link against the boilerplate main function.
2021-04-23LibRegex: Put to dbgln()s behind REGEX_DEBUGLinus Groh
2021-04-23LibRegex: Implement multiline stateful matchesAli Mohammad Pur
2021-04-23LibRegex: Do not attempt to find more matches when one match is neededAli Mohammad Pur
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22LibRegex: Unbreak the ALL_DEBUG buildAndreas Kling
2021-04-21LibRegex: Convert String::format() => String::formatted()Andreas Kling
2021-04-12LibRegex: Generate a 'Compare' op for empty character classesAnotherTest
Otherwise it would match zero-length strings. Fixes #6256.
2021-04-10LibRegex: Remove 'ReadDigitFollowPolicy' as it's no longer neededAnotherTest
Thanks to @GMTA: https://github.com/SerenityOS/serenity/commit/1b071455b1793dbfc7039a9090540ba0aeaf3221#r49343474
2021-04-10LibRegex: Treat brace quantifiers with invalid contents as literalsAnotherTest
Fixes #6208.
2021-04-10LibRegex: Take the regex as a const reference in print_bytecode()AnotherTest
2021-04-10LibRegex: Allow a '?' suffix for brace quantifiersAnotherTest
This fixes another compat point in #6042.
2021-04-10LibRegex: Give ByteCode a copy ctor and and a move assignment operatorAnotherTest
Previously all move assignments were actually copies. oops.
2021-04-09LibRegex: Parse `\0` as a zero-byte instead of 0x30 ("0")Jelle Raaijmakers
This was causing some regexes to trip up. Fixes #6202.
2021-04-05LibRegex: Make sure there are as many group matches as actual matchesAnotherTest
Fixes #6131.
2021-04-05LibRegex: Consider named capture groups as normal capture groups tooAnotherTest
2021-04-05LibRegex: Reset capture group indices when resetting parser stateAnotherTest
2021-04-04LibRegex: Allocate entries for all capture groups in RegexResultAnotherTest
Not just the seen ones. Fixes #6108.
2021-04-01LibRegex: Test alternatives in the expected orderAnotherTest
That is, first try to match the left side of the alternation, and then the right side. Fixes part of #6042.
2021-04-01LibRegex: Allow references to capture groups that aren't parsed yetAnotherTest
This only applies to the ECMA262 parser. This behaviour is an ECMA262-specific quirk, such references always generate zero-length matches (even on subsequent passes). Also adds a test in LibJS's test suite. Fixes #6039.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-02-28LibRegex: VERIFY that string builder in print_header is not null.Andrew Kaster
I don't know why g++ thinks this is the case with ENABLE_ALL_DEBUG_MACROS when building for serenity. Adding an assert to placate it seems reasonable
2021-02-28Meta: Build AK and LibRegex tests in Lagom and for SerenityAndrew Kaster
These tests were never built for the serenity target. Move their Lagom build steps to the Lagom CMakeLists.txt, and add serenity build steps for them. Also, fix the build errors when building them with the serenity cross-compiler :^)
2021-02-27LibRegex: Allow missing high bound in {x,y} quantifiersAnotherTest
Fixes #5518.
2021-02-27LibRegex: Match the escaped part of escaped syntax charactersAnotherTest
Previously, `\^` would've matched `\`, not `^`.
2021-02-27LibRegex: Implement section B.1.4. of the ECMA262 specAnotherTest
This allows the parser to deal with crazy patterns like the one in #5517.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-08Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)AnotherTest
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-01-25Everywhere: Debug macros instead of constexpr.asynts
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
2021-01-25Everywhere: Use CMake to generate AK/Debug.h.asynts
This was done with the help of several scripts, I dump them here to easily find them later: awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in) do find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \; done # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list. awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
2021-01-22Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-22Everywhere: Fix typosLinus Groh
2021-01-16Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling