2
2
3
3
#include < algorithm>
4
4
#include < optional>
5
- #include < regex>
6
5
#include < string>
7
6
8
7
namespace ada {
@@ -678,60 +677,45 @@ result<std::optional<url_pattern_result>> url_pattern<regex_provider>::match(
678
677
}
679
678
}
680
679
681
- auto regex_flags = std::regex_constants::match_any;
682
-
683
680
// Let protocolExecResult be RegExpBuiltinExec(urlPattern’s protocol
684
681
// component's regular expression, protocol).
685
- std::smatch protocol_exec_result_value;
686
682
auto protocol_exec_result =
687
- std::regex_search (protocol, protocol_exec_result_value,
688
- protocol_component.regexp , regex_flags);
683
+ regex_provider::regex_search (protocol, protocol_component.regexp );
689
684
690
685
// Let usernameExecResult be RegExpBuiltinExec(urlPattern’s username
691
686
// component's regular expression, username).
692
- std::smatch username_exec_result_value;
693
687
auto username_exec_result =
694
- std::regex_search (username, username_exec_result_value,
695
- username_component.regexp , regex_flags);
688
+ regex_provider::regex_search (username, username_component.regexp );
696
689
697
690
// Let passwordExecResult be RegExpBuiltinExec(urlPattern’s password
698
691
// component's regular expression, password).
699
- std::smatch password_exec_result_value;
700
692
auto password_exec_result =
701
- std::regex_search (password, password_exec_result_value,
702
- password_component.regexp , regex_flags);
693
+ regex_provider::regex_search (password, password_component.regexp );
703
694
704
695
// Let hostnameExecResult be RegExpBuiltinExec(urlPattern’s hostname
705
696
// component's regular expression, hostname).
706
- std::smatch hostname_exec_result_value;
707
697
auto hostname_exec_result =
708
- std::regex_search (hostname, hostname_exec_result_value,
709
- hostname_component.regexp , regex_flags);
698
+ regex_provider::regex_search (hostname, hostname_component.regexp );
710
699
711
700
// Let portExecResult be RegExpBuiltinExec(urlPattern’s port component's
712
701
// regular expression, port).
713
- std::smatch port_exec_result_value;
714
- auto port_exec_result = std::regex_search (port, port_exec_result_value,
715
- port_component.regexp , regex_flags);
702
+ auto port_exec_result =
703
+ regex_provider::regex_search (port, port_component.regexp );
716
704
717
705
// Let pathnameExecResult be RegExpBuiltinExec(urlPattern’s pathname
718
706
// component's regular expression, pathname).
719
- std::smatch pathname_exec_result_value;
720
707
auto pathname_exec_result =
721
- std::regex_search (pathname, pathname_exec_result_value,
722
- pathname_component.regexp , regex_flags);
708
+ regex_provider::regex_search (pathname, pathname_component.regexp );
723
709
724
710
// Let searchExecResult be RegExpBuiltinExec(urlPattern’s search component's
725
711
// regular expression, search).
726
- std::smatch search_exec_result_value;
727
- auto search_exec_result = std::regex_search (
728
- search, search_exec_result_value, search_component.regexp , regex_flags);
712
+ auto search_exec_result =
713
+ regex_provider::regex_search (search, search_component.regexp );
729
714
730
715
// Let hashExecResult be RegExpBuiltinExec(urlPattern’s hash component's
731
716
// regular expression, hash).
732
- std::smatch hash_exec_result_value;
733
- auto hash_exec_result = std::regex_search (hash, hash_exec_result_value,
734
- hash_component.regexp , regex_flags);
717
+ auto hash_exec_result =
718
+ regex_provider::regex_search (hash, hash_component.regexp );
735
719
736
720
// If protocolExecResult, usernameExecResult, passwordExecResult,
737
721
// hostnameExecResult, portExecResult, pathnameExecResult, searchExecResult,
@@ -749,42 +733,42 @@ result<std::optional<url_pattern_result>> url_pattern<regex_provider>::match(
749
733
// Set result["protocol"] to the result of creating a component match result
750
734
// given urlPattern’s protocol component, protocol, and protocolExecResult.
751
735
result.protocol = protocol_component.create_component_match_result (
752
- protocol, protocol_exec_result_value );
736
+ protocol, *protocol_exec_result );
753
737
754
738
// Set result["username"] to the result of creating a component match result
755
739
// given urlPattern’s username component, username, and usernameExecResult.
756
740
result.username = username_component.create_component_match_result (
757
- username, username_exec_result_value );
741
+ username, *username_exec_result );
758
742
759
743
// Set result["password"] to the result of creating a component match result
760
744
// given urlPattern’s password component, password, and passwordExecResult.
761
745
result.password = password_component.create_component_match_result (
762
- password, password_exec_result_value );
746
+ password, *password_exec_result );
763
747
764
748
// Set result["hostname"] to the result of creating a component match result
765
749
// given urlPattern’s hostname component, hostname, and hostnameExecResult.
766
750
result.hostname = hostname_component.create_component_match_result (
767
- hostname, hostname_exec_result_value );
751
+ hostname, *hostname_exec_result );
768
752
769
753
// Set result["port"] to the result of creating a component match result given
770
754
// urlPattern’s port component, port, and portExecResult.
771
- result.port = port_component. create_component_match_result (
772
- port, port_exec_result_value );
755
+ result.port =
756
+ port_component. create_component_match_result ( port, *port_exec_result );
773
757
774
758
// Set result["pathname"] to the result of creating a component match result
775
759
// given urlPattern’s pathname component, pathname, and pathnameExecResult.
776
760
result.pathname = pathname_component.create_component_match_result (
777
- pathname, pathname_exec_result_value );
761
+ pathname, *pathname_exec_result );
778
762
779
763
// Set result["search"] to the result of creating a component match result
780
764
// given urlPattern’s search component, search, and searchExecResult.
781
765
result.search = search_component.create_component_match_result (
782
- search, search_exec_result_value );
766
+ search, *search_exec_result );
783
767
784
768
// Set result["hash"] to the result of creating a component match result given
785
769
// urlPattern’s hash component, hash, and hashExecResult.
786
- result.hash = hash_component. create_component_match_result (
787
- hash, hash_exec_result_value );
770
+ result.hash =
771
+ hash_component. create_component_match_result ( hash, *hash_exec_result );
788
772
789
773
return result;
790
774
}
0 commit comments