-
Notifications
You must be signed in to change notification settings - Fork 796
Remove lexy dependency, replace with hand-written tokenizer and Pratt parser #1099
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
base: master
Are you sure you want to change the base?
Conversation
Implement BT::Scripting::tokenize() to replace the lexy-based tokenizer that was removed. Handles all token types: identifiers (with @ prefix for root blackboard vars), numbers (int/hex/real/exponent), single-quoted strings, two-char operators, and single-char operators/delimiters. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. 💤 Files selected but had no reviewable changes (3)
You can disable this status message by setting the
📝 WalkthroughWalkthroughThe pull request removes the entire Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The diff involves large-scale deletion of an entire third-party library (lexy) spanning hundreds of files and thousands of lines. While the changes are homogeneous in nature (consistent pattern of complete file removal), the sheer scope requires careful verification that all lexy references are cleanly removed from the rest of the codebase and that no external dependencies are broken by this removal. Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Add explicit != 0 for implicit int->bool conversions from ctype functions (readability-implicit-bool-conversion) - Value-initialize op variables in switch statements (cppcoreguidelines-init-variables) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Tokenizer: - Extract scanHexNumber(), scanDecimalNumber(), matchTwoCharOp(), matchSingleCharOp() to reduce cognitive complexity of tokenize() - Use init-statement in if for identifier text variable (S6004) Parser: - Replace std::runtime_error with RuntimeError (S112) - Remove redundant lambda return type (S3574) - Catch RuntimeError instead of std::exception (S1181) Co-Authored-By: Claude Opus 4.5 <[email protected]>
New test cases: - TokenizerEdgeCases: unterminated strings, hex errors (0x, 0xG), exponent errors (3e, 3e+), DotDot with numbers, empty/whitespace scripts - ChainedComparisons: 1<2<3, 3>2>1, mixed chains, chained equality - OperatorPrecedence: bitwise vs logical, parenthesized subexpressions - UnaryOperators: !, !!, ~, unary minus in expressions - TernaryExpressions: basic, with subexpressions, comparison conditions - MultipleStatements: extra semicolons, return value of last expression Co-Authored-By: Claude Opus 4.5 <[email protected]>
|



Summary
src/script_tokenizer.cppimplementingBT::Scripting::tokenize()for all token types (identifiers with@prefix, numbers, strings, operators)std::from_charsfor double/float when available (__cpp_lib_to_chars_fp_formatting)Test plan
@-prefixed root variables pass🤖 Generated with Claude Code
Summary by CodeRabbit