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

for comprehension on new line inside collection #8

Open
F1uctus opened this issue Jul 10, 2019 · 0 comments
Open

for comprehension on new line inside collection #8

F1uctus opened this issue Jul 10, 2019 · 0 comments
Labels
area: parser Related to Abstract Syntax Tree parsing pipeline language syntax question Further information is requested

Comments

@F1uctus
Copy link
Collaborator

F1uctus commented Jul 10, 2019

https://github.com/F1uctus/Axion/blob/a4e33355a629f7ea6c3ebc9428a596b23f94355b/Axion.Core/Processing/Syntactic/Expression.cs#L424-L429

There is a check, that for keyword is not placed at new line, to resolve that code:
Axion:

<expression>
for x in y
    code()

not to be parsed as for comprehension (<expression> for x in y).

But also, for is allowed to be placed in that context:

(float(f)
   for a in l
     ...
       for f in e
         unless e.length == 0)

and, because of newline check, we must write it like:

(float(f) for a in l
            ...
              for f in e
                unless e.length == 0)

so, for allowed to be placed on new line if it's invoked by function, that parses
collection expression embraced in (), {} or [].

@F1uctus F1uctus added area: parser Related to Abstract Syntax Tree parsing pipeline language syntax question Further information is requested labels Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: parser Related to Abstract Syntax Tree parsing pipeline language syntax question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant