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

preserve elseif syntax in parser #23122

Merged
merged 1 commit into from
Aug 4, 2017
Merged

preserve elseif syntax in parser #23122

merged 1 commit into from
Aug 4, 2017

Conversation

JeffBezanson
Copy link
Member

Part of #21774. I think this change is particularly useful, since

  • macros like @static should be able to handle elseif chains; elseifs are arguably part of the same outermost expression and so should all be evaluated in the same stage
  • much nicer representation from show
  • it's very minimally breaking, since it only changes the interior of if blocks, and :elseif expressions are semantically identical to if expressions

@JeffBezanson JeffBezanson added breaking This change will break code parser Language parsing and surface syntax labels Aug 3, 2017
(begin0 (list 'if test then (parse-block s))
(expect-end s word)))
(begin0 (list word test then (parse-block s))
(expect-end s 'if)))
Copy link
Member

Choose a reason for hiding this comment

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

just curious: why didn't you keep this as "word"? Seems like that elseif may be more accurate in the error message, although the actual impact is quite minimal either way?

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously word was always if, so I did this to keep the same error message. I could go either way on this though.

@tkelman
Copy link
Contributor

tkelman commented Aug 4, 2017

https://github.com/JuliaLang/julia/blob/09f059a2d719cd1f7d052ccd40782200d4998097/doc/src/devdocs/ast.md#block-forms needs updating, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code parser Language parsing and surface syntax
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants