Skip to content

feat: enhance lexer with ignore outputs function [~, S, ~] = svd(A) - #1484

Merged
Nelson-numerical-software merged 1 commit into
masterfrom
ignore-output-function
Nov 11, 2025
Merged

Nelson-numerical-software merged 1 commit into
masterfrom
ignore-output-function

Conversation

@Nelson-numerical-software

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Nelson-numerical-software merged commit 31445b1 into master Nov 11, 2025
1 check passed
@Nelson-numerical-software
Nelson-numerical-software deleted the ignore-output-function branch November 11, 2025 19:29
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.

2 participants