//Interface public LabelStoreNode(string text, int imageIndex, int selectedImageIndex, LabelStore labelStore) : base(text, imageIndex, selectedImageIndex) { //Constructor try { this.mLabelStore = labelStore; this.mLabelStore.StoreChanged += new EventHandler(OnStoreChanged); } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Label Store Node instance.", ex); } }
private int EvaluateExpression(string source, KeyValuePair<string, int>[] labels = null) { var labelStore = new LabelStore(); if (labels != null) { foreach (var pair in labels) { labelStore.AddLabel(new Label(pair.Key, pair.Value)); } } return EvaluateExpression(source, labelStore); }
private int EvaluateExpression(string source, LabelStore labelStore) { var resolver = new ExpressionResolver(labelStore); var parser = new Parser(resolver); bool success = parser.ParseExpression(source); if (!success) { Assert.Inconclusive("Cannot parse expression " + source); } return resolver.Evaluate(); }
public void REF_operator_has_higher_priority_than_mult() { var store = new LabelStore(); store.AddReferencedLabel("L1", -1); Assert.AreEqual(2, EvaluateExpression(".REF L1 * 2", store)); Assert.AreEqual(2, EvaluateExpression(".REF L1 + 1", store)); Assert.AreEqual(1, EvaluateExpression(".REF L1 = 1", store)); Assert.AreEqual(1, EvaluateExpression(".REF L1 .AND 1", store)); }
public void Can_evaluate_expression_with_REF_operator_when_label_is_referenced() { var store = new LabelStore(); store.AddReferencedLabel("L1", -1); Assert.AreEqual(1, EvaluateExpression(".REF L1", store)); }
public LabelLayer(IGraphicFactory graphicFactory, LabelStore labelStore) { this.labelStore = labelStore; this.matrix = graphicFactory.CreateMatrix(); }
private Label[] ResolveLabels(string source) { var labelStore = new LabelStore(); return ResolveLabels(source, labelStore); }
private Label[] ResolveLabels(string source, LabelStore labelStore) { var resolver = new InstructionResolver(labelStore, new MacroStore()); var parser = new Parser(resolver); parser.Parse(source); return labelStore.ToArray(); }