eMoflon / emoflon-neo

A Neo4j-based implementation of eMoflon
Eclipse Public License 2.0
6 stars 2 forks source link

eMSL generation faulty when using enums #313

Closed dwolters closed 1 year ago

dwolters commented 1 year ago

When enums are used in models, the generated rules wrap enum values in quotes, which should not be the case. Here is minimal example to verify the problem:

metamodel MM1 {
    Node {
        .colour: COLOUR
    }
    enum COLOUR{
        BLUE
        RED
    }
}
model mm1 {
    n: Node {
        .colour: BLUE 
    }
}
metamodel MM2 {
    Vertex {
        .colour: EString
    }
}
tripleGrammar EnumProblem {
    source {
        MM1
    }
    target {
        MM2
    }
    correspondence {
        Node <-NodeToVertex-> Vertex
    }
    rules {
        Node2Vertex
    }
}
tripleRule Node2Vertex : EnumProblem {
    source {
        ++n: Node {
            .colour := BLUE
        }
    }
    target {
        ++v: Vertex {
            .colour := "Blue"
        }
    }
    correspondence {
        ++n <-:NodeToVertex->v
    }
}

Add this to a .msl file and the generated code will contain error due to the enum value wrapped in quotes.