Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +9 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,13 @@ ExtFunctionDef: return=ReturnType?; ExtConstDef: EXTKEYWORD CONSTKEYWORD type=Type id=IdentifierList; EXTKEYWORD CONSTKEYWORD type=Type id=IdentifierObjectList; IdentifierObjectList: ids+=NamedObject (COMMA ids+=NamedObject)*; NamedObject: name=IDENTIFIER; ImportDef: IMPORTKEYWORD FROMKEYWORD name=IDENTIFIER spec=LanguageSpec? RECURSIVEKEYWORD? (all=AllWithExcepts | LBRACKET Loading Loading @@ -881,7 +887,7 @@ TempVarList: variables+=SingleTempVarInstance (COMMA variables+=SingleTempVarInstance)*; TimerVarInstance: SingleVarInstance | FormalTimerPar; SingleVarInstance | FormalTimerPar | ComponentDef; SingleVarInstance: name=IDENTIFIER array=ArrayDef? (ac=ASSIGNMENTCHAR expr=Expression)?; Loading Loading @@ -1115,7 +1121,7 @@ ExtendedFieldReference: // SingleVarInstance contained in TimerVarInstance (according to EBNF rules) RefValue: ModuleParameter | FieldReference | FormalTemplatePar | SingleTempVarInstance | FunctionRef | TimerVarInstance | FormalPortPar | PortElement; FunctionRef | TimerVarInstance | FormalPortPar | PortElement | NamedObject; // IDENTIFIER omitted PredefinedValue: Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +26 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.xtext.scoping.IScope import static org.eclipse.xtext.scoping.Scopes.* import de.ugoe.cs.swe.tTCN3.ExtConstDef import de.ugoe.cs.swe.tTCN3.IdentifierObjectList class TTCN3ScopeHelper { Loading Loading @@ -148,6 +150,14 @@ class TTCN3ScopeHelper { } } defs = moduleDef.definitions.filter[it.def instanceof ExtConstDef] for (ModuleDefinition v : defs) { val constDefList = (v.def as ExtConstDef).id as IdentifierObjectList for (EObject d : constDefList.ids) { list.add(d) } } defs = moduleDef.definitions.filter[it.def instanceof TypeDef] for (ModuleDefinition v : defs) { val body = (v.def as TypeDef).body Loading Loading @@ -362,6 +372,22 @@ class TTCN3ScopeHelper { list } def static Iterable<RefValueElement> testcaseLocalParameter(TestcaseDef testcase) { val list = newArrayList if (testcase.parList == null) return list; for (p : testcase.parList.params) { if (p.value != null) { list.add(p.value) } else if (p.template != null) { list.add(p.template) } } list } def static Iterable<RefValueElement> altstepLocalParameter(AltstepDef altstep) { val list = newArrayList if (altstep.params == null) Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +16 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ import static org.eclipse.xtext.scoping.Scopes.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import static extension org.eclipse.xtext.EcoreUtil2.* import de.ugoe.cs.swe.tTCN3.ExtConstDef import de.ugoe.cs.swe.tTCN3.NamedObject class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { private final static Logger LOG = Logger.getLogger(TTCN3LocalScopeProvider); Loading Loading @@ -308,6 +310,15 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { } list.addAll(parent.eAllOfType(SingleVarInstance)) list.addAll(parent.functionLocalParameter) } else if (parent instanceof TestcaseDef) { if (parent.spec.runsOn != null) { componentScopeValueRefs(parent.spec.runsOn.component, list, true, false, false) } if (parent.spec.systemSpec != null) { componentScopeValueRefs(parent.spec.systemSpec.component, list, true, false, false) } list.addAll(parent.eAllOfType(SingleVarInstance)) list.addAll(parent.testcaseLocalParameter) } else if (parent instanceof ComponentDef) { for (ComponentDefList l : parent.defs) { if (l.element.timer != null) { Loading Loading @@ -710,6 +721,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { if (variable.type.ref != null) { variable.type.ref.scopeReferencedFields } } else if (value instanceof NamedObject) { val variable = value.findDesiredParent(ExtConstDef) if (variable.type.ref != null) { variable.type.ref.scopeReferencedFields } } } Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/NamingConventionsValidator.xtend +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class NamingConventionsValidator extends AbstractDeclarativeValidator { val regExp = activeProfile.namingConventionsConfig.extConstantRegExp; val INode node = NodeModelUtils.getNode(const) for (n : const.id.ids) { n.toString.checkIdentifierForNamingConventionCompliance(node, regExp, "External Constant") n.name.checkIdentifierForNamingConventionCompliance(node, regExp, "External Constant") } } Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/TTCN3.xtext +9 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,13 @@ ExtFunctionDef: return=ReturnType?; ExtConstDef: EXTKEYWORD CONSTKEYWORD type=Type id=IdentifierList; EXTKEYWORD CONSTKEYWORD type=Type id=IdentifierObjectList; IdentifierObjectList: ids+=NamedObject (COMMA ids+=NamedObject)*; NamedObject: name=IDENTIFIER; ImportDef: IMPORTKEYWORD FROMKEYWORD name=IDENTIFIER spec=LanguageSpec? RECURSIVEKEYWORD? (all=AllWithExcepts | LBRACKET Loading Loading @@ -881,7 +887,7 @@ TempVarList: variables+=SingleTempVarInstance (COMMA variables+=SingleTempVarInstance)*; TimerVarInstance: SingleVarInstance | FormalTimerPar; SingleVarInstance | FormalTimerPar | ComponentDef; SingleVarInstance: name=IDENTIFIER array=ArrayDef? (ac=ASSIGNMENTCHAR expr=Expression)?; Loading Loading @@ -1115,7 +1121,7 @@ ExtendedFieldReference: // SingleVarInstance contained in TimerVarInstance (according to EBNF rules) RefValue: ModuleParameter | FieldReference | FormalTemplatePar | SingleTempVarInstance | FunctionRef | TimerVarInstance | FormalPortPar | PortElement; FunctionRef | TimerVarInstance | FormalPortPar | PortElement | NamedObject; // IDENTIFIER omitted PredefinedValue: Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +26 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.xtext.scoping.IScope import static org.eclipse.xtext.scoping.Scopes.* import de.ugoe.cs.swe.tTCN3.ExtConstDef import de.ugoe.cs.swe.tTCN3.IdentifierObjectList class TTCN3ScopeHelper { Loading Loading @@ -148,6 +150,14 @@ class TTCN3ScopeHelper { } } defs = moduleDef.definitions.filter[it.def instanceof ExtConstDef] for (ModuleDefinition v : defs) { val constDefList = (v.def as ExtConstDef).id as IdentifierObjectList for (EObject d : constDefList.ids) { list.add(d) } } defs = moduleDef.definitions.filter[it.def instanceof TypeDef] for (ModuleDefinition v : defs) { val body = (v.def as TypeDef).body Loading Loading @@ -362,6 +372,22 @@ class TTCN3ScopeHelper { list } def static Iterable<RefValueElement> testcaseLocalParameter(TestcaseDef testcase) { val list = newArrayList if (testcase.parList == null) return list; for (p : testcase.parList.params) { if (p.value != null) { list.add(p.value) } else if (p.template != null) { list.add(p.template) } } list } def static Iterable<RefValueElement> altstepLocalParameter(AltstepDef altstep) { val list = newArrayList if (altstep.params == null) Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +16 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ import static org.eclipse.xtext.scoping.Scopes.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import static extension org.eclipse.xtext.EcoreUtil2.* import de.ugoe.cs.swe.tTCN3.ExtConstDef import de.ugoe.cs.swe.tTCN3.NamedObject class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { private final static Logger LOG = Logger.getLogger(TTCN3LocalScopeProvider); Loading Loading @@ -308,6 +310,15 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { } list.addAll(parent.eAllOfType(SingleVarInstance)) list.addAll(parent.functionLocalParameter) } else if (parent instanceof TestcaseDef) { if (parent.spec.runsOn != null) { componentScopeValueRefs(parent.spec.runsOn.component, list, true, false, false) } if (parent.spec.systemSpec != null) { componentScopeValueRefs(parent.spec.systemSpec.component, list, true, false, false) } list.addAll(parent.eAllOfType(SingleVarInstance)) list.addAll(parent.testcaseLocalParameter) } else if (parent instanceof ComponentDef) { for (ComponentDefList l : parent.defs) { if (l.element.timer != null) { Loading Loading @@ -710,6 +721,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { if (variable.type.ref != null) { variable.type.ref.scopeReferencedFields } } else if (value instanceof NamedObject) { val variable = value.findDesiredParent(ExtConstDef) if (variable.type.ref != null) { variable.type.ref.scopeReferencedFields } } } Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/NamingConventionsValidator.xtend +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class NamingConventionsValidator extends AbstractDeclarativeValidator { val regExp = activeProfile.namingConventionsConfig.extConstantRegExp; val INode node = NodeModelUtils.getNode(const) for (n : const.id.ids) { n.toString.checkIdentifierForNamingConventionCompliance(node, regExp, "External Constant") n.name.checkIdentifierForNamingConventionCompliance(node, regExp, "External Constant") } } Loading