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

allow unicode modifiers after ' #37247

Merged
merged 1 commit into from
Oct 16, 2020

Conversation

simeonschaub
Copy link
Member

@simeonschaub simeonschaub commented Aug 27, 2020

As discussed in the triage call, this is technically breaking because we currently parse a'ᵀ as a' * ᵀ and a'ᵀb as a' * ᵀb, but it doesn't look like this is actually used in the wild. Still needs news.

fixes #34507

base/show.jl Outdated Show resolved Hide resolved
@@ -1241,7 +1241,18 @@
(if (ts:space? s)
(error (string "space not allowed before \"" t "\"")))
(take-token s)
(loop (list t ex)))
(let* ((port (ts:port s))
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This should be handled in the lexer, by removing ' from the no-suffix list, then the parser test needs to be changed to use a SuffSet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Won't this cause any issues with character literals? Or is that handled differently?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could use read-operator directly for this though.

Copy link
Member Author

Choose a reason for hiding this comment

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

This should be handled in the lexer, by removing ' from the no-suffix list, then the parser test needs to be changed to use a SuffSet.

When I remove ctrans-op form the no-suffix list, 'ᵀ' parses as (|'| |'ᵀ|), so there needs to be an additional argument to read-operator when parsing a call chain vs when starting to parse a new atom.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Oops, you're right.

@JeffBezanson JeffBezanson added the needs news A NEWS entry is required for this change label Sep 4, 2020
@JeffBezanson
Copy link
Sponsor Member

One thing to think about is whether isoperator should return true for these.

@simeonschaub
Copy link
Member Author

That's a good point! I think it should return true, because to the user, it acts just like ' does. I would say whether (operator? t) is true is mostly an implementation detail of the parser, but that for all practical purposes 'ᵀ is also an operator.

@simeonschaub
Copy link
Member Author

simeonschaub commented Sep 5, 2020

Should I just change the Julia function isoperator, or should I add a check to the C function jl_is_operator to return true here?

Copy link
Member Author

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

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

Other than my comment I think this should be good to go.

base/show.jl Show resolved Hide resolved
@simeonschaub
Copy link
Member Author

@JeffBezanson Sorry for bothering you, but would you be willing to take another look and merge if ok?

@simeonschaub
Copy link
Member Author

Bump. 🙂

@JeffBezanson
Copy link
Sponsor Member

Looks good, just needs a rebase.

@JeffBezanson JeffBezanson added status:merge me PR is reviewed. Merge when all tests are passing and removed needs news A NEWS entry is required for this change labels Oct 15, 2020
@simeonschaub
Copy link
Member Author

Ok?

@JeffBezanson JeffBezanson merged commit 8407c59 into JuliaLang:master Oct 16, 2020
@simeonschaub simeonschaub deleted the unicode_postfix branch October 16, 2020 19:54
@simeonschaub simeonschaub mentioned this pull request Nov 1, 2020
@tlienart tlienart mentioned this pull request Nov 2, 2020
ViralBShah added a commit that referenced this pull request Nov 10, 2020
There's also a bunch of issue links that are missing (#37410, #37247, #37540, #37973, #37461, #37753) but it seems there's a script that generates the links so I'm assuming that will be fixed automatically.

Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
achuchmala pushed a commit to achuchmala/julia that referenced this pull request Nov 11, 2020
There's also a bunch of issue links that are missing (JuliaLang#37410, JuliaLang#37247, JuliaLang#37540, JuliaLang#37973, JuliaLang#37461, JuliaLang#37753) but it seems there's a script that generates the links so I'm assuming that will be fixed automatically.

Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Jan 11, 2021
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.

Unicode modifiers for adjoint operator
3 participants