Enteee / plantuml-parser

Parse PlantUML with JavaScript or TypeScript
https://duckpond.ch/category/plantuml-parser
Apache License 2.0
138 stars 33 forks source link

Create a class entry for implicitly defined UML classes #85

Closed songyang-dev closed 2 years ago

songyang-dev commented 2 years ago

Some plantuml code only has statements between UML classes like this

LiteralExp <|-- TemplateExp

The left-right members of the association are not explicitly stated as classes using the class keyword. It would be nice if the parsed json result from this tool treats this as an implicitly defined class. The json should have a class entry like this, in addition to the left-right entry.

"elements": [
        {
          "name": "LiteralExp",
          "title": "LiteralExp",
          "isAbstract": false,
          "members": [],
          "extends_": [],
          "implements_": [],
          "generics": [],
          "stereotypes": []
        },
]
Enteee commented 2 years ago

If I understand you correct, you would like the parser to infer the existence of a class (LiteralExp) because of the simple fact that there exists a relationship between LiteralExp and TemplateExp. Thinking about it, this is a bit much logic for a parser and not really something I would like to implement in the core.

But you could implement this functionality yourself in a custom formatter.

Leaving this open for now, maybe I misunderstood you.

songyang-dev commented 2 years ago

You understood me correctly. It's fine if you don't want to implement this. I wanted to bring this parser a bit more high-level.

Enteee commented 2 years ago

yeah I don't think I will implement that. Sorry. Feel free to ask questions if you need help building a formatter.