Skip to content
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

Fix the interpreter to correctly log strings inside the print statement #5

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

binary-blazer
Copy link
Member

Fix the interpreter to correctly log strings inside the print statement.

  • Update executePrintStatement in src/interpreter.cpp to handle string literals correctly by checking if the value is a LiteralNode and printing it directly.
  • Modify executeLiteral declaration in include/interpreter.h to include an optional isString parameter for differentiating between string literals and other expressions.

Fix the interpreter to correctly log strings inside the print statement.

* Update `executePrintStatement` in `src/interpreter.cpp` to handle string literals correctly by checking if the value is a `LiteralNode` and printing it directly.
* Modify `executeLiteral` declaration in `include/interpreter.h` to include an optional `isString` parameter for differentiating between string literals and other expressions.
…literals correctly

* Modify `executePrintStatement` to call `executeLiteral` with `isString` parameter set to true
* Update `executeLiteral` to accept an `isString` parameter and handle string literals accordingly
* Update `executeLiteral` call in `executeNode` to include the `isString` parameter
* Update `executeLiteral` declaration in `include/interpreter.h` to include the `isString` parameter
@binary-blazer binary-blazer merged commit 632214f into main Dec 20, 2024
3 checks passed
@binary-blazer binary-blazer deleted the binary-blazer/fix-interpreter branch December 20, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant