lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

Failure to generate diagram in PlantUML converted files #63

Closed ronaldtse closed 3 years ago

ronaldtse commented 3 years ago
image

It seems that the converter includes the <CR> symbols and outputs them, which crashes LutaML:

diagram IsoDoc_IsoBibliographicItem {

  class BibliographicItem <<Bibliography>> {

  }

  class IsoBibliographicItem{
      +docIdentifier: IsoDocumentId

Trace:

lutaml-uml models/IsoDoc_IsoBibliographicItem.lutaml 
Traceback (most recent call last):
    10: from /Users/me/.rbenv/versions/2.6.6/bin/lutaml-uml:23:in `<main>'
     9: from /Users/me/.rbenv/versions/2.6.6/bin/lutaml-uml:23:in `load'
     8: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/exe/lutaml-uml:21:in `<top (required)>'
     7: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/interface/base.rb:11:in `run'
     6: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/interface/command_line.rb:83:in `run'
     5: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/interface/command_line.rb:83:in `each'
     4: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/interface/command_line.rb:91:in `block in run'
     3: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/parsers/dsl.rb:18:in `parse'
     2: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.8/lib/lutaml/uml/parsers/dsl.rb:23:in `parse'
     1: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/parslet-1.7.1/lib/parslet/atoms/base.rb:49:in `parse'
/Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/parslet-1.7.1/lib/parslet/cause.rb:70:in `raise': Failed to match sequence (WHITESPACE? DIAGRAM_DEFINITION) at line 1 char 1. (Parslet::ParseFailed
ronaldtse commented 3 years ago

Actually it still doesn't work after removing <CR> symbols. Will await @w00lf for investigation.

ronaldtse commented 3 years ago

The actual code is here: https://github.com/metanorma/metanorma-model-iso/pull/60

w00lf commented 3 years ago

The actual code is here: metanorma/metanorma-model-iso#60

The error was because of a redundant <<enumeration>> keyword on enum type entity:

enum <<enumeration>> {
....

Removed it, pushed changes

ronaldtse commented 3 years ago

@w00lf thanks! Can the LutaML parser throw out the exact error so the user knows how to fix it?

w00lf commented 3 years ago

@w00lf thanks! Can the LutaML parser throw out the exact error so the user knows how to fix it?

I am looking for a way to do that, the library that we are using for dsl parsing - parslet does allow it, but its not trivial to configure

w00lf commented 3 years ago

@ronaldtse created an enhancement task for that

ronaldtse commented 3 years ago

Thanks @w00lf ! Let's close this then.