google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

Allow lists of attributes after a type name to be consistent with other C-family languages #355

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Allow

class X {
  Integer a,b;
}

and

class X {
  Integer a, b;
}

to initialize two variables.

Currently the former raises error 130 and the latter generates 'extra code'.. 
This is to be consistent with C-family languages

Original issue reported on code.google.com by TimothyCLethbridge on 21 Nov 2012 at 8:06

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 1 May 2013 at 2:04

GoogleCodeExporter commented 9 years ago
Essentially this should just require modifying the parser to generate new 
tokens, then changing metamodel parsing so the generated code is identical to 
the case where it was:

Integer a;
Integer b;

Testing should be done for a list of three or more items, different Umple 
datatypes, and different non-umple datatypes.

Original comment by TimothyCLethbridge on 1 May 2013 at 2:06

GoogleCodeExporter commented 9 years ago
A few issues prevent this to be as straighforward as it should be. The main one 
being:

- Irregular behavior when parsing a grammar rule with optional clauses. To 
reproduce this do the following:
In the umple_classes.grammar file, erase all attribute rules except 
simpleAttribute. Change the [[simpleAttribute]] clause to be like 
"simpleAttribute- : [name] [=foo:foo]? ;" (without quotes). In the .ump file to 
be compiled, inside a class, notice that when "foo" is present (ie. "attribute 
foo;"), the simple attribute is recognized and parsed, but when "foo" is not 
present (ie. "attribute;"), the line is not recognized and it's parsed as extra 
code.

Since the current rules for attributes use the [type,name>1,0] clause, this 
(supposed) problem is avoided, but it prevents the rewriting to something like:

complexAttribute- : [=unique]? [=lazy]? 
[=modifier:immutable|settable|internal|defaulted|const]? [type]? [=list:[]]? 
[~name] ( , [~name] )* (= [**value])? ;

As this is marked as low-priority, I'll wait for the confirmation from a 
different developer and get back to it later.

Original comment by atojet on 18 Jun 2013 at 2:01

GoogleCodeExporter commented 9 years ago
Issue 415 has been merged into this issue.

Original comment by TimothyCLethbridge on 4 Sep 2013 at 4:34

GoogleCodeExporter commented 9 years ago
I have raised the priority of this, as it should be doable and would be useful

Original comment by TimothyCLethbridge on 5 Sep 2014 at 2:51

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 5 Sep 2014 at 2:51

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 9 Sep 2014 at 5:09