mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
LibRegex: Annotate classes with export macro for hidden visibility
This fix demos the gradual opt-in migration process libraries can take to switch to explicit symbol exports via the FOO_API macros.
This commit is contained in:
parent
3dd2fbd041
commit
a3754a7bf1
Notes:
github-actions[bot]
2025-05-12 09:23:32 +00:00
Author: https://github.com/ayeteadoe
Commit: a3754a7bf1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4667
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/alimpfard
6 changed files with 15 additions and 13 deletions
|
@ -10,5 +10,5 @@ if(SERENITYOS)
|
||||||
list(APPEND SOURCES C/Regex.cpp)
|
list(APPEND SOURCES C/Regex.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
serenity_lib(LibRegex regex)
|
serenity_lib(LibRegex regex EXPLICIT_SYMBOL_EXPORT)
|
||||||
target_link_libraries(LibRegex PRIVATE LibUnicode)
|
target_link_libraries(LibRegex PRIVATE LibUnicode)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
#include <LibRegex/Export.h>
|
||||||
|
|
||||||
namespace regex {
|
namespace regex {
|
||||||
struct CompareTypeAndValuePair;
|
struct CompareTypeAndValuePair;
|
||||||
|
|
|
@ -142,7 +142,7 @@ struct CompareTypeAndValuePair {
|
||||||
|
|
||||||
class OpCode;
|
class OpCode;
|
||||||
|
|
||||||
struct StringTable {
|
struct REGEX_API StringTable {
|
||||||
StringTable();
|
StringTable();
|
||||||
~StringTable();
|
~StringTable();
|
||||||
StringTable(StringTable const&) = default;
|
StringTable(StringTable const&) = default;
|
||||||
|
@ -176,7 +176,7 @@ struct StringTable {
|
||||||
HashMap<ByteCodeValueType, FlyString> m_inverse_table;
|
HashMap<ByteCodeValueType, FlyString> m_inverse_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ByteCode : public DisjointChunks<ByteCodeValueType> {
|
class REGEX_API ByteCode : public DisjointChunks<ByteCodeValueType> {
|
||||||
using Base = DisjointChunks<ByteCodeValueType>;
|
using Base = DisjointChunks<ByteCodeValueType>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/GenericLexer.h>
|
#include <AK/GenericLexer.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
|
#include <LibRegex/Forward.h>
|
||||||
|
|
||||||
namespace regex {
|
namespace regex {
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ private:
|
||||||
StringView m_value {};
|
StringView m_value {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Lexer : public GenericLexer {
|
class REGEX_API Lexer : public GenericLexer {
|
||||||
public:
|
public:
|
||||||
Lexer();
|
Lexer();
|
||||||
explicit Lexer(StringView source);
|
explicit Lexer(StringView source);
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct Block {
|
||||||
|
|
||||||
static constexpr size_t const c_max_recursion = 5000;
|
static constexpr size_t const c_max_recursion = 5000;
|
||||||
|
|
||||||
struct RegexResult final {
|
struct REGEX_API RegexResult final {
|
||||||
bool success { false };
|
bool success { false };
|
||||||
size_t count { 0 };
|
size_t count { 0 };
|
||||||
Vector<Match> matches;
|
Vector<Match> matches;
|
||||||
|
@ -44,10 +44,10 @@ struct RegexResult final {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Parser>
|
template<class Parser>
|
||||||
class Regex;
|
class REGEX_API Regex;
|
||||||
|
|
||||||
template<class Parser>
|
template<class Parser>
|
||||||
class Matcher final {
|
class REGEX_API Matcher final {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Matcher(Regex<Parser> const* pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {})
|
Matcher(Regex<Parser> const* pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {})
|
||||||
|
@ -78,7 +78,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Parser>
|
template<class Parser>
|
||||||
class Regex final {
|
class REGEX_API Regex final {
|
||||||
public:
|
public:
|
||||||
ByteString pattern_value;
|
ByteString pattern_value;
|
||||||
regex::Parser::Result parser_result;
|
regex::Parser::Result parser_result;
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct NamedCaptureGroup {
|
||||||
size_t alternative_id;
|
size_t alternative_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Parser {
|
class REGEX_API Parser {
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
ByteCode bytecode;
|
ByteCode bytecode;
|
||||||
|
@ -137,7 +137,7 @@ protected:
|
||||||
ParserState m_parser_state;
|
ParserState m_parser_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractPosixParser : public Parser {
|
class REGEX_API AbstractPosixParser : public Parser {
|
||||||
protected:
|
protected:
|
||||||
explicit AbstractPosixParser(Lexer& lexer)
|
explicit AbstractPosixParser(Lexer& lexer)
|
||||||
: Parser(lexer)
|
: Parser(lexer)
|
||||||
|
@ -152,7 +152,7 @@ protected:
|
||||||
ALWAYS_INLINE bool parse_bracket_expression(Vector<CompareTypeAndValuePair>&, size_t&);
|
ALWAYS_INLINE bool parse_bracket_expression(Vector<CompareTypeAndValuePair>&, size_t&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PosixBasicParser final : public AbstractPosixParser {
|
class REGEX_API PosixBasicParser final : public AbstractPosixParser {
|
||||||
public:
|
public:
|
||||||
explicit PosixBasicParser(Lexer& lexer)
|
explicit PosixBasicParser(Lexer& lexer)
|
||||||
: AbstractPosixParser(lexer)
|
: AbstractPosixParser(lexer)
|
||||||
|
@ -181,7 +181,7 @@ private:
|
||||||
size_t m_current_capture_group_depth { 0 };
|
size_t m_current_capture_group_depth { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class PosixExtendedParser final : public AbstractPosixParser {
|
class REGEX_API PosixExtendedParser final : public AbstractPosixParser {
|
||||||
constexpr static auto default_options = static_cast<PosixFlags>(AllFlags::SingleLine) | static_cast<PosixFlags>(AllFlags::Internal_ConsiderNewline);
|
constexpr static auto default_options = static_cast<PosixFlags>(AllFlags::SingleLine) | static_cast<PosixFlags>(AllFlags::Internal_ConsiderNewline);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -208,7 +208,7 @@ private:
|
||||||
ALWAYS_INLINE bool parse_repetition_symbol(ByteCode&, size_t&);
|
ALWAYS_INLINE bool parse_repetition_symbol(ByteCode&, size_t&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ECMA262Parser final : public Parser {
|
class REGEX_API ECMA262Parser final : public Parser {
|
||||||
constexpr static ECMAScriptOptions default_options = static_cast<ECMAScriptFlags>(AllFlags::Internal_ConsiderNewline);
|
constexpr static ECMAScriptOptions default_options = static_cast<ECMAScriptFlags>(AllFlags::Internal_ConsiderNewline);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue