blob: fc605059e2bb4d1af84bf1e7314332d07f41d1f5 [file] [log] [blame]
[module template_for_1('http://www.eclipse.org/emf/2002/Ecore')/]
[comment simple "for" example to test minimal for statement /]
[template public testingSimple(c : EPackage)]
[file ('testForSimple', false)]
[for (cl : EClassifier | c.eClassifiers)]
[cl.name/]
[/for]
[/file]
[/template]
[comment simple "for" example to test "separator" keyword /]
[template public testingSeparator(c : EPackage)]
[file ('testForSeparator', false)]
[for (cl : EClassifier | c.eClassifiers) separator ('/') ]
[cl.name/]
[/for]
[/file]
[/template]
[comment simple "for" example to test "before" keyword /]
[template public testingBefore(c : EPackage)]
[file ('testForBefore', false)]
[for (cl : EClassifier | c.eClassifiers) before ('before test') ]
[cl.name/]
[/for]
[/file]
[/template]
[comment simple "for" example to test "after" keyword/]
[template public testingAfter(c : EPackage)]
[file ('testForAfter', false)]
[for (cl : EClassifier | c.eClassifiers) after ('after test') ]
[cl.name/]
[/for]
[/file]
[/template]
[comment simple "for" example to test "guard" keyword /]
[template public testingGuard(c : EPackage)]
[file ('testForGuard', false)]
[for (cl : EClassifier | c.eClassifiers) ? (cl.name.startsWith('S'))]
[cl.name/]
[/for]
[/file]
[/template]
[comment Init is not implemented yet]
[template public testingInit(c : EPackage)]
[file ('test', false)]
[for (cl : EClassifier | c.eClassifiers) { starter: EString = 'test'; }]
[cl.name/]
[/for]
[/file]
[/template]
[/comment]
[comment simple use of the "i" variable /]
[template public testingI(c : EPackage)]
[file ('testForI', false)]
[for (cl : EClassifier | c.eClassifiers)][i/][/for]
[/file]
[/template]
[comment simple use of the "i" variable in a separator/]
[template public testingISeparator(c : EPackage)]
[file ('testForISeparator', false)]
[for (cl : EClassifier | c.eClassifiers) separator(i)]yop[/for]
[/file]
[/template]
[comment simple use of the "i" variable in a before/]
[template public testingIBefore(c : EPackage)]
[file ('testForIBefore', false)]
[for (cl : EClassifier | c.eClassifiers) before(i)]yop[/for]
[/file]
[/template]
[comment simple use of the "i" variable in an after/]
[template public testingIAfter(c : EPackage)]
[file ('testForIAfter', false)]
[for (cl : EClassifier | c.eClassifiers) after(i)]yop[/for]
[/file]
[/template]
[comment use of the "i" variable/]
[template public testingIAll(c : EPackage)]
[file ('testForIAll', false)]
[for (cl : EClassifier | c.eClassifiers) before(i) separator(i) after(i)]yop[/for]
[/file]
[/template]
[template public testingComplexFor(c : EClass) {name : String = '';}]
[file ('test', false)]
[if (c.name <> 'ClasseB')]Nothing should be generated here if the for guard is evaluated correctly[/if]
value of 'name' outside of for: '[name/]' (should be empty)
[for (a : EAttribute | c.eAllAttributes) before ('before') separator ('in-between') after('after') ? (name.substring(name.size(), name.size()) = 'B') {name : String = c.name;}]
value of 'name' inside first for: '[name/]' (should be '[c.name/]')
[for (cl : EClassifier | a.eType) {name : String = a.name;}]
value of 'name' inside second for: '[name/]' (should be '[a.name/]')
[/for]
value of 'name' inside first for: '[name/]' (should be '[c.name/]')
[/for]
value of 'name' outside of for: '[name/]' (should be empty)
[/file]
[/template]