-
Notifications
You must be signed in to change notification settings - Fork 0
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: enhance KQL parser with escaped character support and performance tests #8
Conversation
Reviewer's Guide by SourceryThis PR significantly improves the KQL parser's handling of escape sequences and adds comprehensive testing infrastructure. The changes include a new escape handling system, extensive test coverage, benchmarking capabilities, and improved documentation. Class diagram for updated Literal classclassDiagram
class Literal {
int pos
int end
token.Kind Kind
string Value
bool WithDoubleQuote
int[] escapeIndexes
+NewLiteral(int pos, int end, token.Kind kind, string value, int[] escapeIndexes)
+String() string
}
note for Literal "Added escapeIndexes attribute to handle escape sequences"
Class diagram for new CharProcResult structclassDiagram
class CharProcResult {
int Position
bool IsEscaped
int[] EscapeIndexes
+NewCharProcResult(int position, bool isEscaped, int[] escapeIndexes)
+String() string
}
note for CharProcResult "New struct to handle character processing results in token lexing"
Class diagram for updated defaultLexer classclassDiagram
class defaultLexer {
rune[] Value
Token Token
int pos
token.Kind lastTokenKind
bool dotIdent
+newLexer(string input) *defaultLexer
+nextToken() error
+consumeToken() error
+consumeFieldToken() error
+consumeEscapedToken(token.Kind kind, rune endChar) (int, []int, error)
+consumeIdent() error
+consumeString() error
+consumeNumber() error
+consumeOperator() error
+consumeParen() error
+skipSpaces()
+skipN(int n)
+peek(int i) rune
+peekOk(int i) bool
+slice(int start, int end) string
+eof() bool
+shouldBreak(int i, bool isString, bool withEscape, rune endChar) bool
+collectNextToken(int start) string
+processNonEscaped(int i, token.Kind kind) bool
+handleNonEscaped(int pos, token.Kind k, *bytes.Buffer buf, []int indexes) CharProcResult
+handleEscaped(int pos, token.Kind k, *bytes.Buffer buf, []int indexes) (CharProcResult, error)
+handleBackslash(int pos, *bytes.Buffer buf, bool isString, []int indexes) (int, []int)
+handleEscapeSequence(int pos, token.Kind k) (bool, error)
}
note for defaultLexer "Added methods to handle escape sequences and token processing"
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @laojianzi - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Here's the code health analysis summary for commits Analysis Summary
Code Coverage Report
|
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.
Auto Pull Request Review from LlamaPReview
Large PR Notification
Dear contributor,
Thank you for your substantial contribution to this project. LlamaPReview has detected that this Pull Request contains a large volume of changes, which exceeds our current processing capacity.
Details:
- PR and related contents total size: Approximately 80,759 characters
- Current limit: 50,000 characters
Next steps:
- Consider breaking this PR into smaller, more focused changes if possible.
- For manual review, please reach out to your team members or maintainers.
We appreciate your understanding and commitment to improving this project. Your contributions are valuable, and we want to ensure they receive the attention they deserve.
LlamaPReview is continuously evolving to better serve the community. Share your thoughts on handling large PRs in our GitHub Discussions - your feedback helps us improve and expand our capabilities.
If you have any questions or need assistance, our community and support team are here to help.
Best regards,
LlamaPReview Team
@sourcery-ai summary |
I'm sorry, I don't understand the command Please use |
Close #3
Summary by Sourcery
Enhance the KQL parser to support escaped characters, improving query flexibility and robustness. Update documentation with detailed usage and examples, and introduce comprehensive tests and benchmarks to ensure performance and reliability.
New Features:
Enhancements:
Documentation:
Tests: