Repository navigation
Expand file tree
/
Copy pathMCSimpleGenericTypes.mc4
More file actions
56 lines (44 loc) · 1.7 KB
/
Copy pathMCSimpleGenericTypes.mc4
File metadata and controls
56 lines (44 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.types;
/* This is a MontiCore stable grammar.
* Adaptations -- if any -- are conservative. */
import de.monticore.types.*;
/**
* This grammar introduces freely defined generic types
* such as Blubb<A>, Bla<B,C>, Foo<Blubb<D>>
*
* These generics are covering a wide range of uses for generic types,
* although they don't cover type restrictions on the arguments, like in
* Java.
*
* This eases the reuse of type structures in languages similar to Java,
* that are somewhat simplified.
*
* This grammar is part of a hierarchy of types, namely
* * types.MCBasicTypes.mc4
* * types/MCArrayTypes.mc4
* * types/MCCollectionTypes.mc4
* * types/MCSimpleGenericTypes.mc4
* * types/MCFullGenericTypes.mc4
*
*/
component grammar MCSimpleGenericTypes
extends MCCollectionTypes {
/*=================================================================*/
/** ASTMCCollectionTypesType represents class or interface
* types which could have a qualified name like this: a.b.C<Arg>.
*
* Any number of arguments is possible.
*
* @attribute name Name of the type
* @attribute typeArgumentList The types between '<...>'
*/
MCBasicGenericType implements MCGenericType <20> =
(Name || ".")+ "<" (MCTypeArgument || ",")* ">";
/*=================================================================*/
/** ASTMCCustomTypeArgument allows all MCTypes as TypeArguments.
* This extension of the imported grammar is conservative, and it
* enables recursive Generics e.g. List<Map<String, socnet.Person>>
*/
MCCustomTypeArgument implements MCTypeArgument <20> = MCType;
}