Skip to content

Wrong data structure created for array of choices #104

@diniska

Description

@diniska

First example

It generates code that doesn't compile:

grammar Example

offOrOn = ("0" | "1")+

generates:

public struct Example: Codable {
    public let offOrOn : OffOrOn
    ...
}

Second example

It generates the structure that won't be able to represent the parsed string:

grammar Example

off = "0"
on = "1"

mix = (off | on)+

result:

public struct Example: Codable {
    
    // Mix
    public enum Mix: Codable {
        case on(on:[Swift.String])
        case off(off:[Swift.String])
    }
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions