[csdoc-patches] csdoc/src/mcsdoc/mcs ChangeLog.mcsdoc,1.4,1.5 class.cs,1.1,1.2 cs-parser.jay,1.1,1.2
Status: Planning
Brought to you by:
mastergaurav
Update of /cvsroot/csdoc/csdoc/src/mcsdoc/mcs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10439 Modified Files: ChangeLog.mcsdoc class.cs cs-parser.jay cs-tokenizer.cs driver.cs ecore.cs parameter.cs statement.cs support.cs Log Message: 2004-10-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * cs-parser.jay : Updated to grab the comments. Includes update in definition of enum_declaration. * cs-tokenizer.cs : Enable documentation gathering * class.cs : Type BaseType { get; } - Added property Fixed some typos in comments. "csc /doc" was complaining a lot. * decl.cs, * ecore.cs : public string Documentation - Added field. * parameter.cs : Changed "&" to "&" in doc. * statement.cs : "summmary" to "summary" * support.cs : "remarks" to "summary" Index: ChangeLog.mcsdoc =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/ChangeLog.mcsdoc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ChangeLog.mcsdoc 30 Oct 2004 13:57:16 -0000 1.4 --- ChangeLog.mcsdoc 30 Oct 2004 14:09:08 -0000 1.5 *************** *** 3,6 **** --- 3,21 ---- 2004-10-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * cs-parser.jay : Updated to grab the comments. + Includes update in definition of + enum_declaration. + * cs-tokenizer.cs : Enable documentation gathering + * class.cs : Type BaseType { get; } - Added property + Fixed some typos in comments. + "csc /doc" was complaining a lot. + * decl.cs, + * ecore.cs : public string Documentation - Added field. + * parameter.cs : Changed "&" to "&" in doc. + * statement.cs : "summmary" to "summary" + * support.cs : "remarks" to "summary" + + 2004-10-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * mcs.exe.sources, * mcs.exe.config : Remove this also. Index: class.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/class.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** class.cs 29 Oct 2004 14:16:19 -0000 1.1 --- class.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 830,833 **** --- 830,847 ---- } + private TypeExpr baseClassType = null; + + /// <summary> + /// Returns the type of the base class + /// </summary> + /// <remarks>master's hack</remarks> + public Type BaseType + { + get + { + return baseClassType.Type; + } + } + // // Emits the instance field initializers *************** *** 898,905 **** } ! /// <remarks> /// The pending methods that need to be implemented ! // (interfaces or abstract methods) ! /// </remarks> public PendingImplementation Pending; --- 912,919 ---- } ! /// <summary> /// The pending methods that need to be implemented ! /// (interfaces or abstract methods) ! /// </summary> public PendingImplementation Pending; *************** *** 1148,1151 **** --- 1162,1171 ---- return null; + //master's hack + if(baseClassType == null) + { + baseClassType = parent; + } + if (parent == null) { if (Kind == Kind.Class){ *************** *** 1556,1573 **** /// implementation can't take care of that. /// </summary> ! // ! // FIXME: return an empty static array instead of null, that cleans up ! // some code and is consistent with some coding conventions I just found ! // out existed ;-) ! // ! // ! // Notice that in various cases we check if our field is non-null, ! // something that would normally mean that there was a bug elsewhere. ! // ! // The problem happens while we are defining p-invoke methods, as those ! // will trigger a FindMembers, but this happens before things are defined ! // ! // Since the whole process is a no-op, it is fine to check for null here. ! // public override MemberList FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria) --- 1576,1593 ---- /// implementation can't take care of that. /// </summary> ! /// <remarks> ! /// FIXME: return an empty static array instead of null, that cleans up ! /// some code and is consistent with some coding conventions I just found ! /// out existed ;-) ! /// ! /// ! /// Notice that in various cases we check if our field is non-null, ! /// something that would normally mean that there was a bug elsewhere. ! /// ! /// The problem happens while we are defining p-invoke methods, as those ! /// will trigger a FindMembers, but this happens before things are defined ! /// ! /// Since the whole process is a no-op, it is fine to check for null here. ! /// </remarks> public override MemberList FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria) *************** *** 5992,5996 **** } ! /// </summary> /// Gigantic workaround for lameness in SRE follows : /// This class derives from EventInfo and attempts to basically --- 6012,6016 ---- } ! /// <summary> /// Gigantic workaround for lameness in SRE follows : /// This class derives from EventInfo and attempts to basically Index: cs-parser.jay =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/cs-parser.jay,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cs-parser.jay 29 Oct 2004 14:16:19 -0000 1.1 --- cs-parser.jay 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 60,64 **** /// Used to determine if we are parsing the get/set pair /// of an indexer or a property ! /// </summmary> bool parsing_indexer; --- 60,64 ---- /// Used to determine if we are parsing the get/set pair /// of an indexer or a property ! /// </summary> bool parsing_indexer; *************** *** 82,86 **** /// SourceFile file; ! /// Current attribute target --- 82,87 ---- /// SourceFile file; ! ! string mcsdoc_docs; /// Current attribute target *************** *** 734,738 **** current_container = current_class; RootContext.Tree.RecordDecl (name.GetName (true), current_class); ! new_struct.Documentation = lexer.GetDocs(); } } --- 735,740 ---- current_container = current_class; RootContext.Tree.RecordDecl (name.GetName (true), current_class); ! current_class.Documentation = lexer.GetDocs(); ! //lexer.SaveDocument(); } } *************** *** 811,814 **** --- 813,818 ---- current_container.AddConstant (c); + c.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } } *************** *** 863,866 **** --- 867,872 ---- current_container.AddField (field); + field.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } } *************** *** 941,944 **** --- 947,952 ---- method.Block = (ToplevelBlock) $3; current_container.AddMethod (method); + method.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); current_local_parameters = null; *************** *** 993,996 **** --- 1001,1007 ---- (Attributes) $1, lexer.Location); + method.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); + current_local_parameters = (Parameters) $6; $$ = method; *************** *** 1173,1176 **** --- 1184,1189 ---- current_container.AddProperty (prop); + prop.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); implicit_value_parameter_type = null; iterator_container = null; *************** *** 1283,1286 **** --- 1296,1301 ---- current_container = current_class; RootContext.Tree.RecordDecl (name.GetName (true), current_class); + current_class.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } } *************** *** 1364,1369 **** MemberName name = (MemberName) $4; ! $$ = new Method (current_class, (Expression) $3, (int) $2, true, name, (Parameters) $6, (Attributes) $1, lexer.Location); } | opt_attributes opt_new VOID namespace_or_type_name --- 1379,1387 ---- MemberName name = (MemberName) $4; ! Method im = new Method (current_class, (Expression) $3, (int) $2, true, name, (Parameters) $6, (Attributes) $1, lexer.Location); + im.Documentation = lexer.GetDocs(); + $$ = im; + //lexer.SaveDocument(); } | opt_attributes opt_new VOID namespace_or_type_name *************** *** 1373,1378 **** MemberName name = (MemberName) $4; ! $$ = new Method (current_class, TypeManager.system_void_expr, (int) $2, true, name, (Parameters) $6, (Attributes) $1, lexer.Location); } ; --- 1391,1399 ---- MemberName name = (MemberName) $4; ! Method im = new Method (current_class, TypeManager.system_void_expr, (int) $2, true, name, (Parameters) $6, (Attributes) $1, lexer.Location); + im.Documentation = lexer.GetDocs(); + $$ = im; + //lexer.SaveDocument(); } ; *************** *** 1390,1396 **** InterfaceAccessorInfo pinfo = (InterfaceAccessorInfo) $7; ! $$ = new Property (current_class, (Expression) $3, (int) $2, true, new MemberName ((string) $4), (Attributes) $1, pinfo.Get, pinfo.Set, lexer.Location); } | opt_attributes --- 1411,1420 ---- InterfaceAccessorInfo pinfo = (InterfaceAccessorInfo) $7; ! Property ip = new Property (current_class, (Expression) $3, (int) $2, true, new MemberName ((string) $4), (Attributes) $1, pinfo.Get, pinfo.Set, lexer.Location); + ip.Documentation = lexer.GetDocs(); + $$ = ip; + //lexer.SaveDocument(); } | opt_attributes *************** *** 1414,1420 **** : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON { ! $$ = new EventField (current_class, (Expression) $4, (int) $2, true, new MemberName ((string) $5), null, (Attributes) $1, lexer.Location); } | opt_attributes opt_new EVENT type error { --- 1438,1447 ---- : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON { ! EventField ie = new EventField (current_class, (Expression) $4, (int) $2, true, new MemberName ((string) $5), null, (Attributes) $1, lexer.Location); + ie.Documentation = lexer.GetDocs(); + $$ = ie; + //lexer.SaveDocument(); } | opt_attributes opt_new EVENT type error { *************** *** 1443,1450 **** InterfaceAccessorInfo info = (InterfaceAccessorInfo) $10; ! $$ = new Indexer (current_class, (Expression) $3, new MemberName (TypeContainer.DefaultIndexerName), (int) $2, true, (Parameters) $6, (Attributes) $1, info.Get, info.Set, lexer.Location); } ; --- 1470,1480 ---- InterfaceAccessorInfo info = (InterfaceAccessorInfo) $10; ! Indexer ii = new Indexer (current_class, (Expression) $3, new MemberName (TypeContainer.DefaultIndexerName), (int) $2, true, (Parameters) $6, (Attributes) $1, info.Get, info.Set, lexer.Location); + ii.Documentation = lexer.GetDocs(); + $$ = ii; + //lexer.SaveDocument(); } ; *************** *** 1476,1479 **** --- 1506,1512 ---- current_container.AddOperator (op); + op.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); + current_local_parameters = null; iterator_container = null; *************** *** 1648,1653 **** { Location l = (Location) oob_stack.Pop (); ! $$ = new Constructor (current_class, (string) $1, 0, (Parameters) $3, (ConstructorInitializer) $6, l); } ; --- 1681,1689 ---- { Location l = (Location) oob_stack.Pop (); ! Constructor ctor = new Constructor (current_class, (string) $1, 0, (Parameters) $3, (ConstructorInitializer) $6, l); + ctor.Documentation = lexer.GetDocs(); + $$ = ctor; + //lexer.SaveDocument(); } ; *************** *** 1714,1717 **** --- 1750,1755 ---- d.Block = (ToplevelBlock) $7; current_container.AddMethod (d); + d.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } } *************** *** 1733,1737 **** current_container.AddEvent (e); ! } } --- 1771,1776 ---- current_container.AddEvent (e); ! e.Documentation = lexer.GetDocs(); ! //lexer.SaveDocument(); } } *************** *** 1767,1770 **** --- 1806,1811 ---- current_container.AddEvent (e); + e.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); implicit_value_parameter_type = null; } *************** *** 1883,1886 **** --- 1924,1929 ---- current_container.AddIndexer (indexer); + indexer.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); current_local_parameters = null; *************** *** 1923,1926 **** --- 1966,1973 ---- ENUM IDENTIFIER opt_enum_base + { + mcsdoc_docs = lexer.GetDocs(); + //lexer.SaveDocument(); + } enum_body opt_semicolon *************** *** 1932,1936 **** full_name, (Attributes) $1, enum_location); ! foreach (VariableDeclaration ev in (ArrayList) $6) { e.AddEnumMember (ev.identifier, (Expression) ev.expression_or_array_initializer, --- 1979,1983 ---- full_name, (Attributes) $1, enum_location); ! foreach (VariableDeclaration ev in (ArrayList) $7) { e.AddEnumMember (ev.identifier, (Expression) ev.expression_or_array_initializer, *************** *** 1941,1945 **** current_container.AddEnum (e); RootContext.Tree.RecordDecl (name, e); ! } ; --- 1988,1992 ---- current_container.AddEnum (e); RootContext.Tree.RecordDecl (name, e); ! e.Documentation = mcsdoc_docs; } ; *************** *** 1983,1987 **** : opt_attributes IDENTIFIER { ! $$ = new VariableDeclaration ((string) $2, null, lexer.Location, (Attributes) $1); } | opt_attributes IDENTIFIER --- 2030,2037 ---- : opt_attributes IDENTIFIER { ! VariableDeclaration vd = new VariableDeclaration ((string) $2, null, lexer.Location, (Attributes) $1); ! vd.Documentation = lexer.GetDocs(); ! $$ = vd; ! //lexer.SaveDocument(); } | opt_attributes IDENTIFIER *************** *** 1991,1995 **** ASSIGN expression { ! $$ = new VariableDeclaration ((string) $2, $5, lexer.Location, (Attributes) $1); } ; --- 2041,2048 ---- ASSIGN expression { ! VariableDeclaration vd = new VariableDeclaration ((string) $2, $5, lexer.Location, (Attributes) $1); ! vd.Documentation = lexer.GetDocs(); ! $$ = vd; ! //lexer.SaveDocument(); } ; *************** *** 2009,2013 **** current_container.AddDelegate (del); RootContext.Tree.RecordDecl (name.GetName (true), del); ! } | opt_attributes opt_modifiers --- 2062,2068 ---- current_container.AddDelegate (del); RootContext.Tree.RecordDecl (name.GetName (true), del); ! del.Documentation = lexer.GetDocs(); ! //lexer.SaveDocument(); ! } | opt_attributes opt_modifiers *************** *** 2025,2028 **** --- 2080,2085 ---- current_container.AddDelegate (del); RootContext.Tree.RecordDecl (name.GetName (true), del); + del.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } ; *************** *** 3008,3011 **** --- 3065,3070 ---- current_container = current_class; RootContext.Tree.RecordDecl (name.GetName (true), current_class); + current_class.Documentation = lexer.GetDocs(); + //lexer.SaveDocument(); } } *************** *** 4105,4108 **** --- 4164,4173 ---- public Attributes OptAttributes; + /// <summary> + /// Holds the doc-comments. + /// </summary> + /// <remarks>master's hack</remarks> + public string Documentation; + public VariableDeclaration (string id, object eoai, Location l, Attributes opt_attrs) { Index: cs-tokenizer.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/cs-tokenizer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cs-tokenizer.cs 29 Oct 2004 14:16:19 -0000 1.1 --- cs-tokenizer.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 55,58 **** --- 55,89 ---- static Hashtable tokenValues; + //---------------------------------------------- + // Adding support for documentation. + // Modified by Gaurav Vaish + // master's hack + //---------------------------------------------- + + #region Modification1 + + private string commentString = ""; + private bool isCollectingDocs = true; + + public void SaveDocument() + { + commentString = ""; + isCollectingDocs = true; + } + + public void StopCollectingDocs() + { + isCollectingDocs = false; + } + + public string GetDocs() + { + string retVal = commentString.Trim(); + SaveDocument(); + return retVal; + } + + #endregion + private static Hashtable TokenValueName { *************** *** 1858,1869 **** // Handle double-slash comments. if (c == '/'){ int d = peekChar (); ! if (d == '/'){ getChar (); while ((d = getChar ()) != -1 && (d != '\n') && d != '\r') col++; if (d == '\n'){ line++; ref_line++; --- 1889,1929 ---- // Handle double-slash comments. + #region Modification2 if (c == '/'){ int d = peekChar (); ! // master's hack ! int afterComment = 0; ! if (d == '/'){ getChar (); + // master's hack + if(isCollectingDocs) + { + commentString += "//"; + } while ((d = getChar ()) != -1 && (d != '\n') && d != '\r') + { + // master's hack + if(isCollectingDocs) + { + commentString += (char)d; + } col++; + } if (d == '\n'){ + //master's hack + if(isCollectingDocs) + { + commentString += '\n'; + } + // master's hack + ///* + afterComment = peekChar(); + if(afterComment == '\r' || afterComment=='\n') + { + //Console.WriteLine("Delimiting // comment. \n\"" + commentString + "\""); + commentString = ""; + } + //*/ line++; ref_line++; *************** *** 1876,1881 **** --- 1936,1957 ---- getChar (); + // master's hack + if(isCollectingDocs) + commentString += "/*"; + while ((d = getChar ()) != -1){ + // master's hack + if(isCollectingDocs) + { + commentString += (char)d; + } if (d == '*' && peekChar () == '/'){ + // master's hack + if(isCollectingDocs) + { + commentString += "/"; + //Console.WriteLine("Stop of /**/ comment. \n\"" + commentString + "\""); + } + StopCollectingDocs(); getChar (); col++; *************** *** 1889,1892 **** --- 1965,1977 ---- tokens_seen = false; } + // master's hack + /* + afterComment = peekChar(); + if(afterComment == '\r' || afterComment=='\n') + { + Console.WriteLine("Delimiting /* comment. \n\"" + commentString + "\""); + commentString = ""; + } + //*/ } continue; *************** *** 1894,1897 **** --- 1979,1983 ---- goto is_punct_label; } + #endregion Index: driver.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/driver.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** driver.cs 29 Oct 2004 14:16:19 -0000 1.1 --- driver.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 9,12 **** --- 9,14 ---- // + using MCSDoc; + namespace Mono.CSharp { *************** *** 1566,1569 **** --- 1568,1580 ---- } + TypeContainer root = RootContext.Tree.Types; + Console.WriteLine("Root type: " + root.GetType()); + + MCSDocUtils.ManageAttributeTypes(root.Types); + + MCSDocUtils.ManageTypeContainer(root); + Console.WriteLine(); + + if (RootContext.VerifyClsCompliance) { CodeGen.Assembly.ResolveClsCompliance (); Index: ecore.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/ecore.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ecore.cs 29 Oct 2004 14:16:19 -0000 1.1 --- ecore.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 158,161 **** --- 158,167 ---- protected Location loc; + /// <summary> + /// Holds the doc-comments. + /// </summary> + /// <remarks>master's hack</remarks> + public string Documentation; + public Type Type { get { Index: parameter.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/parameter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** parameter.cs 29 Oct 2004 14:16:20 -0000 1.1 --- parameter.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 527,531 **** /// /// Note that the returned type will not contain any dereference in this ! /// case (ie, you get "int" for a ref int instead of "int&" /// </summary> public Type GetParameterInfo (EmitContext ec, int idx, out Parameter.Modifier mod) --- 527,531 ---- /// /// Note that the returned type will not contain any dereference in this ! /// case (ie, you get "int" for a ref int instead of "int&") /// </summary> public Type GetParameterInfo (EmitContext ec, int idx, out Parameter.Modifier mod) Index: statement.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/statement.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** statement.cs 29 Oct 2004 14:16:20 -0000 1.1 --- statement.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 26,30 **** /// Resolves the statement, true means that all sub-statements /// did resolve ok. ! // </summary> public virtual bool Resolve (EmitContext ec) { --- 26,30 ---- /// Resolves the statement, true means that all sub-statements /// did resolve ok. ! /// </summary> public virtual bool Resolve (EmitContext ec) { Index: support.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/mcsdoc/mcs/support.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** support.cs 29 Oct 2004 14:16:20 -0000 1.1 --- support.cs 30 Oct 2004 14:09:08 -0000 1.2 *************** *** 368,375 **** int preamble_size; ! /// <remarks> /// The difference to the StreamReader's BaseStream.Position is that this one is reliable; ie. it ! // always reports the correct position and if it's modified, it also takes care of the buffered data. ! /// </remarks> public int Position { get { --- 368,375 ---- int preamble_size; ! /// <summary> /// The difference to the StreamReader's BaseStream.Position is that this one is reliable; ie. it ! /// always reports the correct position and if it's modified, it also takes care of the buffered data. ! /// </summary> public int Position { get { |