コード例 #1
0
        public override string VisitQProcedureCall([NotNull] QPILE_converterV2Parser.QProcedureCallContext context)
        {
            if (context.MESSAGE() != null)
            {
                var argList1 = Visit(context.children[2]);
                return(AddSpaces("message" + " (" + argList1 + ")"));
            }

            if (context.DELETE_ALL_ITEMS() != null)
            {
                return(AddSpaces("isCleared = Clear (0)"));
            }

            if (context.ADD_ITEM() != null)
            {
                var index = Visit(context.children[2]);
                return(AddSpaces("rowNumber = InsertRow (0, " + index + ")"));
            }

            return(base.VisitQProcedureCall(context));
        }
コード例 #2
0
        public override string VisitQProcedureCall([NotNull] QPILE_converterV2Parser.QProcedureCallContext context)
        {
            if (context.MESSAGE() != null)
            {
                var argList1 = Visit(context.children[2]);
                return(AddSpaces("message" + " (" + argList1 + ")"));
            }

            if (context.SET_ROW_COLOR_EX() != null)
            {
                var row_number                = Visit(context.children[2]);
                var background_color          = context.children[4].GetText();
                var selected_background_color = context.children[6].GetText();
                var font_color                = context.children[8].GetText();
                var selected_font_color       = context.children[10].GetText();
                var b_color     = background_color;
                var f_color     = font_color;
                var sel_b_color = selected_background_color;
                var sel_f_color = selected_font_color;
                b_color     = b_color.Remove(b_color.Length - 1);
                b_color     = b_color.Substring(1);
                f_color     = f_color.Remove(f_color.Length - 1);
                f_color     = f_color.Substring(1);
                sel_b_color = sel_b_color.Remove(sel_b_color.Length - 1);
                sel_b_color = sel_b_color.Substring(1);
                sel_f_color = sel_f_color.Remove(sel_f_color.Length - 1);
                sel_f_color = sel_f_color.Substring(1);
                return(AddSpaces("SetColor" + " (" + table + ", " + row_number + ", " + b_color + ", " + f_color + ", " + sel_b_color + ", " + sel_f_color + ")"));

                return(AddSpaces("`" + context.GetText()));
            }

            if (context.DELETE_ITEM() != null)
            {
                var index = context.children[2].GetText();
                return(AddSpaces("DeleteRow(" + table + ", " + index + ")"));
            }

            if (context.DELETE_ALL_ITEMS() != null)
            {
                return(AddSpaces("isCleared = Clear (0)"));
            }

            if (context.ADD_ITEM() != null)
            {
                var    index        = Visit(context.children[2]);
                var    table_string = context.children[4].GetText();
                string res          = "InsertRow (" + table + ",INDEX)\n    a=0\n    for key,value in pairs(table_string)\n";
                res += "    do\n        " + "for i=1,#ParameterNames do\n           if(ParameterNames[i] == key) then a=i\n           end\n        end\n" +
                       "        if(type(value)==" + '"' + "string" + '"' + ") then\n            SetCell(" + table + ",INDEX,a,tostring(value))\n";
                res += "        else\n            SetCell(" + table + ",INDEX,a,tostring(value),value)\n        end\n";
                res += "    end";
                if (methods.Contains("AddItem(INDEX, table_string)\n    " + res + "\nend") == false)
                {
                    methods += "function AddItem(INDEX, table_string)\n    " + res + "\nend\n";
                }
                return(AddSpaces("AddItem(" + index.ToString() + ", " + table_string + ")"));

                return(AddSpaces("`" + context.GetText()));
            }

            if (context.MODIFY_ITEM() != null)
            {
                var    index        = Visit(context.children[2]);
                var    table_string = context.children[4].GetText();
                string res          = "i=1\n    for key,value in pairs(table_string)\n";
                res += "    do\n        if(type(value)==" + '"' + "string" + '"' + ") then\n            SetCell(" + table + ",INDEX,i,tostring(value))\n";
                res += "        else\n            SetCell(" + table + ",INDEX,i,tostring(value),value)\n        end\n";
                res += "        i=i+1\n    end";
                if (methods.Contains("ModifyItem(INDEX, table_string)\n    " + res + "\nend") == false)
                {
                    methods += "function ModifyItem(INDEX, table_string)\n    " + res + "\nend\n";
                }
                return(AddSpaces("Modify(" + index.ToString() + ", " + table_string + ")"));

                return(AddSpaces("`" + context.GetText()));
            }

            return(base.VisitQProcedureCall(context));
        }