protected PsudoMethod CompileMethod(PsudoMethodInfo mInfo, PsudoClassInfo pClassInfo, PsudoClass pClass)
        {
            PsudoMethod method = new PsudoMethod(mInfo.Name, pClass);

            mInfo.ParentClass = pClassInfo;
            mInfo.Processed   = true;

            if (mInfo.Name != "Main")
            {
                Match value = Regex.Match(codeLines[mInfo.StartLine],
                                          @"(?<=[(])[a-zA-Z0-9_,\s -]*(?=[)])",
                                          RegexOptions.IgnoreCase);

                string[] args = value.Value.Split(',');
                foreach (string arg in args)
                {
                    if (arg.Trim().Length > 0)
                    {
                        Match typeMatch = Regex.Match(arg,
                                                      @"(string|num)",
                                                      RegexOptions.IgnoreCase);
                        Match match = Regex.Match(arg,
                                                  @"(?<=(string|num))[\s]*[a-zA-Z0-9_-]*",
                                                  RegexOptions.IgnoreCase);
                        method.ArgumentTypes.Add(typeMatch.Value.Trim().ToLower());
                        method.ArgumentNames.Add(match.Value.Trim().ToLower());
                    }
                }
            }

            method.Instructions = CompileBlock(method, mInfo.StartLine, mInfo.EndLine);
            return(method);
        }
 public PsudoVariableInfo(string name, string type, int line)
 {
     this.Name         = name;
     this.Type         = type;
     this.Line         = line;
     this.Processed    = false;
     this.ParentClass  = null;
     this.ParentMethod = null;
     this.Default      = null;
 }
        private void FindMethods()
        {
            this.methodInfo = new List <PsudoMethodInfo>();

            PsudoMethodInfo curMethod = null;

            for (int i = 0; i < lineTypes.Length; i++)
            {
                switch (lineTypes[i])
                {
                case PsudoLineType.StartMethod:
                    if (curMethod != null)
                    {
                        this.errors.Add(new CompileError(
                                            "Cannot Start Method Inside Body of another method", i));
                    }
                    else
                    {
                        //Match match = Regex.Match(codeLines[i],
                        //    @"(?<=(void|string|num))[\s]*[a-zA-Z0-9_-]*[\s]*(?=\()*",
                        //    RegexOptions.IgnoreCase);
                        curMethod = new PsudoMethodInfo(codeLines[i].Trim().ToLower(), i);
                    }

                    break;

                case PsudoLineType.EndMethod:
                    if (curMethod == null)
                    {
                        this.errors.Add(new CompileError(
                                            "Return statement Found outside a method", i));
                    }
                    else
                    {
                        curMethod.EndLine = i;
                        this.methodInfo.Add(curMethod);
                        curMethod = null;
                    }
                    break;

                default:
                    break;
                }
            }
        }