-
Notifications
You must be signed in to change notification settings - Fork 6
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: Update NFA and DFA headers to align with the latest coding guidelines. #58
refactor: Update NFA and DFA headers to align with the latest coding guidelines. #58
Conversation
…han one leaving an NFA state.
…egativeTaggedTransition classes into their own files.
…just an id. This object is created and owned by the capture AST, and other AST and NFA states point to these tags.
…that was accidentally removed.
…viously untouched files.
…Should fix this so the ordering is determinstic.
…ename tag members to make it clear they are positions.
Co-authored-by: Lin Zhihao <[email protected]>
Co-authored-by: Lin Zhihao <[email protected]>
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: 0
🧹 Outside diff range and nitpick comments (1)
src/log_surgeon/finite_automata/RegexDFAState.hpp (1)
62-64
: Consider following the coding guideline for boolean expressions.The condition
RegexDFAStateType::Byte == state_type
already follows the guideline of putting the constant on the left side of the comparison. However, for consistency, consider applying the same pattern throughout the method.Apply this diff:
if constexpr (RegexDFAStateType::Byte == state_type) { return m_bytes_transition[character]; } else { if (character < cSizeOfByte) { return m_bytes_transition[character]; } std::unique_ptr<std::vector<typename Tree::Data>> result = m_tree_transitions.find(Interval(character, character)); assert(result->size() <= 1); - if (false == result->empty()) { + if (true == result->empty()) { + return nullptr; + } - return result->front().m_value; - } - return nullptr; + return result->front().m_value; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/log_surgeon/finite_automata/RegexDFAState.hpp
(2 hunks)src/log_surgeon/finite_automata/RegexDFAStatePair.hpp
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/log_surgeon/finite_automata/RegexDFAStatePair.hpp
🧰 Additional context used
📓 Path-based instructions (1)
src/log_surgeon/finite_automata/RegexDFAState.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
📓 Learnings (1)
src/log_surgeon/finite_automata/RegexDFAState.hpp (1)
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`.
🔇 Additional comments (3)
src/log_surgeon/finite_automata/RegexDFAState.hpp (3)
22-22
: LGTM! The template parameter renaming improves consistency.
The change from stateType
to state_type
follows standard C++ naming conventions, and the simplified type alias improves code readability.
Also applies to: 25-25
55-59
: LGTM! Well-documented conditional type declaration.
The member variable declarations are clear and well-documented. The use of std::conditional_t
for compile-time type selection is appropriate, and the comment effectively explains the empty tuple case.
43-43
: LGTM! Method signatures are clear and consistent.
The simplified parameter types in method signatures improve readability while maintaining type safety.
Also applies to: 51-51
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.
(This is a comment for myself): since this PR has many different types of fixes, I think we need to have a multi-line commit message when we merge.
Co-authored-by: Lin Zhihao <[email protected]>
Co-authored-by: Lin Zhihao <[email protected]>
Co-authored-by: Lin Zhihao <[email protected]>
…fMohamed/log-surgeon into remove-redundant-typenames
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.
For commit message, how about:
refactor: Update NFA and DFA headers to align with the latest coding guidelines:
- Remove redundant type names.
- Use snake case for variable template parameters.
- Use backticks (`) to quote member variables in the doc string.
Notice that we should use multi-line commit message
References
Description
stateType
tostate_type
.Validation performed
Previously existing tests still succeed.
Summary by CodeRabbit
RegexNFA
class.RegexDFAState
andRegexDFAStatePair
classes.NonTerminal
class methods.