-
Notifications
You must be signed in to change notification settings - Fork 5
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
refactor: Use auto -> return_value
.
#61
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Lin Zhihao <[email protected]>
…og-surgeon into individual-files
…ypedefs to the top of the file to fix compilation error.
…pp files; Also remove RegexDFA.tpp file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (13)
src/log_surgeon/finite_automata/Dfa.hpp (1)
59-59
: Offer assistance in handling UTF-8 transitionsThe TODO comment indicates that handling UTF-8 (multi-byte transitions) is not yet implemented in the
get_intersect
function. I can assist in implementing this functionality.Would you like me to help implement support for UTF-8 transitions or open a new GitHub issue to track this task?
src/log_surgeon/LexicalRule.hpp (1)
28-31
: Address TODO comment regarding pointer constnessThe TODO comment indicates a need to make the returned pointer constant. This should be addressed to prevent unintended modifications.
Would you like me to provide an implementation that makes the returned pointer constant?
src/log_surgeon/Parser.tpp (1)
Line range hint
12-31
: Address TODO comment regarding clp-reserved symbolsThe TODO comment indicates that clp-reserved symbols should be moved out of the parser. This should be tracked and addressed in a future update.
Would you like me to create a GitHub issue to track this refactoring task?
src/log_surgeon/finite_automata/DfaStatePair.hpp (2)
25-27
: Consider using smart pointers instead of raw pointersThe class stores raw pointers to
TypedDfaState
. Consider usingstd::shared_ptr
orstd::reference_wrapper
to make ownership semantics more explicit.- DfaStatePair(TypedDfaState const* state1, TypedDfaState const* state2) - : m_state1(state1), - m_state2(state2) {}; + DfaStatePair(std::shared_ptr<TypedDfaState const> state1, + std::shared_ptr<TypedDfaState const> state2) + : m_state1(std::move(state1)), + m_state2(std::move(state2)) {};
71-82
: Address TODO regarding UTF-8 supportThe TODO comment indicates missing support for UTF-8 multi-byte transitions. This should be tracked and implemented to ensure proper handling of Unicode characters.
Would you like me to:
- Create a GitHub issue to track UTF-8 support implementation?
- Provide a sample implementation for UTF-8 handling?
src/log_surgeon/LogEvent.cpp (1)
55-56
: Consider updating condition check to match coding guidelines.The condition check could be updated to follow the coding guideline of preferring
false == <expression>
.- if (token.m_type_ids_ptr->at(0) == (uint32_t)SymbolId::TokenUncaughtString) { + if ((uint32_t)SymbolId::TokenUncaughtString == token.m_type_ids_ptr->at(0)) {src/log_surgeon/finite_automata/Nfa.hpp (1)
Line range hint
142-192
: Address the TODO comment regarding UTF8 handling.The BFS traversal implementation has a TODO comment about handling the UTF8 case. This should be addressed to ensure proper UTF8 support.
Would you like me to help implement the UTF8 case handling or create a GitHub issue to track this task?
tests/test-lexer.cpp (1)
21-32
: Consider using namespace aliases to reduce verbosity.The type aliases could be simplified by introducing a namespace alias for
log_surgeon::finite_automata
:+namespace fa = log_surgeon::finite_automata; -using RegexASTCatByte - = log_surgeon::finite_automata::RegexASTCat<log_surgeon::finite_automata::ByteNfaState>; +using RegexASTCatByte = fa::RegexASTCat<fa::ByteNfaState>; // Apply similar changes to other type aliasessrc/log_surgeon/finite_automata/NfaState.hpp (3)
Line range hint
161-161
: Consider encapsulating production body size access.Consider adding a method like
get_body_size()
to theProduction
class to encapsulate direct member access.-return m_dot == m_production->m_body.size(); +return m_dot == m_production->get_body_size();
168-168
: Consider encapsulating production body access.Consider adding a method like
get_body_at(size_t index)
to theProduction
class to encapsulate direct member access.-[[nodiscard]] auto next_symbol() const -> uint32_t { return m_production->m_body.at(m_dot); } +[[nodiscard]] auto next_symbol() const -> uint32_t { return m_production->get_body_at(m_dot); }
Line range hint
277-277
: Consider encapsulating delimiter checks.Consider adding a method like
is_delimiter(uint32_t byte)
to encapsulate direct array access.-if (m_is_delimiter[byte]) { +if (is_delimiter(byte)) {src/log_surgeon/Lexer.tpp (2)
379-382
: Address the TODO comment about DFA ignoring tags.The comment indicates that the DFA ignores tags in patterns like "capture:user=(?<user_id>\d+)". This could lead to incorrect pattern matching.
Would you like me to help implement tag support in the DFA conversion process?
461-462
: Remove or implement the commented UTF-8 support code.The commented code suggests incomplete UTF-8 support. Either implement the functionality or remove the commented code to maintain code cleanliness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (35)
CMakeLists.txt
(2 hunks)examples/intersect-test.cpp
(4 hunks)src/log_surgeon/Buffer.hpp
(1 hunks)src/log_surgeon/BufferParser.hpp
(2 hunks)src/log_surgeon/Lalr1Parser.cpp
(2 hunks)src/log_surgeon/Lalr1Parser.hpp
(8 hunks)src/log_surgeon/Lalr1Parser.tpp
(28 hunks)src/log_surgeon/Lexer.hpp
(6 hunks)src/log_surgeon/Lexer.tpp
(19 hunks)src/log_surgeon/LexicalRule.hpp
(2 hunks)src/log_surgeon/LogEvent.cpp
(2 hunks)src/log_surgeon/LogParser.cpp
(6 hunks)src/log_surgeon/LogParser.hpp
(4 hunks)src/log_surgeon/Parser.hpp
(1 hunks)src/log_surgeon/Parser.tpp
(2 hunks)src/log_surgeon/ParserInputBuffer.cpp
(2 hunks)src/log_surgeon/ReaderParser.hpp
(2 hunks)src/log_surgeon/Schema.cpp
(1 hunks)src/log_surgeon/SchemaParser.cpp
(3 hunks)src/log_surgeon/SchemaParser.hpp
(4 hunks)src/log_surgeon/finite_automata/Dfa.hpp
(1 hunks)src/log_surgeon/finite_automata/DfaState.hpp
(1 hunks)src/log_surgeon/finite_automata/DfaStatePair.hpp
(1 hunks)src/log_surgeon/finite_automata/DfaStateType.hpp
(1 hunks)src/log_surgeon/finite_automata/Nfa.hpp
(6 hunks)src/log_surgeon/finite_automata/NfaState.hpp
(6 hunks)src/log_surgeon/finite_automata/NfaStateType.hpp
(1 hunks)src/log_surgeon/finite_automata/RegexAST.hpp
(29 hunks)src/log_surgeon/finite_automata/RegexDFA.hpp
(0 hunks)src/log_surgeon/finite_automata/RegexDFA.tpp
(0 hunks)src/log_surgeon/finite_automata/RegexNFAStateType.hpp
(0 hunks)src/log_surgeon/finite_automata/TaggedTransition.hpp
(5 hunks)tests/CMakeLists.txt
(1 hunks)tests/test-NFA.cpp
(1 hunks)tests/test-lexer.cpp
(2 hunks)
💤 Files with no reviewable changes (3)
- src/log_surgeon/finite_automata/RegexNFAStateType.hpp
- src/log_surgeon/finite_automata/RegexDFA.hpp
- src/log_surgeon/finite_automata/RegexDFA.tpp
✅ Files skipped from review due to trivial changes (4)
- src/log_surgeon/finite_automata/DfaStateType.hpp
- src/log_surgeon/finite_automata/NfaStateType.hpp
- src/log_surgeon/BufferParser.hpp
- src/log_surgeon/ReaderParser.hpp
👮 Files not reviewed due to content moderation or server errors (3)
- src/log_surgeon/SchemaParser.cpp
- src/log_surgeon/Lalr1Parser.tpp
- src/log_surgeon/finite_automata/RegexAST.hpp
🧰 Additional context used
📓 Path-based instructions (23)
src/log_surgeon/Schema.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/Buffer.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/Lalr1Parser.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/LogEvent.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/LogParser.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/Parser.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/LogParser.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
examples/intersect-test.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/Dfa.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/DfaStatePair.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/SchemaParser.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/Lalr1Parser.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/ParserInputBuffer.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/LexicalRule.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/TaggedTransition.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
tests/test-lexer.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
tests/test-NFA.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/DfaState.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/Lexer.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/RegexAST.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/NfaState.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/SchemaParser.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/Nfa.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
📓 Learnings (7)
CMakeLists.txt (2)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:37-90
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In this codebase, prefer code clarity over efficiency optimizations unless efficiency is a critical concern.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:0-0
Timestamp: 2024-11-13T20:02:13.737Z
Learning: In `src/log_surgeon/finite_automata/RegexNFAState.hpp`, the constructor `RegexNFAState(std::set<Tag const*> tags, RegexNFAState const* dest_state)` has been updated to use `std::vector<Tag const*> tags` instead of `std::set`.
src/log_surgeon/finite_automata/TaggedTransition.hpp (2)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:0-0
Timestamp: 2024-11-13T20:02:13.737Z
Learning: In `src/log_surgeon/finite_automata/RegexNFAState.hpp`, the constructor `RegexNFAState(std::set<Tag const*> tags, RegexNFAState const* dest_state)` has been updated to use `std::vector<Tag const*> tags` instead of `std::set`.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#47
File: src/log_surgeon/finite_automata/TaggedTransition.hpp:16-37
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In `src/log_surgeon/finite_automata/TaggedTransition.hpp`, the classes `PositiveTaggedTransition` and `NegativeTaggedTransition` currently do not share enough functionality to justify refactoring into a common base class.
tests/test-lexer.cpp (1)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#38
File: src/log_surgeon/finite_automata/RegexAST.hpp:698-705
Timestamp: 2024-11-10T16:46:53.300Z
Learning: Using `fmt::join` on a `vector<uint32_t>` containing digits correctly concatenates them into a string representation.
tests/test-NFA.cpp (1)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:37-90
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In this codebase, prefer code clarity over efficiency optimizations unless efficiency is a critical concern.
src/log_surgeon/finite_automata/RegexAST.hpp (4)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexAST.hpp:700-700
Timestamp: 2024-11-13T22:38:19.472Z
Learning: In `RegexASTCapture`, `m_tag` must always be non-null.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#47
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:127-128
Timestamp: 2024-11-10T16:46:58.543Z
Learning: `RegexNFAUTF8State` is defined as a type alias for `RegexNFAState<RegexNFAStateType::UTF8>`.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:37-90
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In this codebase, prefer code clarity over efficiency optimizations unless efficiency is a critical concern.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:0-0
Timestamp: 2024-11-13T20:02:13.737Z
Learning: In `src/log_surgeon/finite_automata/RegexNFAState.hpp`, the constructor `RegexNFAState(std::set<Tag const*> tags, RegexNFAState const* dest_state)` has been updated to use `std::vector<Tag const*> tags` instead of `std::set`.
src/log_surgeon/finite_automata/NfaState.hpp (3)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#47
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:127-128
Timestamp: 2024-11-10T16:46:58.543Z
Learning: `RegexNFAUTF8State` is defined as a type alias for `RegexNFAState<RegexNFAStateType::UTF8>`.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:37-90
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In this codebase, prefer code clarity over efficiency optimizations unless efficiency is a critical concern.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:0-0
Timestamp: 2024-11-13T20:02:13.737Z
Learning: In `src/log_surgeon/finite_automata/RegexNFAState.hpp`, the constructor `RegexNFAState(std::set<Tag const*> tags, RegexNFAState const* dest_state)` has been updated to use `std::vector<Tag const*> tags` instead of `std::set`.
src/log_surgeon/finite_automata/Nfa.hpp (4)
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:37-90
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In this codebase, prefer code clarity over efficiency optimizations unless efficiency is a critical concern.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#47
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:127-128
Timestamp: 2024-11-10T16:46:58.543Z
Learning: `RegexNFAUTF8State` is defined as a type alias for `RegexNFAState<RegexNFAStateType::UTF8>`.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#48
File: src/log_surgeon/finite_automata/RegexNFAState.hpp:0-0
Timestamp: 2024-11-13T20:02:13.737Z
Learning: In `src/log_surgeon/finite_automata/RegexNFAState.hpp`, the constructor `RegexNFAState(std::set<Tag const*> tags, RegexNFAState const* dest_state)` has been updated to use `std::vector<Tag const*> tags` instead of `std::set`.
Learnt from: SharafMohamed
PR: y-scope/log-surgeon#42
File: src/log_surgeon/finite_automata/RegexNFA.hpp:99-105
Timestamp: 2024-11-10T16:46:58.543Z
Learning: In `src/log_surgeon/finite_automata/RegexNFA.hpp`, it's acceptable to have constructors without the `explicit` specifier. Do not suggest adding `explicit` to constructors in this file.
🔇 Additional comments (34)
src/log_surgeon/LogParser.cpp (1)
46-46
: LGTM
The method signature update to use a trailing return type enhances code consistency and readability.
src/log_surgeon/Lalr1Parser.cpp (1)
1-1
: Header include updated correctly
The inclusion of "Lalr1Parser.hpp"
reflects the new naming convention and maintains consistency across the project.
src/log_surgeon/Schema.cpp (1)
14-14
: LGTM: Proper usage of auto
with const qualifier
The change aligns well with the PR objective, maintaining both type safety and const correctness.
src/log_surgeon/Parser.hpp (1)
8-8
: LGTM: Improved template parameter naming and consistent style
The changes demonstrate:
- More descriptive template parameter names
- Consistent usage of trailing return types
- Proper type alignment in member variables
Also applies to: 15-15, 20-20
src/log_surgeon/LexicalRule.hpp (1)
9-9
: LGTM: Consistent template parameter naming and return type style
The changes demonstrate:
- Improved template parameter naming
- Consistent usage of trailing return types
- Proper type alignment throughout the class
Also applies to: 15-15, 24-24, 28-28, 35-35, 38-39
tests/CMakeLists.txt (1)
8-10
: LGTM! File renames are consistent with the refactoring effort
The renaming of files from Regex-prefixed versions to more generic names (e.g., RegexNFA.hpp
→ Nfa.hpp
) is consistent with the broader refactoring effort. The build configuration remains intact.
Also applies to: 14-16
src/log_surgeon/Parser.tpp (1)
32-48
: LGTM! Return type annotations follow the standard
The use of auto -> void
return type annotations is consistent with the PR objective to update the codebase to the auto -> return_value
standard.
src/log_surgeon/finite_automata/DfaStatePair.hpp (1)
35-40
: LGTM! Return type annotations are consistent with the standard
The implementation consistently uses the auto -> return_value
syntax as required by the PR objective. The method signatures and implementations are well-documented and follow best practices.
Also applies to: 53-55, 57-59, 67-82
src/log_surgeon/Buffer.hpp (1)
75-76
: LGTM! The change aligns with the auto return type standard.
The method signature update follows the PR objective of using auto -> return_value
while maintaining the same functionality.
src/log_surgeon/finite_automata/TaggedTransition.hpp (2)
19-21
: LGTM! Template parameter name change improves clarity.
The rename from NFAStateType
to TypedNfaState
better describes the parameter's purpose and aligns with the broader finite automata refactoring.
29-32
: LGTM! Constructor follows coding guidelines.
The null check using nullptr == tag
follows the coding guideline to prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/LogEvent.cpp (1)
45-45
: LGTM! Type declarations simplified using auto.
The change from explicit Token&
to auto&
maintains the same reference semantics while simplifying the type declarations.
Also applies to: 54-54
examples/intersect-test.cpp (3)
8-11
: LGTM: Type declarations are consistent with the new naming convention
The updated type declarations correctly reflect the simplified naming scheme, improving code clarity by removing the redundant "Regex" prefix.
Also applies to: 20-20
24-24
: LGTM: Function signature and implementation updates are consistent
The changes to get_intersect_for_query
maintain type consistency with the new naming scheme while preserving the original functionality.
Also applies to: 43-43, 45-45
81-81
: LGTM: NFA instantiation follows the new convention
The NFA instantiation is correctly updated to use the new type names.
src/log_surgeon/SchemaParser.hpp (2)
49-49
: LGTM: Type updates in SchemaVarAST are consistent
The member variable and constructor parameter types have been correctly updated to use ByteNfaState
, maintaining consistency with the new naming scheme.
Also applies to: 58-58
71-72
: LGTM: Base class inheritance update is correct
The SchemaParser class now properly inherits from the renamed Lalr1Parser with updated state types.
src/log_surgeon/ParserInputBuffer.cpp (1)
12-12
: LGTM: Method signatures correctly updated to use trailing return types
All method signatures have been consistently updated to use the modern auto -> return_type
syntax, improving code readability and maintainability. This change aligns perfectly with the PR objective.
Also applies to: 22-22, 34-34, 63-63, 89-89, 110-115
src/log_surgeon/Lexer.hpp (4)
14-16
: LGTM! Improved naming consistency.
The updated include paths and template parameter names better reflect the component roles and follow a more consistent naming convention.
Also applies to: 23-23
32-36
: LGTM! Consistent method signature updates.
Method signatures have been consistently updated to use the new type names while maintaining clear documentation.
Also applies to: 49-52, 59-59
159-159
: LGTM! Consistent member variable type updates.
Member variable types have been consistently updated to use the new naming convention.
Also applies to: 162-162, 164-164
168-169
: LGTM! Improved type alias naming consistency.
Type aliases have been updated to use the new state type names, with improved capitalization consistency in Utf8Lexer
.
src/log_surgeon/LogParser.hpp (2)
9-9
: LGTM! Consistent inheritance updates.
The base class template parameters and include paths have been consistently updated to match the new naming convention.
Also applies to: 18-18
29-29
: LGTM! Documentation consistently updated.
Exception documentation has been updated to use the new Lalr1Parser
naming convention.
Also applies to: 38-38
CMakeLists.txt (2)
71-73
: LGTM! Consistent file renaming.
Parser files have been consistently renamed to follow the new naming convention.
99-105
: LGTM! Well-organized file structure.
The new finite automata files follow a clear naming convention and demonstrate good separation of concerns.
src/log_surgeon/finite_automata/Nfa.hpp (3)
Line range hint 20-95
: LGTM! Well-structured class declaration with consistent use of trailing return types.
The class declaration follows modern C++ practices with:
- Clear documentation for public methods
- Consistent use of
auto -> return_type
syntax - Proper memory management with smart pointers
97-105
: LGTM! Clean constructor implementation.
The constructor properly initializes members using the initializer list and follows the single responsibility principle.
Line range hint 158-158
: LGTM! Follows coding guidelines for boolean expressions.
The code correctly uses false == state_queue.empty()
as per the coding guidelines.
tests/test-NFA.cpp (1)
23-31
: LGTM! Consistent type alias updates.
The type aliases have been properly updated to reflect the new naming convention while maintaining the same functionality.
src/log_surgeon/finite_automata/NfaState.hpp (1)
Line range hint 397-397
: LGTM!
The using declaration correctly brings the base class's protected member into scope.
src/log_surgeon/Lalr1Parser.hpp (2)
203-204
: LGTM!
The template parameter names are descriptive and follow the PR's naming convention.
410-410
: LGTM!
The include path correctly matches the class name.
src/log_surgeon/Lexer.tpp (1)
485-488
: Duplicate commented UTF-8 support code.
This is another instance of commented UTF-8 support code.
References
Description
auto -> return_value
standard. Ideally we catch all these in thi PR.auto
for variable types where possible. Will catch any missed instances of this in individual clang-tidy PRs when we go file-by-file in the future.Validation performed
Previously existing tests succeed.
Summary by CodeRabbit
Release Notes
New Features
Dfa
class for representing Deterministic Finite Automata.DfaState
class for managing DFA states.DfaStatePair
class to facilitate intersections between DFAs.Nfa
class to replace the previous regex-based NFA implementation.Improvements
RegexNFA
toNfa
andRegexDFA
toDfa
.TypedNfaState
andTypedDfaState
.Documentation
Tests