internal (TextObject, bool) GetVariableValueAsTextObject( string variableName, TextObject parent) { TextObject variable; if (parent != null && parent.GetVariableValue(variableName, out variable) || this._variables.TryGetValue(variableName, out variable)) { return(variable, true); } if (parent != null) { variable = TextProcessingContext.FindNestedFieldValue(parent.Value, variableName); } return(variable == null || variable.Length != 0 ? (variable, true) : (new TextObject("{=!}ERROR: " + variableName + " variable has not been set before."), false)); }
internal MultiStatement GetVariableValue(string variableName, TextObject parent) { TextObject variable = (TextObject)null; MBTextModel mbTextModel = (MBTextModel)null; if (parent == null || !parent.GetVariableValue(variableName, out variable)) { this._variables.TryGetValue(variableName, out variable); } if (variable != null) { mbTextModel = MBTextParser.Parse(MBTextManager.Tokenizer.Tokenize(variable.ToString())); } if (mbTextModel == null) { return((MultiStatement)null); } return(mbTextModel.RootExpressions.Count == 1 && mbTextModel.RootExpressions[0] is MultiStatement ? new MultiStatement((IEnumerable <TextExpression>)(mbTextModel.RootExpressions[0] as MultiStatement).SubStatements) : new MultiStatement((IEnumerable <TextExpression>)mbTextModel.RootExpressions)); }