public static string CreateSpaceCode(ParseNamespace namespaceInterface) { return("package " + namespaceInterface.GetName() + "\n\n"); }
bool parse(string data) { data = Regex.Replace(data, @"\/\/[^\n]*", ""); data = Regex.Replace(data, @"[\n\r\t]", ""); data = Regex.Replace(data, @"\s{2,}", ""); string[] classes = Regex.Split(data, @"[@\}]"); if (classes.Length == 0) { throw new System.Exception("parse classes is failed, no class struct!!"); } // foreach (string c in classes) { string[] symbolFlag = c.Split('{'); if (symbolFlag.Length != 2) { continue; } string[] symbolAttr = symbolFlag[0].Split(":"); if (symbolAttr.Length != 2) { throw new Exception("parse symbol attr is failed, symbol missing :, " + symbolFlag[0]); } IBParse idlParse; switch (symbolAttr[0]) { case Symbol.Struct: idlParse = new ParseStruct(); break; case Symbol.Interface: idlParse = new ParseInterface(); break; case Symbol.Namespace: idlParse = new ParseNamespace(); break; default: throw new Exception("parse symbol attr is error, symbol: " + symbolAttr[0]); } if (idlParse.Parse(m_fileName, symbolAttr[1].Trim(), symbolFlag[1].Trim())) { switch (symbolAttr[0]) { case Symbol.Struct: Vars.RegisterStruct(idlParse.GetName(), idlParse); break; case Symbol.Interface: Vars.RegisterInterface(idlParse.GetName(), idlParse); break; case Symbol.Namespace: Vars.RegisterNamespace(idlParse); break; } } } //TODDO:解释代码修 createCode(); return(true); }