Skip to content

for comprehension on new line inside collection #8

Description

@F1uctus

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 [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: parserRelated to Abstract Syntax Tree parsing pipelinelanguage syntaxquestionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions