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

Improve arguments blocks handling (Matlab) #179

Closed

Conversation

oswald3141
Copy link
Contributor

arguments is context-dependent in Matlab: sometimes it's a valid identifier, and sometimes it's a keyword. This PR:

  • adds support for multiple sequential arguments blocks;
  • prevents a function argument named "arguments" from being treated as a keyword;
  • fixes a bug in handling arguments blocks in one line functions (the syntax is probably not used in the real world);
  • fixes a bug due to which a semicolon before an arguments block could break folding.

The corresponding tests are included.

"arguments" is a valid function argument name. It should not be
recognized as a keyword in a function declaration line.
Matlab allows multiple sequential arguments blocks
imposing restrictions on different kinds of arguments.
A semicolon must behave the same as a comment between a function
declaration line and and an arguments block beginning.
A semicolon must end a function declaration even if there's no
following line break.
@nyamatongwe nyamatongwe added the matlab Caused by the matlab or octave lexer label Jun 26, 2023
@nyamatongwe nyamatongwe changed the title Imrove arguments blocks handling (Matlab) Improve arguments blocks handling (Matlab) Jun 26, 2023
nyamatongwe pushed a commit that referenced this pull request Jun 27, 2023
"arguments" is a valid function argument name. It should not be
recognized as a keyword in a function declaration line.
nyamatongwe pushed a commit that referenced this pull request Jun 27, 2023
Matlab allows multiple sequential arguments blocks
imposing restrictions on different kinds of arguments.
nyamatongwe pushed a commit that referenced this pull request Jun 27, 2023
A semicolon must behave the same as a comment between a function
declaration line and and an arguments block beginning.
A semicolon must end a function declaration even if there's no
following line break.
@nyamatongwe nyamatongwe added the committed Issue fixed in repository but not in release label Jun 27, 2023
@nyamatongwe
Copy link
Member

Committed with additions to history file.

@oswald3141
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
committed Issue fixed in repository but not in release matlab Caused by the matlab or octave lexer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants