Example #1
0
        public void ParseIf(ITree tree)
        {
            BGIValue bGIValue = new BGIValue(tree.GetChild(0));

            Output.Write((short)3);
            bGIValue.Output();
            long position = Mstream.Position;

            Output.Write(0);
            OutputTree(tree.GetChild(1));
            Output.Write((short)6);
            long position2 = Mstream.Position;

            Output.Write(0);
            long position3 = Mstream.Position;

            Mstream.Seek(position, SeekOrigin.Begin);
            Output.Write((int)position3);
            Mstream.Seek(position3, SeekOrigin.Begin);
            OutputTree(tree.GetChild(2));
            long position4 = Mstream.Position;

            Mstream.Seek(position2, SeekOrigin.Begin);
            Output.Write((int)position4);
            Mstream.Seek(position4, SeekOrigin.Begin);
        }
Example #2
0
        public void OutputUnary(BinaryWriter output)
        {
            BGIValue bGIValue = new BGIValue(baseTree.GetChild(0));

            output.Write((short)Type);
            bGIValue.Output();
        }
Example #3
0
        public void OutputMath(BinaryWriter output)
        {
            BGIValue bGIValue  = new BGIValue(baseTree.GetChild(0));
            BGIValue bGIValue2 = new BGIValue(baseTree.GetChild(1));

            output.Write((short)Type);
            output.Write((short)mathType);
            bGIValue.Output();
            bGIValue2.Output();
        }
Example #4
0
        public void ParseAssignment(ITree tree)
        {
            OutputCmd(BurikoCommands.Assignment);
            ITree    child    = tree.GetChild(0);
            BGIValue bGIValue = new BGIValue(child);

            bGIValue.Output();
            ITree    child2    = tree.GetChild(1);
            BGIValue bGIValue2 = new BGIValue(child2);

            bGIValue2.Output();
        }
Example #5
0
        public void OutputVar(BinaryWriter output)
        {
            output.Write((short)Type);
            output.Write(tree.Text);
            int num = 1;

            if (baseTree.ChildCount <= 1)
            {
                output.Write((short)2);
                output.Write(-1);
                output.Write(value: false);
            }
            else
            {
                ITree child = baseTree.GetChild(num);
                if (child.Text == "INDEX")
                {
                    BGIValue bGIValue = new BGIValue(child.GetChild(0));
                    bGIValue.Output();
                    num++;
                }
                else
                {
                    output.Write((short)2);
                    output.Write(-1);
                }
                if (baseTree.ChildCount <= num)
                {
                    output.Write(value: false);
                }
                else
                {
                    ITree child2 = baseTree.GetChild(num);
                    if (child2.Text == "MEMBER")
                    {
                        output.Write(value: true);
                        ITree    child3    = child2.GetChild(0);
                        BGIValue bGIValue2 = new BGIValue(child3);
                        bGIValue2.Output();
                    }
                    else
                    {
                        output.Write(value: false);
                    }
                }
            }
        }
Example #6
0
        public void ParseVarDecl(ITree tree)
        {
            OutputCmd(BurikoCommands.Declaration);
            string text  = tree.GetChild(0).Text;
            ITree  child = tree.GetChild(1);
            string text2 = child.GetChild(0).Text;

            Output.Write(text);
            Output.Write(text2);
            if (child.ChildCount > 1)
            {
                ITree child2 = child.GetChild(1);
                if (child2.Text != "INDEX")
                {
                    throw new Exception($"{child2.Line}: Invalid variable declaration!");
                }
                BGIValue bGIValue = new BGIValue(child2.GetChild(0));
                bGIValue.Output();
            }
            else
            {
                Output.Write((short)1);
            }
        }