florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
160 stars 21 forks source link

Support new language features of 2021a #190

Closed florianschanda closed 3 years ago

florianschanda commented 3 years ago

Taken from the official release notes:

MATLAB supports a new syntax for passing name-value arguments. In the new syntax, the name and value arguments are connected by an equal sign, and the name is not enclosed in quotes.

Name=value syntax: plot(x,y,LineWidth=2) Comma-separated syntax: plot(x,y,"LineWidth",2)

The recommended practice is to use only one syntax in any given function call. However, if you do mix name=value and name,value syntaxes in a single call, all name=value arguments must appear after the name,value arguments. For example, plot(x,y,"Color","red",LineWidth=2) is a valid combination, but plot(x,y,Color="red","LineWidth",2) errors.

Similarly, name=value arguments must appear after all positional arguments. Calling myFunction(name=value,posArgument) errors.

The name=value syntax can only be used directly in function calls. They cannot be wrapped in a cell array or additional parentheses. Calling myFunction(a,(name=value)) errors.