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

Inconsistency between if and elseif parsing #15763

Closed
Keno opened this issue Apr 4, 2016 · 6 comments
Closed

Inconsistency between if and elseif parsing #15763

Keno opened this issue Apr 4, 2016 · 6 comments
Assignees
Labels
parser Language parsing and surface syntax

Comments

@Keno
Copy link
Member

Keno commented Apr 4, 2016

This is legal syntax:

if
false
end

but this is not:

if
false
elseif
true
end

(missing condition in elseif). It seems like either both should be allowed or both disallowed.

@Keno Keno added the parser Language parsing and surface syntax label Apr 4, 2016
@lobingera
Copy link

i got in several places the comment: Julia syntax is correct, if the parser accepts it (no, there is no formal syntax definition). So why not just accepting this?

@JeffBezanson
Copy link
Sponsor Member

The way we encode the syntax, and what we want the syntax to be, are totally separate issues. It's perfectly possible to specify an undesirable syntax in BNF.

@JeffBezanson
Copy link
Sponsor Member

I suppose we should deprecate if<newline>.

@StefanKarpinski
Copy link
Sponsor Member

I suspect you can just make it an error – I really doubt a lot of people are using this syntax.

@Keno
Copy link
Member Author

Keno commented Apr 8, 2016

There are definitely uses of it in packages as I had disallowed this in JuliaParser and it came up while running against all packages, so a deprecation is in order.

JeffBezanson added a commit that referenced this issue Apr 10, 2016
fix #15763, disallow newline immediately after `if`
@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Jul 26, 2016

For this (and in general), is JuliaParser.jl thought of? I do not see a commit here (or a label for it, similar to "backport to 0.4"..).

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

No branches or pull requests

5 participants