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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uminus improvements. #3498

Merged
merged 1 commit into from
Nov 2, 2023
Merged

Uminus improvements. #3498

merged 1 commit into from
Nov 2, 2023

Conversation

toots
Copy link
Member

@toots toots commented Oct 30, 2023

This PR improves unitary minus by adding support for any - <expr> via a top-level precedence. This fixes #3405

The other part of these changes add } to our manual unitary minus hack. This hack is because our grammar:

  • Ignores new lines
  • Supports <expr> - <expr> and - <expr>

This means that, the following expressions are the same:

x
-123

and:

x - 123

However, what we really have been doing since the beginning is treating line return as an expression separator. This is the same reason we differentiate between:

def f(x, y)
  true
 end

and:

def f
  (x,y )
  true
end

My recommendation for future improvements would be:

  • Find a way to bring back line return as expression separator
  • Force all def functions to use =

BTW, we also support ; for expression separator.. 馃檪

@toots toots requested a review from smimram October 30, 2023 23:31
@toots toots force-pushed the uminus-improvements branch 2 times, most recently from 939dc4f to e95d15f Compare October 31, 2023 05:33
@toots toots marked this pull request as ready for review October 31, 2023 14:38
toots added a commit to savonet/tree-sitter-liquidsoap that referenced this pull request Oct 31, 2023
toots added a commit to savonet/codemirror-lang-liquidsoap that referenced this pull request Oct 31, 2023
@toots toots added this pull request to the merge queue Nov 2, 2023
Merged via the queue into main with commit 2bf7288 Nov 2, 2023
25 checks passed
@toots toots deleted the uminus-improvements branch November 2, 2023 13:43
toots added a commit that referenced this pull request Nov 2, 2023
toots added a commit that referenced this pull request Nov 2, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 2, 2023
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.

Unary minus operation with variables
1 participant