-
Notifications
You must be signed in to change notification settings - Fork 265
Feature/regular expression metafunction #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hsutter
merged 179 commits into
hsutter:main
from
MaxSagebaum:feature/regular_expression_metafunction
Jul 21, 2024
Merged
Changes from 42 commits
Commits
Show all changes
179 commits
Select commit
Hold shift + click to select a range
6496423
Missing trailing '...' in variadic template arguments.
MaxSagebaum 30098c6
Regular expressions initial setup.
MaxSagebaum 32e76e3
Current working status.
MaxSagebaum d7abbf7
Handling of groups.
MaxSagebaum 34be3d3
Handling of alternatives.
MaxSagebaum 54cb500
Refactor to position based matching.
MaxSagebaum d048884
Added regular expression class.
MaxSagebaum 93c0511
Added class matching.
MaxSagebaum fc8031b
Add line start and end match.
MaxSagebaum 5d26075
Compatibility fixes.
MaxSagebaum f36bbbe
Added test file for regular expressions.
MaxSagebaum d10faca
Basic state machine for range matchers.
MaxSagebaum 4d58428
Proper range printing and group invalidation on alternatives.
MaxSagebaum d149512
State management for ranges. No longer invalid groups if last match f…
MaxSagebaum 1b3456c
Range check in class_matcher and restore of groups in ranges_matcher.
MaxSagebaum e30bce2
Fix for list matcher and state for alternatives.
MaxSagebaum f16fcd2
Improved handling of empty matches and ranges.
MaxSagebaum 0383119
Bugfix for missing semaphore in typed template parameters.
MaxSagebaum 2ddeffa
Support for posix character classes.
MaxSagebaum 654b2e3
Fix for missing escape of '\'.
MaxSagebaum b87b08f
Missing group clear in alternate matcher.
MaxSagebaum ed4fba9
Whitespace errors from cppfront.
MaxSagebaum 4717892
Include regular expressions in cpp2utils.hpp.
MaxSagebaum 6d98bb3
Update for tests.
MaxSagebaum e261ea3
Remove initialization from context.
MaxSagebaum fff7cf1
Basic char matching.
MaxSagebaum 1466a02
Removed need of end logic.
MaxSagebaum 1c04824
Basic group matching.
MaxSagebaum bff2933
Added alternative.
MaxSagebaum 0602023
Added range matcher logic.
MaxSagebaum 545f905
Added remaining regex patterns.
MaxSagebaum a3e35ce
Fixes for range matcher.
MaxSagebaum e52a217
Improved group handling.
MaxSagebaum 671d6dc
Proper reset of ranges.
MaxSagebaum c82076a
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 1e0fecc
Refactor.
MaxSagebaum 42287e8
Moved begin and end to context.
MaxSagebaum 526f405
Removed Iter as template argument.
MaxSagebaum 1073a73
Refactor.
MaxSagebaum 6153cda
Refactor of parser.
MaxSagebaum e155cc5
Regular expression update.
MaxSagebaum c074dc0
Update of test and header files.
MaxSagebaum c0738a4
Addressed review comments.
MaxSagebaum 32df485
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 628c791
Review updates.
MaxSagebaum c3e28fe
Removed static annotation.
MaxSagebaum 5686639
Added greedy matching for alternatives.
MaxSagebaum 437f19d
Greedy version of alternative regex.
MaxSagebaum 907e961
Helpers in match return and first shorthand character class.
MaxSagebaum 6fd7240
Proper error handling.
MaxSagebaum 80a05db
Escaped characters from perl.
MaxSagebaum 14d873c
Group escapes and named group handling.
MaxSagebaum fb36751
Named group access in regex result.
MaxSagebaum 5485acd
Case insensitive matching flag.
MaxSagebaum 0ba2194
Added modifiers to regular expressions.
MaxSagebaum b5cd31e
Fixing bugs in implementation.
MaxSagebaum 3c13276
Non-greedy and possessive matching.
MaxSagebaum f45e7ed
Added horizontal and vertical white spaces.
MaxSagebaum e8d745d
Additional handling of excapes.
MaxSagebaum 0b8d691
Update of tests.
MaxSagebaum 4b463a6
Make regex generation public.
MaxSagebaum ab39d54
Performance fixes for greedy matching.
MaxSagebaum 77c36d0
Added modifiers to matching logic.
MaxSagebaum 930c3f4
Added (?<mod>) notation.
MaxSagebaum 90bb000
Added (?:) notation.
MaxSagebaum 6d05445
Added m and s modifiers.
MaxSagebaum d0b4c00
Bugfix for wrong none-greedy parsing.
MaxSagebaum 1022c48
Fixes for regex results.
MaxSagebaum cb68faa
Update for tests.
MaxSagebaum fb3ea39
Added support for 'n' modifier.
MaxSagebaum c00bf90
Added perquisites for per syntax parsing.
MaxSagebaum 7b927d0
Remove direkt position handling from parser.
MaxSagebaum 0beaa0c
Added named groups with '.
MaxSagebaum 03cdda0
Escape of space in character classes.
MaxSagebaum 2eb0b05
Proper handliing of x and xx modifier switches.
MaxSagebaum 92a24f1
Added parsing for comment groups.
MaxSagebaum d74458d
Aded branch reset support.
MaxSagebaum 3d53f89
Update of tests and header.
MaxSagebaum 8362c8d
Added support for \x.
MaxSagebaum 0a5c9a0
Added \000 and \o{000} handles.
MaxSagebaum 93af009
Added lookahead matchers.
MaxSagebaum ee5d81e
Addes statefull match tail.
MaxSagebaum a64ccfb
Helper functions for match_return creation.
MaxSagebaum 46ce90b
Refactor of matcher naming and helpers.
MaxSagebaum 9d3151e
Cleanup of to_string.
MaxSagebaum 05a632e
Matcher cleanup.
MaxSagebaum 210f2a1
Parser refactor.
MaxSagebaum 86fa6e9
Header update and tests update.
MaxSagebaum 6adf9b4
Fix for greedy range matching.
MaxSagebaum a054d74
Better template arguments for range matchers.
MaxSagebaum f5fe452
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum a7daf80
Update for regex tests.
MaxSagebaum 8ea4561
Changes for new analysis.
MaxSagebaum 599cc56
Remove <format> dependency, get warning-clean build
hsutter b5e9879
Create pure2-regex-partial.cpp2
hsutter c3afdc8
Fix for compile time degradation.
MaxSagebaum ddf291d
Added first conversion to matcher generator.
MaxSagebaum 97eb938
Basic generation of char matchers.
MaxSagebaum 268cfb9
Basic code generation via regegx tokens.
MaxSagebaum 702aa6a
Moved and renamed char token matcher.
MaxSagebaum 586788a
Parsing of ranges.
MaxSagebaum 38ad020
Moved code generation to generation context.
MaxSagebaum bd83019
Generation of statefull matcher.
MaxSagebaum 1321d8b
Cleanup of ranger matcher implementation.
MaxSagebaum ef7c931
Added special range matching.
MaxSagebaum b2fc15f
Removed old range parsers.
MaxSagebaum 84716a3
Moved parse_until into parser context.
MaxSagebaum c889182
Added to_string output.
MaxSagebaum 3abd68c
Added group handling.
MaxSagebaum c3e7435
Added logic for alternative.
MaxSagebaum c2e94b5
Added '.' regex expression.
MaxSagebaum 9b78205
Added group reference matchers.
MaxSagebaum 84b0280
Added anchor matchers.
MaxSagebaum b009a27
Added class matchers.
MaxSagebaum 590ee3c
Added full group matcher parsing.
MaxSagebaum 459fdc7
Added basic character escapes.
MaxSagebaum c726707
Added word boundary matchers.
MaxSagebaum a894f25
Added named start and end line matchers.
MaxSagebaum 14646c3
Added named class matchers.
MaxSagebaum e0382ef
Added \K token.
MaxSagebaum 1cb8883
Added hexadicimal token and octal token.
MaxSagebaum 64fc6cf
Added lookahead parsing and matching.
MaxSagebaum 0ea40c7
Group gathering is now done in a set.
MaxSagebaum 698b02a
Added modifier handling.
MaxSagebaum 4ce2148
Removal of unused funtionality and proper parsing of global modifiers.
MaxSagebaum b7a4478
Moved name group lookup creation.
MaxSagebaum 28ae594
Fixes for generation.
MaxSagebaum 97f4ddc
Merge remote-tracking branch 'origin/main' into temp
MaxSagebaum 19e72ee
Bugfix for nonconst has in generated flag_enums.
MaxSagebaum 2b0d72b
Removed modifiers from arguments and fixed a few wanrings.
MaxSagebaum 8bdd23d
Removed templates for regular arguments.
MaxSagebaum b138737
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 94ffb10
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum d834167
Agglomeration of character matchers.
MaxSagebaum d11cde9
Refactored function generation to do .. while loop.
MaxSagebaum c68dcfe
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 4a498f2
Removed UFCS calls.
MaxSagebaum e9ff730
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 9646d37
Fixes for new cppfront analysis.
MaxSagebaum 8ab0e98
Fixes for new char matcher logic.
MaxSagebaum b69fab4
Added handling of raw strings and using raw strings.
MaxSagebaum d02e1ad
Escape adaptions for to_string and other to_string fixes.
MaxSagebaum 302e4b0
General refactor.
MaxSagebaum 65406dc
Continuation of cleanup.
MaxSagebaum 8f250d3
Added namespace ot string_util.h.
MaxSagebaum 4c492c1
Fixes for compiler warnings.
MaxSagebaum edf0b74
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 7fa74b1
Added new tests.
MaxSagebaum 617b042
Changes for regression tests.
MaxSagebaum 5cefc73
Fixes for regex and non-regex tests.
MaxSagebaum a65350b
Remove UFCS from regex and more non-regex test fixes.
MaxSagebaum 8db3c70
Update for TODOs.
MaxSagebaum e4ba57d
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum bcf9c61
Update for generated header files.
MaxSagebaum e106333
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum dc2a9f1
Update of generated header files.
MaxSagebaum 98ce0fd
Updates for regression tests.
MaxSagebaum 47b2370
Enable modules build on MSVC by removing #includes when using modules
hsutter ccaf546
Updates for regression tests.
MaxSagebaum f62b856
Changes for regression-tests.
MaxSagebaum ca6774d
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 2eaac0b
Updates for regression tests.
MaxSagebaum bb27c43
Updates for regression tests.
MaxSagebaum 5208006
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum 57f8e15
Update for \e escape.
MaxSagebaum 4cfbe00
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum f0a76a9
CI update tests
jarzec 5942bdd
Update for tests.
MaxSagebaum 0172e35
Merge branch 'main' into feature/regular_expression_metafunction
MaxSagebaum 8dedcc7
Merge remote-tracking branch 'temp/ci-update-tests' into feature/regu…
MaxSagebaum b99d10e
Update for test results.
MaxSagebaum 788cf3d
Merge remote-tracking branch 'origin/main' into feature/regular_expre…
MaxSagebaum b089f02
Update for regression tests.
MaxSagebaum 9577a0b
Reran regressions on my box - whitespace changes only
hsutter 85b8458
Move & rename source/regex.h2 to include/cpp2regex.h2
hsutter 2a8994f
Merge string_util.h into cpp2util.h
hsutter 25b1a26
Review pass through cpp2regex.h2
hsutter de8348f
Finish tweaking pass through cpp2regex.h2
hsutter ae9fa61
Merge branch 'main' into feature/regular_expression_metafunction
hsutter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <algorithm> | ||
|
|
||
| // From https://stackoverflow.com/questions/216823/how-to-trim-a-stdstring | ||
|
|
||
| // trim from start (in place) | ||
| static inline void ltrim(std::string &s) { | ||
| s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { | ||
| return !std::isspace(ch); | ||
| })); | ||
| } | ||
|
|
||
| // trim from end (in place) | ||
| static inline void rtrim(std::string &s) { | ||
| s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { | ||
| return !std::isspace(ch); | ||
| }).base(), s.end()); | ||
| } | ||
|
|
||
| // trim from both ends (in place) | ||
| static inline void trim(std::string &s) { | ||
| rtrim(s); | ||
| ltrim(s); | ||
| } | ||
|
|
||
| // trim from start (copying) | ||
| static inline std::string ltrim_copy(std::string_view s) { | ||
| std::string t(s); | ||
| ltrim(t); | ||
| return t; | ||
| } | ||
|
|
||
| // trim from end (copying) | ||
| static inline std::string rtrim_copy(std::string_view s) { | ||
| std::string t(s); | ||
| rtrim(t); | ||
| return t; | ||
| } | ||
|
|
||
| // trim from both ends (copying) | ||
| static inline std::string trim_copy(std::string_view s) { | ||
| std::string t(s); | ||
| trim(t); | ||
| return t; | ||
| } | ||
|
|
||
| // From https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html#nttp | ||
|
|
||
| template<typename CharT, std::size_t N> | ||
| struct fixed_string { | ||
| constexpr fixed_string(const CharT (&s)[N+1]) { | ||
| std::copy_n(s, N + 1, str); | ||
| } | ||
| constexpr const CharT* data() const { | ||
| return str; | ||
| } | ||
| constexpr std::size_t size() const { | ||
| return N; | ||
| } | ||
|
|
||
| CharT str[N+1]; | ||
| }; | ||
|
|
||
| template<typename CharT, std::size_t N> | ||
| fixed_string(const CharT (&)[N])->fixed_string<CharT, N-1>; | ||
Large diffs are not rendered by default.
Oops, something went wrong.
446 changes: 446 additions & 0 deletions
446
regression-tests/test-results/gcc-13/pure2-regex.cpp.execution
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.