Repository navigation
feat: enhance lexer with ignore outputs function [~, S, ~] = svd(A) - #1484
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for ignoring function outputs using the tilde (~) syntax (e.g., [~, S, ~] = svd(A)), making Nelson compatible with MATLAB's syntax for unused outputs. This allows users to selectively capture only the outputs they need from multi-output functions.
Key changes:
- Enhanced the lexer to recognize and handle tilde placeholders in destructuring assignments
- Modified evaluator to skip variable assignment for placeholder identifiers
- Replaced manual "dummy" variables with tilde syntax throughout the codebase
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| modules/interpreter/src/include/LexerContext.hpp | Added placeholder identifier tracking, constants, and helper function to identify placeholder variables |
| modules/interpreter/src/cpp/NelsonLexer.cpp | Implemented tilde detection logic including destructuring pattern recognition and placeholder generation |
| modules/interpreter/src/cpp/EvaluatorFunction.cpp | Modified multi-function call handling to skip variable insertion/display for placeholders |
| modules/interpreter/src/cpp/EvaluatorAssignment.cpp | Modified assignment to skip variable operations for placeholder identifiers |
| modules/interpreter/tests/test_tilde_output.m | Added comprehensive test cases covering valid/invalid tilde usage patterns |
| modules/interpreter/help/en_US/xml/ignore_outputs_function.xml | Added English documentation for the tilde syntax feature |
| modules/interpreter/help/fr_FR/xml/ignore_outputs_function.xml | Added French documentation for the tilde syntax feature |
| modules/statistics/functions/@tdigest/compress.m | Replaced dummy variable with tilde syntax |
| modules/random/functions/randperm.m | Replaced dummy variable with tilde syntax |
| modules/graphics/functions/spy.m | Replaced void variable with tilde syntax |
| modules/control_system/functions/*.m | Replaced dummy/void variables with tilde syntax across multiple files |
| CHANGELOG.md | Documented the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Nelson-numerical-software
force-pushed
the
ignore-output-function
branch
from
November 11, 2025 15:12
a5a57d8 to
27e68b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.