Beispiel #1
0
        public override object VisitApply(MFSHParser.ApplyContext context)
        {
            //const String fcn = "VisitApply";
            MIApply apply = new MIApply(this.SourceName, context.Start.Line);

            apply.Name = context.NAME().GetText();


            foreach (MFSHParser.AnyStringContext varContext in context.anyString())
            {
                String s = (String)this.VisitChildren(varContext);
                apply.Parameters.Add(s);
            }

            apply.OnceFlag = (context.ONCE() != null);
            apply.Usings.AddRange(this.Usings);

            this.Current.Items.Add(apply);
            return(null);
        }
Beispiel #2
0
        public void MgrApplyTest()
        {
            MIPreFsh b = ParseTest("MgrApplyTest1.mfsh", out MFsh mfsh);

            Assert.True(b.Items.Count == 3);

            MIApply apply1 = (MIApply)b.Items[0];

            Assert.True(apply1.Name == "Macro1");
            Assert.True(apply1.Parameters.Count == 0);

            MIApply apply2 = (MIApply)b.Items[1];

            Assert.True(apply2.Name == "Macro2");
            Assert.True(apply2.Parameters.Count == 0);

            MIApply apply3 = (MIApply)b.Items[2];

            Assert.True(apply3.Name == "Macro3");
            Assert.True(apply3.Parameters.Count == 3);
            Assert.True(apply3.Parameters[0] == "a");
            Assert.True(apply3.Parameters[1] == "bb");
            Assert.True(apply3.Parameters[2] == "ccc");
        }