public ArrayList ParseFile(string filePath) { ArrayList al = new ArrayList(); PlsqlObject o = new PlsqlObject(); //filePath = @"e:\oracle\lrc_plsql_parser.pkb"; filePath = @"C:\Documents and Settings\K.FS7020\My Documents\My Dropbox\PlSQLParser\TestData"; o.name = "func"; o.packageName = "funcPkg"; o.type = PlsqlObjectType.PackageBody; o.fileName = "file.tx"; al.Add(o); return al; }
PlsqlObject extractObject(string startingline) { PlsqlObject o = new PlsqlObject(); var j = @"\b(?<type>(procedure|function))\b \s+ \b(?<name>\w+)\b"; MatchCollection m = Regex.Matches(startingline, j, RegexOptions.IgnoreCase |RegexOptions.IgnorePatternWhitespace); o.name = m[0].Groups["name"].Value; //\s*(procedure)\s*(\w)? \(?.* // .*(\bprocedure\b)\s*(\b\w*\b).* //o.name = startingline.Substring(i + 1); //o.name = m[1].Result(); var t = m[0].Groups["type"].Value; if (t.ToUpper() == "PROCEDURE") o.type = PlsqlObjectType.Procedure; else if (t.ToUpper() == "FUNCTION") o.type = PlsqlObjectType.Function; else throw new Exception("Unknow PlsqlObjectType"); o.lineNumberStarting = _counter + 1; o.fileName = _fileToParse; o.schemaName = _schemaName; o.parameters = GetParametersFromUnitDeclaration(_counter + 1); return o; }