Skip to content

Rename _MatchingEngine module to _RegexParser #42081

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
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SwiftCompilerSources/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.library(
name: "Swift",
type: .static,
targets: ["SIL", "Optimizer", "ExperimentalRegex"]),
targets: ["SIL", "Optimizer", "_RegexParser"]),
],
dependencies: [
],
Expand All @@ -26,15 +26,15 @@ let package = Package(
"-cross-module-optimization"
])]),
.target(
name: "ExperimentalRegex",
name: "_RegexParser",
dependencies: [],
swiftSettings: [SwiftSetting.unsafeFlags([
"-I", "../include/swift",
"-cross-module-optimization"
])]),
.target(
name: "Optimizer",
dependencies: ["SIL", "ExperimentalRegex"],
dependencies: ["SIL", "_RegexParser"],
swiftSettings: [SwiftSetting.unsafeFlags([
"-I", "../include/swift",
"-cross-module-optimization"
Expand Down
2 changes: 1 addition & 1 deletion SwiftCompilerSources/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
add_subdirectory(Basic)
add_subdirectory(AST)
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
add_subdirectory(ExperimentalRegex)
add_subdirectory(_RegexParser)
endif()
add_subdirectory(SIL)
add_subdirectory(Optimizer)
2 changes: 1 addition & 1 deletion SwiftCompilerSources/Sources/Optimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set(dependencies)
list(APPEND dependencies Basic SIL)
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
list(APPEND dependencies ExperimentalRegex)
list(APPEND dependencies _RegexParser)
endif()

add_swift_compiler_module(Optimizer DEPENDS ${dependencies})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
import SIL
import OptimizerBridging

#if canImport(ExperimentalRegex)
import ExperimentalRegex
#if canImport(_RegexParser)
import _RegexParser
#endif

@_cdecl("initializeSwiftModules")
public func initializeSwiftModules() {
registerSILClasses()
registerSwiftPasses()

#if canImport(ExperimentalRegex)
#if canImport(_RegexParser)
registerRegexParser()
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

file(GLOB_RECURSE _LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_MatchingEngine/*.swift")
set(LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES)
foreach(source ${_LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES})
file(GLOB_RECURSE _LIBSWIFT_REGEX_PARSER_SOURCES
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser/*.swift")
set(LIBSWIFT_REGEX_PARSER_SOURCES)
foreach(source ${_LIBSWIFT_REGEX_PARSER_SOURCES})
file(TO_CMAKE_PATH "${source}" source)
list(APPEND LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES ${source})
list(APPEND LIBSWIFT_REGEX_PARSER_SOURCES ${source})
endforeach()
message(STATUS "Using Experimental String Processing library for libswift ExperimentalRegex (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
message(STATUS "Using Experimental String Processing library for libswift _RegexParser (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")

add_swift_compiler_module(ExperimentalRegex
"${LIBSWIFT_EXPERIMENTAL_REGEX_SOURCES}"
add_swift_compiler_module(_RegexParser
"${LIBSWIFT_REGEX_PARSER_SOURCES}"
Regex.swift)

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ExperimentalRegexBridging
import _RegexParserBridging

public func registerRegexParser() {
Parser_registerRegexLiteralParsingFn(libswiftParseRegexLiteral)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#ifndef EXPERIMENTAL_REGEX_BRIDGING
#define EXPERIMENTAL_REGEX_BRIDGING
//===-- RegexParserBridging.h --- Regex parser interface -*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//


#ifndef REGEX_PARSER_BRIDGING
#define REGEX_PARSER_BRIDGING

#include <stdbool.h>

Expand Down Expand Up @@ -46,4 +59,4 @@ void Parser_registerRegexLiteralParsingFn(RegexLiteralParsingFn fn);
} // extern "C"
#endif

#endif // EXPERIMENTAL_REGEX_BRIDGING
#endif // REGEX_PARSER_BRIDGING
4 changes: 2 additions & 2 deletions include/swift/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module OptimizerBridging {
export *
}

module ExperimentalRegexBridging {
header "Parse/ExperimentalRegexBridging.h"
module _RegexParserBridging {
header "Parse/RegexParserBridging.h"
export *
}
4 changes: 2 additions & 2 deletions lib/Parse/Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "swift/AST/Identifier.h"
#include "swift/Basic/LangOptions.h"
#include "swift/Basic/SourceManager.h"
#include "swift/Parse/ExperimentalRegexBridging.h"
#include "swift/Parse/RegexParserBridging.h"
#include "swift/Syntax/Trivia.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
Expand All @@ -34,7 +34,7 @@
#include <limits>

// Regex lexing delivered via libSwift.
#include "swift/Parse/ExperimentalRegexBridging.h"
#include "swift/Parse/RegexParserBridging.h"
static RegexLiteralLexingFn regexLiteralLexingFn = nullptr;
void Parser_registerRegexLiteralLexingFn(RegexLiteralLexingFn fn) {
regexLiteralLexingFn = fn;
Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/ParseRegex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "swift/Syntax/SyntaxKind.h"

// Regex parser delivered via Swift modules.
#include "swift/Parse/ExperimentalRegexBridging.h"
#include "swift/Parse/RegexParserBridging.h"
static RegexLiteralParsingFn regexLiteralParsingFn = nullptr;
void Parser_registerRegexLiteralParsingFn(RegexLiteralParsingFn fn) {
regexLiteralParsingFn = fn;
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if(SWIFT_BUILD_STDLIB)
endif()

if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
add_subdirectory(MatchingEngine)
add_subdirectory(RegexParser)
add_subdirectory(StringProcessing)
add_subdirectory(RegexBuilder)
endif()
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/RegexBuilder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

set(swift_regex_builder_link_libraries
swiftCore
swift_MatchingEngine
swift_RegexParser
swift_StringProcessing)

file(GLOB_RECURSE _REGEX_BUILDER_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ set(swift_matching_engine_link_libraries
swiftCore)

file(GLOB_RECURSE _MATCHING_ENGINE_SOURCES
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_MatchingEngine/*.swift")
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser/*.swift")
set(MATCHING_ENGINE_SOURCES)
foreach(source ${_MATCHING_ENGINE_SOURCES})
file(TO_CMAKE_PATH "${source}" source)
list(APPEND MATCHING_ENGINE_SOURCES ${source})
endforeach()
message(STATUS "Using Experimental String Processing library for _MatchingEngine (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
message(STATUS "Using Experimental String Processing library for _RegexParser (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")

add_swift_target_library(swift_MatchingEngine ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
add_swift_target_library(swift_RegexParser ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
"${MATCHING_ENGINE_SOURCES}"

SWIFT_MODULE_DEPENDS_LINUX Glibc
Expand All @@ -35,7 +35,7 @@ add_swift_target_library(swift_MatchingEngine ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
LINK_LIBRARIES ${swift_matching_engine_link_libraries}

C_COMPILE_FLAGS
-Dswift_MatchingEngine_EXPORTS
-Dswift_RegexParser_EXPORTS
SWIFT_COMPILE_FLAGS
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/StringProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

set(swift_string_processing_link_libraries
swiftCore
swift_MatchingEngine)
swift_RegexParser)

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

SWIFT_MODULE_DEPENDS _MatchingEngine
SWIFT_MODULE_DEPENDS _RegexParser
INSTALL_IN_COMPONENT stdlib
)