Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +2 −1 Original line number Diff line number Diff line Loading @@ -1162,8 +1162,9 @@ TTCN3ReferenceList: // TODO: improve references // StructFieldRef | ArrayOrBitRef | ParRef; // ParRef -> RefValue //TODO: check if SubTypeDefNamed is really needed here FieldReference: StructFieldDef | FormalValuePar | SubTypeDefNamed; StructFieldDef | FormalValuePar | UnionFieldDef | SubTypeDefNamed; ArrayOrBitRef: SQUAREOPEN FieldOrBitNumber SQUARECLOSE; Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +62 −42 Original line number Diff line number Diff line Loading @@ -12,9 +12,12 @@ import de.ugoe.cs.swe.tTCN3.EnumDef import de.ugoe.cs.swe.tTCN3.EnumDefNamed import de.ugoe.cs.swe.tTCN3.Enumeration import de.ugoe.cs.swe.tTCN3.EnumerationList import de.ugoe.cs.swe.tTCN3.FunctionDef import de.ugoe.cs.swe.tTCN3.FunctionDefList import de.ugoe.cs.swe.tTCN3.FunctionFormalPar import de.ugoe.cs.swe.tTCN3.FunctionFormalParList import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.InLineTemplate import de.ugoe.cs.swe.tTCN3.Initial import de.ugoe.cs.swe.tTCN3.ModuleControlPart import de.ugoe.cs.swe.tTCN3.ModuleDefinition Loading @@ -26,7 +29,7 @@ import de.ugoe.cs.swe.tTCN3.PortElement import de.ugoe.cs.swe.tTCN3.RecordDefNamed import de.ugoe.cs.swe.tTCN3.RecordOfDefNamed import de.ugoe.cs.swe.tTCN3.RefValue import de.ugoe.cs.swe.tTCN3.ReferencedType import de.ugoe.cs.swe.tTCN3.RefValueElement import de.ugoe.cs.swe.tTCN3.SetDefNamed import de.ugoe.cs.swe.tTCN3.SetOfDefNamed import de.ugoe.cs.swe.tTCN3.SignatureDef Loading @@ -34,29 +37,24 @@ import de.ugoe.cs.swe.tTCN3.SingleConstDef import de.ugoe.cs.swe.tTCN3.SingleTempVarInstance import de.ugoe.cs.swe.tTCN3.SingleVarInstance import de.ugoe.cs.swe.tTCN3.StatementBlock import de.ugoe.cs.swe.tTCN3.StructDefBody import de.ugoe.cs.swe.tTCN3.StructFieldDef import de.ugoe.cs.swe.tTCN3.StructuredTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed import de.ugoe.cs.swe.tTCN3.TTCN3Module import de.ugoe.cs.swe.tTCN3.TemplateDef import de.ugoe.cs.swe.tTCN3.TemplateOrValueFormalPar import de.ugoe.cs.swe.tTCN3.TemplateOrValueFormalParList import de.ugoe.cs.swe.tTCN3.TestcaseDef import de.ugoe.cs.swe.tTCN3.Type import de.ugoe.cs.swe.tTCN3.TypeDef import de.ugoe.cs.swe.tTCN3.UnionDefNamed import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import java.util.List import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.TTCN3Module import org.eclipse.xtext.scoping.IScope import de.ugoe.cs.swe.tTCN3.FunctionDef import static org.eclipse.xtext.scoping.Scopes.* import de.ugoe.cs.swe.tTCN3.TestcaseDef import de.ugoe.cs.swe.tTCN3.InLineTemplate import de.ugoe.cs.swe.tTCN3.RefValueElement import java.util.List class TTCN3ScopeHelper { Loading Loading @@ -341,48 +339,70 @@ class TTCN3ScopeHelper { } } def static Iterable<RefValueElement> scopeReferencedFields(ReferencedType type) { def static Iterable<RefValueElement> scopeReferencedFields(Type type) { val List<RefValueElement> list = newArrayList if (type instanceof RecordDefNamed) { type.body.scopeFieldsStructDefBody(list) } else if (type instanceof SetDefNamed) { type.body.scopeFieldsStructDefBody(list) } else if (type instanceof RecordOfDefNamed) { val Type originalType = findOriginalType(type) if (originalType == null) return list; val typeReference = originalType.ref if (typeReference instanceof RecordDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof SetDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof UnionDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof RecordOfDefNamed) { //TODO: implement! } else if (type instanceof SetOfDefNamed) { } else if (typeReference instanceof SetOfDefNamed) { //TODO: implement! } return list } def static void scopeFieldsStructDefBody(StructDefBody body, List<RefValueElement> list) { for (StructFieldDef f : body.defs) { list.add(f) } } def static void templateFieldScope(TemplateDef template, ArrayList<EObject> list) { val type = template.base.type val type = findOriginalType(template.base.type) if (type != null && type.ref != null && typeof(RecordDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as RecordDefNamed).body.defs) } if (type != null && type.ref != null && typeof(UnionDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as UnionDefNamed).body.defs) } if (type != null && type.ref != null && typeof(SignatureDef).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as SignatureDef).paramList.params) } } def static void templateFieldScope(InLineTemplate template, ArrayList<EObject> list) { val type = template.type val type = findOriginalType(template.type) if (type != null && type.ref != null && typeof(RecordDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as RecordDefNamed).body.defs) } if (type != null && type.ref != null && typeof(UnionDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as UnionDefNamed).body.defs) } if (type != null && type.ref != null && typeof(SignatureDef).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as SignatureDef).paramList.params) } } // TODO: consider nested types private def static Type findOriginalType(Type type) { if (type != null && type.ref != null && typeof(SubTypeDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as SubTypeDefNamed).type) } else if (type != null && type.ref != null && typeof(RecordOfDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as RecordOfDefNamed).type) } else if (type != null && type.ref != null && typeof(SetOfDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as SetOfDefNamed).setType) } else { return type; } } def static void componentScopePorts(ComponentDef component, ArrayList<EObject> list) { for (ComponentDefList l : component.defs.filter[it.element.port != null]) { for (PortElement e : l.element.port.instances) { Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +10 −10 Original line number Diff line number Diff line Loading @@ -75,11 +75,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val fieldRef = field.ref if (fieldRef instanceof StructFieldDef) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } else if (fieldRef instanceof FormalValuePar) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } } else if (inlineTemplate != null) { Loading @@ -89,7 +89,7 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { template.templateFieldScope(list) scopeFor(list) } else if (variable != null && variable.type.ref != null) { scopeFor(variable.type.ref.scopeReferencedFields) scopeFor(variable.type.scopeReferencedFields) } } Loading @@ -104,11 +104,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val fieldRef = cField.fieldRef if (fieldRef instanceof StructFieldDef) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } else if (fieldRef instanceof FormalValuePar) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } } else if (inlineTemplate != null) { Loading @@ -118,7 +118,7 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { template.templateFieldScope(list) scopeFor(list) } else if (variable != null && variable.type.ref != null) { scopeFor(variable.type.ref.scopeReferencedFields) scopeFor(variable.type.scopeReferencedFields) } } Loading Loading @@ -278,21 +278,21 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { if (template instanceof SingleTempVarInstance) { val variable = template.findDesiredParent(VarInstance) if (variable != null && variable.type.ref != null) { variable.type.ref.scopeReferencedFields variable.type.scopeReferencedFields } } else if (template instanceof BaseTemplate) { template.type.ref.scopeReferencedFields template.type.scopeReferencedFields } } private def Iterable<RefValueElement> directFieldElements(FieldReference field) { if (field instanceof StructFieldDef) { if (field.type != null) { field.type.ref.scopeReferencedFields field.type.scopeReferencedFields } } else if (field instanceof FormalValuePar) { if (field.type != null) { field.type.ref.scopeReferencedFields field.type.scopeReferencedFields } } } Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/TTCN3StatisticsProvider.java +18 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ public class TTCN3StatisticsProvider { private Map<String, List<String>> importedModules = Maps.newHashMap(); private int parsedLines; private long parseTime; private long analyzeTime; private int countUniversal; private int countGeneral; private int countNaming; Loading Loading @@ -182,4 +184,20 @@ public class TTCN3StatisticsProvider { parsedLines += lines; } public long getParseTime() { return parseTime; } public void addParseTime(long pareTime) { this.parseTime += pareTime; } public long getAnalyzeTime() { return analyzeTime; } public void addAnalyzeTime(long analyzeTime) { this.analyzeTime += analyzeTime; } } de.ugoe.cs.swe.TTCN3Configuration/src/de/ugoe/cs/swe/common/MiscTools.java +9 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,14 @@ public class MiscTools { return string; } public static String secondsToString(long seconds) { int minutes = (int)seconds / 60; int remainder = (int)seconds % 60; DecimalFormat fmt = new DecimalFormat("00"); String string = minutes + ":" + fmt.format(remainder); return string; } public static String getSubPath(String inputPath) { String subPath = ""; File input = new File(getProperInputPath(inputPath)); Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/GenerateTTCN3.mwe2 +6 −6 File changed.Contains only whitespace changes. Show changes Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +2 −1 Original line number Diff line number Diff line Loading @@ -1162,8 +1162,9 @@ TTCN3ReferenceList: // TODO: improve references // StructFieldRef | ArrayOrBitRef | ParRef; // ParRef -> RefValue //TODO: check if SubTypeDefNamed is really needed here FieldReference: StructFieldDef | FormalValuePar | SubTypeDefNamed; StructFieldDef | FormalValuePar | UnionFieldDef | SubTypeDefNamed; ArrayOrBitRef: SQUAREOPEN FieldOrBitNumber SQUARECLOSE; Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +62 −42 Original line number Diff line number Diff line Loading @@ -12,9 +12,12 @@ import de.ugoe.cs.swe.tTCN3.EnumDef import de.ugoe.cs.swe.tTCN3.EnumDefNamed import de.ugoe.cs.swe.tTCN3.Enumeration import de.ugoe.cs.swe.tTCN3.EnumerationList import de.ugoe.cs.swe.tTCN3.FunctionDef import de.ugoe.cs.swe.tTCN3.FunctionDefList import de.ugoe.cs.swe.tTCN3.FunctionFormalPar import de.ugoe.cs.swe.tTCN3.FunctionFormalParList import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.InLineTemplate import de.ugoe.cs.swe.tTCN3.Initial import de.ugoe.cs.swe.tTCN3.ModuleControlPart import de.ugoe.cs.swe.tTCN3.ModuleDefinition Loading @@ -26,7 +29,7 @@ import de.ugoe.cs.swe.tTCN3.PortElement import de.ugoe.cs.swe.tTCN3.RecordDefNamed import de.ugoe.cs.swe.tTCN3.RecordOfDefNamed import de.ugoe.cs.swe.tTCN3.RefValue import de.ugoe.cs.swe.tTCN3.ReferencedType import de.ugoe.cs.swe.tTCN3.RefValueElement import de.ugoe.cs.swe.tTCN3.SetDefNamed import de.ugoe.cs.swe.tTCN3.SetOfDefNamed import de.ugoe.cs.swe.tTCN3.SignatureDef Loading @@ -34,29 +37,24 @@ import de.ugoe.cs.swe.tTCN3.SingleConstDef import de.ugoe.cs.swe.tTCN3.SingleTempVarInstance import de.ugoe.cs.swe.tTCN3.SingleVarInstance import de.ugoe.cs.swe.tTCN3.StatementBlock import de.ugoe.cs.swe.tTCN3.StructDefBody import de.ugoe.cs.swe.tTCN3.StructFieldDef import de.ugoe.cs.swe.tTCN3.StructuredTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed import de.ugoe.cs.swe.tTCN3.TTCN3Module import de.ugoe.cs.swe.tTCN3.TemplateDef import de.ugoe.cs.swe.tTCN3.TemplateOrValueFormalPar import de.ugoe.cs.swe.tTCN3.TemplateOrValueFormalParList import de.ugoe.cs.swe.tTCN3.TestcaseDef import de.ugoe.cs.swe.tTCN3.Type import de.ugoe.cs.swe.tTCN3.TypeDef import de.ugoe.cs.swe.tTCN3.UnionDefNamed import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import java.util.List import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.TTCN3Module import org.eclipse.xtext.scoping.IScope import de.ugoe.cs.swe.tTCN3.FunctionDef import static org.eclipse.xtext.scoping.Scopes.* import de.ugoe.cs.swe.tTCN3.TestcaseDef import de.ugoe.cs.swe.tTCN3.InLineTemplate import de.ugoe.cs.swe.tTCN3.RefValueElement import java.util.List class TTCN3ScopeHelper { Loading Loading @@ -341,48 +339,70 @@ class TTCN3ScopeHelper { } } def static Iterable<RefValueElement> scopeReferencedFields(ReferencedType type) { def static Iterable<RefValueElement> scopeReferencedFields(Type type) { val List<RefValueElement> list = newArrayList if (type instanceof RecordDefNamed) { type.body.scopeFieldsStructDefBody(list) } else if (type instanceof SetDefNamed) { type.body.scopeFieldsStructDefBody(list) } else if (type instanceof RecordOfDefNamed) { val Type originalType = findOriginalType(type) if (originalType == null) return list; val typeReference = originalType.ref if (typeReference instanceof RecordDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof SetDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof UnionDefNamed) { list.addAll(typeReference.body.defs) } else if (typeReference instanceof RecordOfDefNamed) { //TODO: implement! } else if (type instanceof SetOfDefNamed) { } else if (typeReference instanceof SetOfDefNamed) { //TODO: implement! } return list } def static void scopeFieldsStructDefBody(StructDefBody body, List<RefValueElement> list) { for (StructFieldDef f : body.defs) { list.add(f) } } def static void templateFieldScope(TemplateDef template, ArrayList<EObject> list) { val type = template.base.type val type = findOriginalType(template.base.type) if (type != null && type.ref != null && typeof(RecordDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as RecordDefNamed).body.defs) } if (type != null && type.ref != null && typeof(UnionDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as UnionDefNamed).body.defs) } if (type != null && type.ref != null && typeof(SignatureDef).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as SignatureDef).paramList.params) } } def static void templateFieldScope(InLineTemplate template, ArrayList<EObject> list) { val type = template.type val type = findOriginalType(template.type) if (type != null && type.ref != null && typeof(RecordDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as RecordDefNamed).body.defs) } if (type != null && type.ref != null && typeof(UnionDefNamed).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as UnionDefNamed).body.defs) } if (type != null && type.ref != null && typeof(SignatureDef).isAssignableFrom(type.ref.class)) { list.addAll((type.ref as SignatureDef).paramList.params) } } // TODO: consider nested types private def static Type findOriginalType(Type type) { if (type != null && type.ref != null && typeof(SubTypeDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as SubTypeDefNamed).type) } else if (type != null && type.ref != null && typeof(RecordOfDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as RecordOfDefNamed).type) } else if (type != null && type.ref != null && typeof(SetOfDefNamed).isAssignableFrom(type.ref.class)) { findOriginalType((type.ref as SetOfDefNamed).setType) } else { return type; } } def static void componentScopePorts(ComponentDef component, ArrayList<EObject> list) { for (ComponentDefList l : component.defs.filter[it.element.port != null]) { for (PortElement e : l.element.port.instances) { Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +10 −10 Original line number Diff line number Diff line Loading @@ -75,11 +75,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val fieldRef = field.ref if (fieldRef instanceof StructFieldDef) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } else if (fieldRef instanceof FormalValuePar) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } } else if (inlineTemplate != null) { Loading @@ -89,7 +89,7 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { template.templateFieldScope(list) scopeFor(list) } else if (variable != null && variable.type.ref != null) { scopeFor(variable.type.ref.scopeReferencedFields) scopeFor(variable.type.scopeReferencedFields) } } Loading @@ -104,11 +104,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val fieldRef = cField.fieldRef if (fieldRef instanceof StructFieldDef) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } else if (fieldRef instanceof FormalValuePar) { if (fieldRef.type != null && fieldRef.type.ref != null) { scopeFor(fieldRef.type.ref.scopeReferencedFields) scopeFor(fieldRef.type.scopeReferencedFields) } } } else if (inlineTemplate != null) { Loading @@ -118,7 +118,7 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { template.templateFieldScope(list) scopeFor(list) } else if (variable != null && variable.type.ref != null) { scopeFor(variable.type.ref.scopeReferencedFields) scopeFor(variable.type.scopeReferencedFields) } } Loading Loading @@ -278,21 +278,21 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { if (template instanceof SingleTempVarInstance) { val variable = template.findDesiredParent(VarInstance) if (variable != null && variable.type.ref != null) { variable.type.ref.scopeReferencedFields variable.type.scopeReferencedFields } } else if (template instanceof BaseTemplate) { template.type.ref.scopeReferencedFields template.type.scopeReferencedFields } } private def Iterable<RefValueElement> directFieldElements(FieldReference field) { if (field instanceof StructFieldDef) { if (field.type != null) { field.type.ref.scopeReferencedFields field.type.scopeReferencedFields } } else if (field instanceof FormalValuePar) { if (field.type != null) { field.type.ref.scopeReferencedFields field.type.scopeReferencedFields } } } Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/TTCN3StatisticsProvider.java +18 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ public class TTCN3StatisticsProvider { private Map<String, List<String>> importedModules = Maps.newHashMap(); private int parsedLines; private long parseTime; private long analyzeTime; private int countUniversal; private int countGeneral; private int countNaming; Loading Loading @@ -182,4 +184,20 @@ public class TTCN3StatisticsProvider { parsedLines += lines; } public long getParseTime() { return parseTime; } public void addParseTime(long pareTime) { this.parseTime += pareTime; } public long getAnalyzeTime() { return analyzeTime; } public void addAnalyzeTime(long analyzeTime) { this.analyzeTime += analyzeTime; } }
de.ugoe.cs.swe.TTCN3Configuration/src/de/ugoe/cs/swe/common/MiscTools.java +9 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,14 @@ public class MiscTools { return string; } public static String secondsToString(long seconds) { int minutes = (int)seconds / 60; int remainder = (int)seconds % 60; DecimalFormat fmt = new DecimalFormat("00"); String string = minutes + ":" + fmt.format(remainder); return string; } public static String getSubPath(String inputPath) { String subPath = ""; File input = new File(getProperInputPath(inputPath)); Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/GenerateTTCN3.mwe2 +6 −6 File changed.Contains only whitespace changes. Show changes