bool ClassState(string input) { MatchCollection m = mMethodRx.Matches(input); if (m.Count > 0) { mState = MethodState; mReturnType = ""; } m = mEndBraceRx.Matches(input); if (m.Count > 0) { DumpBuffer(); mState = NullState; } return true; }
public void Parse(string path) { Console.WriteLine("Starting parsing"); mState = NullState; StreamReader file = new StreamReader(path); mOutFile = new StreamWriter(path + ".out"); mOutBuf = new Queue<string>(); string line; while ((line = file.ReadLine()) != null) { ++mLineNum; mOutBuf.Enqueue(line); if (!mState(line)) { break; } } mOutFile.Flush(); }
bool MethodState(string input) { MatchCollection m = mReturnTypeRx.Matches(input); if (m.Count > 0) { mReturnType = m[0].Groups[1].Value; return true; } m = mMethodNameRx.Matches(input); if (m.Count > 0) { if (mClass != mReturnType && mReturnType == "InDesign.PageItem") { ReplaceReturnType(); } return true; } m = mEndBraceRx.Matches(input); if (m.Count > 0) { DumpBuffer(); mState = ClassState; } return true; }
bool NullState(string input) { MatchCollection m = mClassRx.Matches(input); if (m.Count > 0) { mClass = m[0].Groups[1].Value; mState = ClassState; } return true; }