Exemplo n.º 1
0
        public virtual node_field_info ToNodeFieldInfo(Dictionary <string, node_info> nodeNames)
        {
            var nodeField = new node_field_info();

            InitFieldInfo(nodeField, nodeNames);
            return(nodeField);
        }
Exemplo n.º 2
0
        private void subnodes_DoubleClick(object sender, System.EventArgs e)
        {
            int t = subnodes.SelectedIndex;

            if (t < 0)
            {
                return;
            }
            simple_element se = subnodes.Items[t] as simple_element;

            if (se != null)
            {
                subnodes.Items[t] = simple_node_editor.edit_element(se, ni, ng);
                return;
            }
            // node_field_info должен быть последним
            node_field_info nfi = subnodes.Items[t] as node_field_info;

            if (nfi != null)
            {
                subnode_editor.edit_field(nfi, ng, ni);
                return;
            }
            return;
        }
Exemplo n.º 3
0
        private void add_subnode_Click(object sender, System.EventArgs e)
        {
            get_node_info();
            node_field_info nfi = subnode_editor.edit_field(null, ng, ni);

            if (nfi != null)
            {
                subnodes.Items.Add(nfi);
            }
        }
Exemplo n.º 4
0
        public static node_field_info edit_field(node_field_info nfi, NodeGenerator.NodeGenerator ng, node_info this_node)
        {
            subnode_editor se = new subnode_editor(ng, nfi, this_node);

            if (se.ShowDialog() == DialogResult.Cancel)
            {
                snfi.field_name = "";
            }
            return(snfi);
        }
Exemplo n.º 5
0
        public static node_field_info edit_field(node_field_info nfi, NodeGenerator.NodeGenerator ng, node_info this_node)
        {
            subnode_editor se = new subnode_editor(ng, nfi, this_node);

            se.ShowDialog();

            /*if (se.ShowDialog()==DialogResult.OK)
             * {
             *      return snfi;
             * }*/
            return(snfi);
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            NodeGenerator.NodeGenerator ng = new NodeGenerator.NodeGenerator();

            ng.factory_name   = "nodes_factory";
            ng.file_name      = "f1.cs";
            ng.namespace_name = "fnm";
            ng.visitor_interface_file_name = "vis.cs";

            node_info nb = new node_info();

            nb.node_name = "base_node";
            node_info n1 = new node_info();

            n1.node_name  = "if_node";
            n1.base_class = nb;
            node_info n2 = new node_info();

            n2.node_name  = "condition";
            n2.base_class = nb;
            node_info n3 = new node_info();

            n3.node_name  = "body";
            n3.base_class = n2;

            node_field_info nf11 = new node_field_info();

            nf11.field_name = "first";
            nf11.field_type = n2;
            n1.add_subnode(nf11);

            node_field_info nf12 = new node_field_info();

            nf12.field_name = "second";
            nf12.field_type = n3;
            n1.add_subnode(nf12);

            node_field_info nf21 = new node_field_info();

            nf21.field_name = "third";
            nf21.field_type = n1;
            n2.add_subnode(nf21);

            ng.add_node(nb);
            ng.add_node(n1);
            ng.add_node(n2);
            ng.add_node(n3);

            ng.generate_code();
            ng.generate_visitor_interface_code();
            ng.generate_visitor_template("vis1", "vis_templ.cs");
        }
Exemplo n.º 7
0
        private void add_subnode_Click(object sender, System.EventArgs e)
        {
            get_node_info();
            node_field_info nfi = subnode_editor.edit_field(null, ng, ni);

            if (nfi != null && nfi.field_name != null)
            {
                nfi.field_name = nfi.field_name.Trim();
                if (!nfi.field_name.Equals(""))
                {
                    subnodes.Items.Add(nfi);
                }
            }
        }
Exemplo n.º 8
0
        private void get_node_info()
        {
            if (nfi == null)
            {
                nfi = new node_field_info();
            }
            nfi.field_name = field_name.Text;

            int t = subnodes_types.SelectedIndex;

            if (t < 0)
            {
                return;
            }
            nfi.field_type = (node_info)subnodes_types.Items[t];

            ngen.help_storage.get_help_context(ninf.node_name + "." + nfi.field_name).help_context = this.help_context.Text;
        }
Exemplo n.º 9
0
        public subnode_editor(NodeGenerator.NodeGenerator ng, node_field_info nfi, node_info this_node)
        {
            InitializeComponent();
            ngen     = ng;
            this.nfi = nfi;

            subnodes_types.Items.Clear();
            subnodes_types.Items.AddRange((object[])ngen.all_nodes.ToArray(typeof(object)));

            if (ngen.all_nodes.IndexOf(this_node) < 0)
            {
                subnodes_types.Items.Insert(0, this_node);
            }

            if (this.nfi == null)
            {
                this.nfi            = new node_field_info();
                this.nfi.field_type = (node_info)ng.all_nodes[0];
            }

            ninf = this_node;
            snfi = this.nfi;
            set_node_info();
        }
Exemplo n.º 10
0
 private void ok_Click(object sender, System.EventArgs e)
 {
     get_node_info();
     snfi = nfi;
 }
Exemplo n.º 11
0
 protected void InitFieldInfo(node_field_info nodeField, Dictionary <string, node_info> nodeNames)
 {
     nodeField.field_name = Name;
     nodeField.field_type = SyntaxType == null ? null : nodeNames[SyntaxType];
 }
Exemplo n.º 12
0
 public SyntaxField(node_field_info field)
 {
     Name       = field.field_name;
     SyntaxType = field.field_type?.node_name;
 }