/// <summary> /// Expands all pathes which lead to the selected variable /// </summary> /// <param name="variableSelector"></param> private void ExpandAndShowVariable(VariableSelector variableSelector) { // Build the complete tree explainTreeView.SuspendLayout(); explainTreeView.CollapseAll(); List <ExplanationPart> path = new List <ExplanationPart>(); InnerExpandAndShowVariable(Explanation, variableSelector, path); explainTreeView.ResumeLayout(); explainTreeView.Focus(); }
/// <summary> /// Inner primitive to expand nodes, based on a tree node /// </summary> /// <param name="explanation"></param> /// <param name="variableSelector"></param> /// <param name="path"></param> private void InnerExpandAndShowVariable(ExplanationPart explanation, VariableSelector variableSelector, List <ExplanationPart> path) { path.Add(explanation); if (variableSelector.Match(explanation)) { foreach (ExplainTreeNode node in explainTreeView.Nodes) { node.ShowPath(path, 0); } } foreach (ExplanationPart subExplanation in explanation.SubExplanations) { InnerExpandAndShowVariable(subExplanation, variableSelector, path); } path.Remove(explanation); }
public override void ExitSelector(OberonGrammarParser.SelectorContext context) { if (context.referenceId == null) // variable not found { return; } var vs = new VariableSelector(null); vs.AddRange(context._i.Select(selElement => selElement.selRet)); if (!vs.Any()) { return; } if (context.referenceId.Type.Type.HasFlag(BaseTypes.Simple)) { _parser.NotifyErrorListeners(context.start, "Simple variables or constants do not allow any selector", null); return; } var type = context.referenceId.Type; foreach (var v in vs) { switch (v) { case IdentifierSelector selector: selector.TypeDefinition = type = CheckRecordSelector(selector, type); break; case IndexSelector indexSelector: indexSelector.TypeDefinition = type = CheckArrayIndexSelector(indexSelector, type); break; } } vs.SelectorResultType = type; context.vsRet = vs; }
public static Expression Create(Declaration declaration, VariableSelector s) { if (declaration == null) { return(null); } if (declaration is ConstDeclaration c) { return(c.Value); } var e = new VariableReferenceExpression { Name = declaration.Name, Declaration = declaration, TargetType = s?.SelectorResultType ?? declaration.Type, Selector = s }; return(e); }
private void BindVariables() { // Get all the variables of the study. List <object[]> variables = Global.Core.Variables.GetValues( new string[] { "Id" }, new string[] { "IdStudy" }, new object[] { this.IdStudy } ); // Run through all variables of the study. foreach (object[] variable in variables) { VariableSelector variableSelector = new VariableSelector( 2057, "Variables", "Id=" + variable[0], true ); variableSelector.Settings.EnableCategorize = true; pnlVariables.Controls.Add(variableSelector); } }
/// <summary> /// Inner primitive to expand nodes, based on a tree node /// </summary> /// <param name="explanation"></param> /// <param name="variableSelector"></param> /// <param name="path"></param> private void InnerExpandAndShowVariable(ExplanationPart explanation, VariableSelector variableSelector, List<ExplanationPart> path) { path.Add(explanation); if (variableSelector.Match(explanation)) { foreach (ExplainTreeNode node in explainTreeView.Nodes) { node.ShowPath(path, 0); } } foreach (ExplanationPart subExplanation in explanation.SubExplanations) { InnerExpandAndShowVariable(subExplanation, variableSelector, path); } path.Remove(explanation); }
/// <summary> /// Expands all pathes which lead to the selected variable /// </summary> /// <param name="variableSelector"></param> private void ExpandAndShowVariable(VariableSelector variableSelector) { // Build the complete tree explainTreeView.SuspendLayout(); explainTreeView.CollapseAll(); List<ExplanationPart> path = new List<ExplanationPart>(); InnerExpandAndShowVariable(Explanation, variableSelector, path); explainTreeView.ResumeLayout(); explainTreeView.Focus(); }