Skip to content

Commit dd7610f

Browse files
authored
Rename _MatchingEngine module to _RegexParser (#42081)
As the _MatchingEngine module no longer contains the matching engine, this patch renames this module to describe its role more accurately. Because this module primarily contains the AST and the regex parsing logic, I propose we rename it to "_RegexParser". Also renames the ExperimentalRegex module in SwiftCompilerSources to _RegexParser for consistency. This would prevent errors if sources in _RegexParser used qualified lookup with the module name.
1 parent a6bcd80 commit dd7610f

File tree

14 files changed

+46
-34
lines changed

14 files changed

+46
-34
lines changed

SwiftCompilerSources/Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
.library(
1212
name: "Swift",
1313
type: .static,
14-
targets: ["SIL", "Optimizer", "ExperimentalRegex"]),
14+
targets: ["SIL", "Optimizer", "_RegexParser"]),
1515
],
1616
dependencies: [
1717
],
@@ -26,15 +26,15 @@ let package = Package(
2626
"-cross-module-optimization"
2727
])]),
2828
.target(
29-
name: "ExperimentalRegex",
29+
name: "_RegexParser",
3030
dependencies: [],
3131
swiftSettings: [SwiftSetting.unsafeFlags([
3232
"-I", "../include/swift",
3333
"-cross-module-optimization"
3434
])]),
3535
.target(
3636
name: "Optimizer",
37-
dependencies: ["SIL", "ExperimentalRegex"],
37+
dependencies: ["SIL", "_RegexParser"],
3838
swiftSettings: [SwiftSetting.unsafeFlags([
3939
"-I", "../include/swift",
4040
"-cross-module-optimization"

SwiftCompilerSources/Sources/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
add_subdirectory(Basic)
1212
add_subdirectory(AST)
1313
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
14-
add_subdirectory(ExperimentalRegex)
14+
add_subdirectory(_RegexParser)
1515
endif()
1616
add_subdirectory(SIL)
1717
add_subdirectory(Optimizer)

SwiftCompilerSources/Sources/Optimizer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
set(dependencies)
1010
list(APPEND dependencies Basic SIL)
1111
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
12-
list(APPEND dependencies ExperimentalRegex)
12+
list(APPEND dependencies _RegexParser)
1313
endif()
1414

1515
add_swift_compiler_module(Optimizer DEPENDS ${dependencies})

SwiftCompilerSources/Sources/Optimizer/PassManager/PassRegistration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
import SIL
1414
import OptimizerBridging
1515

16-
#if canImport(ExperimentalRegex)
17-
import ExperimentalRegex
16+
#if canImport(_RegexParser)
17+
import _RegexParser
1818
#endif
1919

2020
@_cdecl("initializeSwiftModules")
2121
public func initializeSwiftModules() {
2222
registerSILClasses()
2323
registerSwiftPasses()
2424

25-
#if canImport(ExperimentalRegex)
25+
#if canImport(_RegexParser)
2626
registerRegexParser()
2727
#endif
2828
}

SwiftCompilerSources/Sources/ExperimentalRegex/CMakeLists.txt renamed to SwiftCompilerSources/Sources/_RegexParser/CMakeLists.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
file(GLOB_RECURSE _LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES
10-
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_MatchingEngine/*.swift")
11-
set(LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES)
12-
foreach(source ${_LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES})
9+
file(GLOB_RECURSE _LIBSWIFT_REGEX_PARSER_SOURCES
10+
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser/*.swift")
11+
set(LIBSWIFT_REGEX_PARSER_SOURCES)
12+
foreach(source ${_LIBSWIFT_REGEX_PARSER_SOURCES})
1313
file(TO_CMAKE_PATH "${source}" source)
14-
list(APPEND LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES ${source})
14+
list(APPEND LIBSWIFT_REGEX_PARSER_SOURCES ${source})
1515
endforeach()
16-
message(STATUS "Using Experimental String Processing library for libswift ExperimentalRegex (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
16+
message(STATUS "Using Experimental String Processing library for libswift _RegexParser (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
1717

18-
add_swift_compiler_module(ExperimentalRegex
19-
"${LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES}"
18+
add_swift_compiler_module(_RegexParser
19+
"${LIBSWIFT_REGEX_PARSER_SOURCES}"
2020
Regex.swift)
21-

SwiftCompilerSources/Sources/ExperimentalRegex/Regex.swift renamed to SwiftCompilerSources/Sources/_RegexParser/Regex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ExperimentalRegexBridging
1+
import _RegexParserBridging
22

33
public func registerRegexParser() {
44
Parser_registerRegexLiteralParsingFn(libswiftParseRegexLiteral)

include/swift/Parse/ExperimentalRegexBridging.h renamed to include/swift/Parse/RegexParserBridging.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
#ifndef EXPERIMENTAL_REGEX_BRIDGING
2-
#define EXPERIMENTAL_REGEX_BRIDGING
1+
//===-- RegexParserBridging.h --- Regex parser interface -*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
14+
#ifndef REGEX_PARSER_BRIDGING
15+
#define REGEX_PARSER_BRIDGING
316

417
#include <stdbool.h>
518

@@ -46,4 +59,4 @@ void Parser_registerRegexLiteralParsingFn(RegexLiteralParsingFn fn);
4659
} // extern "C"
4760
#endif
4861

49-
#endif // EXPERIMENTAL_REGEX_BRIDGING
62+
#endif // REGEX_PARSER_BRIDGING

include/swift/module.modulemap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module OptimizerBridging {
1919
export *
2020
}
2121

22-
module ExperimentalRegexBridging {
23-
header "Parse/ExperimentalRegexBridging.h"
22+
module _RegexParserBridging {
23+
header "Parse/RegexParserBridging.h"
2424
export *
2525
}

lib/Parse/Lexer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "swift/AST/Identifier.h"
2121
#include "swift/Basic/LangOptions.h"
2222
#include "swift/Basic/SourceManager.h"
23-
#include "swift/Parse/ExperimentalRegexBridging.h"
23+
#include "swift/Parse/RegexParserBridging.h"
2424
#include "swift/Syntax/Trivia.h"
2525
#include "llvm/Support/Compiler.h"
2626
#include "llvm/Support/MathExtras.h"
@@ -34,7 +34,7 @@
3434
#include <limits>
3535

3636
// Regex lexing delivered via libSwift.
37-
#include "swift/Parse/ExperimentalRegexBridging.h"
37+
#include "swift/Parse/RegexParserBridging.h"
3838
static RegexLiteralLexingFn regexLiteralLexingFn = nullptr;
3939
void Parser_registerRegexLiteralLexingFn(RegexLiteralLexingFn fn) {
4040
regexLiteralLexingFn = fn;

lib/Parse/ParseRegex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "swift/Syntax/SyntaxKind.h"
2222

2323
// Regex parser delivered via Swift modules.
24-
#include "swift/Parse/ExperimentalRegexBridging.h"
24+
#include "swift/Parse/RegexParserBridging.h"
2525
static RegexLiteralParsingFn regexLiteralParsingFn = nullptr;
2626
void Parser_registerRegexLiteralParsingFn(RegexLiteralParsingFn fn) {
2727
regexLiteralParsingFn = fn;

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ if(SWIFT_BUILD_STDLIB)
139139
endif()
140140

141141
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
142-
add_subdirectory(MatchingEngine)
142+
add_subdirectory(RegexParser)
143143
add_subdirectory(StringProcessing)
144144
add_subdirectory(RegexBuilder)
145145
endif()

stdlib/public/RegexBuilder/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
set(swift_regex_builder_link_libraries
1414
swiftCore
15-
swift_MatchingEngine
15+
swift_RegexParser
1616
swift_StringProcessing)
1717

1818
file(GLOB_RECURSE _REGEX_BUILDER_SOURCES

stdlib/public/MatchingEngine/CMakeLists.txt renamed to stdlib/public/RegexParser/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ set(swift_matching_engine_link_libraries
1414
swiftCore)
1515

1616
file(GLOB_RECURSE _MATCHING_ENGINE_SOURCES
17-
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_MatchingEngine/*.swift")
17+
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser/*.swift")
1818
set(MATCHING_ENGINE_SOURCES)
1919
foreach(source ${_MATCHING_ENGINE_SOURCES})
2020
file(TO_CMAKE_PATH "${source}" source)
2121
list(APPEND MATCHING_ENGINE_SOURCES ${source})
2222
endforeach()
23-
message(STATUS "Using Experimental String Processing library for _MatchingEngine (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
23+
message(STATUS "Using Experimental String Processing library for _RegexParser (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
2424

25-
add_swift_target_library(swift_MatchingEngine ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
25+
add_swift_target_library(swift_RegexParser ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
2626
"${MATCHING_ENGINE_SOURCES}"
2727

2828
SWIFT_MODULE_DEPENDS_LINUX Glibc
@@ -35,7 +35,7 @@ add_swift_target_library(swift_MatchingEngine ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
3535
LINK_LIBRARIES ${swift_matching_engine_link_libraries}
3636

3737
C_COMPILE_FLAGS
38-
-Dswift_MatchingEngine_EXPORTS
38+
-Dswift_RegexParser_EXPORTS
3939
SWIFT_COMPILE_FLAGS
4040
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
4141
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"

stdlib/public/StringProcessing/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
set(swift_string_processing_link_libraries
1414
swiftCore
15-
swift_MatchingEngine)
15+
swift_RegexParser)
1616

1717
file(GLOB_RECURSE _STRING_PROCESSING_SOURCES
1818
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_StringProcessing/*.swift"
@@ -44,6 +44,6 @@ add_swift_target_library(swift_StringProcessing ${SWIFT_STDLIB_LIBRARY_BUILD_TYP
4444
-Xfrontend -enable-experimental-pairwise-build-block
4545
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
4646

47-
SWIFT_MODULE_DEPENDS _MatchingEngine
47+
SWIFT_MODULE_DEPENDS _RegexParser
4848
INSTALL_IN_COMPONENT stdlib
4949
)

0 commit comments

Comments
 (0)