Closed Pitasi closed 4 months ago
[!WARNING]
Review Failed
The pull request is closed.
The changes introduce string literals and comparison operators (<
, >
, <=
, >=
, ==
, !=
) for integers in the Shield project. Enhancements include new parsing, tokenization, and evaluation logic for strings and operators, along with new functions and tests to support these features. These modifications allow the system to handle string objects and perform type-specific comparisons.
Files/Paths | Change Summaries |
---|---|
CHANGELOG.md |
Added new comparison operators for integers. |
proto/shield/ast/ast.proto |
Reordered and added fields to Expression message; introduced StringLiteral message. |
proto/shield/token/token.proto |
Modified Type enum to include new values for strings and comparison operators. |
shield/ast/ast.go |
Added functions for string literal creation and extraction; removed various literal-related methods. |
shield/ast/stringify.go |
Added support for string literals in the Stringify function. |
shield/internal/evaluator/builtins.go |
Added contains function and type-specific compare function. |
shield/internal/evaluator/builtins_test.go |
Added test cases for the contains function. |
shield/internal/evaluator/evaluator.go |
Added handling for StringLiteral expressions and comparison operators in evaluation functions. |
shield/internal/evaluator/evaluator_test.go |
Added boolean expression tests for comparison operations. |
shield/internal/lexer/lexer.go |
Enhanced NextToken method to handle new operators and string tokens; added readString method. |
shield/internal/lexer/lexer_test.go |
Updated TestNextToken to include new token types and strings. |
shield/internal/parser/parser.go |
Added parsing logic for new token types and string literals. |
shield/internal/parser/parser_test.go |
Added tests for string literals and comparison expressions. |
shield/object/object.go |
Introduced String object type with associated methods. |
Objective (Issue #) | Addressed | Explanation |
---|---|---|
Add string object type (307) | ✅ | |
Support for array literals that include strings (307) | ✅ | |
New built-in contains(item, array) to check if item is an element of the array (307) |
✅ |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Adds a string literal type to the shield language. Adds a
contains(item, [...])
builtin to easily check if an array contains a specific value (the only supported value types are ints, bools, strings).depends on #292
closes #307
Summary by CodeRabbit
New Features
<
,>
,<=
,>=
,==
,!=
for integer comparisons.Bug Fixes
Tests
contains
function and various comparison expressions.Documentation
CHANGELOG.md
to reflect new features and changes.