Book a Demo

Author Topic: Grammer and types  (Read 5072 times)

Ralf

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Grammer and types
« on: April 28, 2014, 07:09:54 am »
while trying to create a groovy MDG, I created a grammer which is able to parse my code.
The debugger shows me the correct type of my attributes in the AST viewer, however, when I import source, the model only shows the name, not the type of the attribute.

Any idea what could be wrong or how I could further debug this?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Grammer and types
« Reply #1 on: April 28, 2014, 09:52:16 am »
How is the grammar returning the type information? It seems likely that you're not returning it in the way EA is expecting to find it.

Ralf

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Grammer and types
« Reply #2 on: April 28, 2014, 03:16:04 pm »
I used the SSL demo grammar as a starting point:

Code: [Select]
<attributeDeclaration>      ::= node("FIELD", <attributeVisibility> node("TYPE", <attributeType>) node("DECLARATOR", <attributeName>) [<attributeDefault>] [";"]);

<attributeVisibility>      ::= attribute("SCOPE", "public") |
                        attribute("SCOPE", "protected") |
                        attribute("SCOPE", "private") |
                        attributeEx("SCOPE", "public");

<attributeType>            ::= attribute("TYPE", <typeName>);

The AST result says something like

Field (Scope = private)
   Type = BigInteger

so, it seems to be right
« Last Edit: April 28, 2014, 04:08:22 pm by FloydDread »

Ralf

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Grammer and types
« Reply #3 on: April 29, 2014, 05:08:02 am »
OK. found the problem. The following page explains what the AST has to produce:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/context_labels.html

with this, I was able to figure out my problem...