/// <summary> /// This function will return true if it doesn't encounter any problems. /// </summary> /// <param name="node"></param> /// <param name="logErrors"></param> /// <returns></returns> public bool Analyse(Node node) { var result = true; string id = ""; QValueType type = QValueType.UNKNOWN; if (node.Type == NodeType.QUESTION) { var questionNode = (QuestionNode)node; id = questionNode.ID; type = questionNode.ValueType; return(AddVariable(id, type)); } else if (node.Type == NodeType.COMPUTED) { var computedNode = (ComputedNode)node; id = computedNode.ID; type = computedNode.ValueType; return(AddVariable(id, type)); } // Set result to false if any of the children encounters an error. foreach (Node child in node.Children) { if (!Analyse(child) && result) { result = false; } } return(result); }
public ComputedNode(Location location, string id, string text, QValueType valueType, IExpressionNode expression) : base(location, NodeType.COMPUTED) { this.ID = id; this.Text = text; this.ValueType = valueType; this.Expression = expression; }
/// <summary> /// This function adds a variable to the SymbolTable. In case of an error a message will /// be added to the analyser. /// </summary> /// <param name="id"></param> /// <param name="type"></param> public static bool Add(string id, QValueType type) { if (!Instance.TypeMap.ContainsKey(id)) { Instance.TypeMap.Add(id, type); return(true); } return(false); }
public bool AddVariable(string id, QValueType type) { if (!SymbolTable.Add(id, type)) { Analyser.AddMessage(string.Format("Duplicate identifier {0} {1}", id, type), MessageType.ERROR); return(false); } return(true); }
private bool AddVariable(string id, QValueType type) { VisitedIDs.Add(id); if (!SymbolTable.Add(id, type)) { Analyser.AddMessage(string.Format("Duplicate identifier {0} {1}", id, type), Language.QL, MessageType.ERROR); return(false); } return(true); }
public QLSStyle(QValueType type, QLSWidgetSpecification specification) : this(type) { this.WidgetSpecification = specification; }
public QLSStyle(QValueType type) : this() { this.QValueType = type; }
public QuestionNode(Location location, string id, string text, QValueType questionType) : base(location, NodeType.Question) { this.ID = id; this.Text = text; this.ValueType = questionType; }
public LiteralNode(Location location, string value, QValueType qValueType) : base(location, NodeType.LITERAL) { this.Value = value; this.QValueType = qValueType; }
public QLSValue(string property, string value, QValueType qValueType) { this.StyleProperty = property; this.StyleValue = value; this.QValueType = qValueType; }