コード例 #1
0
ファイル: globals.cs プロジェクト: jpheary/Argix08
 //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); }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 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));
 }
コード例 #6
0
 public LabelLayer(IGraphicFactory graphicFactory, LabelStore labelStore)
 {
     this.labelStore = labelStore;
     this.matrix     = graphicFactory.CreateMatrix();
 }
コード例 #7
0
        private Label[] ResolveLabels(string source)
        {
            var labelStore = new LabelStore();

            return ResolveLabels(source, labelStore);
        }
コード例 #8
0
        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();
        }