-
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
feat: Separate concept tags from captures and store capture-to-tag mapping in the lexer. #72
feat: Separate concept tags from captures and store capture-to-tag mapping in the lexer. #72
Conversation
…g_id; Remove error checking in favor of using .at().
Co-authored-by: Lin Zhihao <[email protected]>
Co-authored-by: Lin Zhihao <[email protected]>
…ative position test as this is what is seen in practice when using negative positions.
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
🧹 Nitpick comments (2)
src/log_surgeon/finite_automata/RegexAST.hpp (2)
118-118
: Consider usingempty()
instead of comparing withfalse
.The condition
false == m_negative_captures.empty()
can be simplified to!m_negative_captures.empty()
for better readability.- if (false == m_negative_captures.empty()) { + if (!m_negative_captures.empty()) {
910-940
: Update diagram comments to reflect capture-based terminology.The diagram's comments still use tag-based terminology in some places. Consider updating them to consistently use capture-based terminology.
- // The NFA constructed for a capture group follows the structure below, with tagged transitions + // The NFA constructed for a capture group follows the structure below, with capture transitions - // | (positive tagged start transition) + // | (positive capture start transition) - // | (negative tagged transition) + // | (negative capture transition) - // | (positive tagged end transition) + // | (positive capture end transition)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/log_surgeon/Lexer.hpp
(5 hunks)src/log_surgeon/finite_automata/RegexAST.hpp
(21 hunks)src/log_surgeon/finite_automata/TaggedTransition.hpp
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/log_surgeon/finite_automata/TaggedTransition.hpp
- src/log_surgeon/Lexer.hpp
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,ts,tsx}`: - Prefer `false ==
**/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/RegexAST.hpp
**/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/log_surgeon/finite_automata/RegexAST.hpp
🧠 Learnings (1)
src/log_surgeon/finite_automata/RegexAST.hpp (3)
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#50
File: src/log_surgeon/finite_automata/Tag.hpp:0-0
Timestamp: 2024-11-18T16:45:46.074Z
Learning: The class `TagPositions` was removed from `src/log_surgeon/finite_automata/Tag.hpp` as it is no longer needed.
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`.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build (ubuntu-22.04, Release)
- GitHub Check: build (ubuntu-22.04, Debug)
🔇 Additional comments (2)
src/log_surgeon/finite_automata/RegexAST.hpp (2)
23-23
: LGTM! Documentation and includes updated to reflect the new capture-based system.The changes consistently replace tag-based terminology with capture-based terminology throughout the documentation and includes.
Also applies to: 32-38
728-728
: LGTM! Consistent use of capture-based serialization across all derived classes.The changes to use
serialize_negative_captures
are applied consistently throughout all derived classes.Also applies to: 745-745, 776-776, 807-807, 840-840, 903-903, 962-962, 1118-1118
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.
Last few comments and we're close to merge.
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 the PR title, how about:
feat: Separate concept tags from captures and store capture-to-tag mapping in the lexer.
References
Description
*_id_t
aliases to make it more clear what the intended purpose of the maps are.Validation performed
Summary by CodeRabbit
New Features
Lexer
class for improved capture and tag management.Capture
class to replace the previousTag
class, streamlining capture handling.Tests
Capture
class and enhanced tests for the lexer.Chores