https://defect.opensolaris.org/bz/show_bug.cgi?id=18655

--- Comment #2 from Mateusz B. <[email protected]> 2011-07-10 13:21:03 UTC ---
Java analyzer does indeed look like a good starting point. That is - I did a
quick POC and processed all .cs files via java handler - the output is much
closer to desired one than outputted by a C parser and I didn't see any
pitfalls where the analyzer would interpret some construct in the wrong way.

Aside of no support for verbatim strings (which cause the parser to behave
incorrectly), the sources were nicely processed and presented in a much more
usable format than ones parsed by C analyzer.

In the future, some adjustments need to be made though. For example: (I'm
writing from the top of my head - there certainly are others)

1. C# has different syntax for class annotations - instead of @Annotation in C#
the syntax is: [Annotation] - e.g.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder",
"4.0.0.0")]

2. Javadoc processing logic may be transformed to understand C# XML comments
(see. http://msdn.microsoft.com/en-us/library/b2s063f7.aspx ).

3. Some keywords and base types should be added (a full list is here:
http://msdn.microsoft.com/en-us/library/x53a06bb(v=vs.71).aspx )


As for the support for verbatim strings - I've currently workarounded this by
adding a separate VSTRING token (defined as below) - I believe something
simmilar should be implemented in the C# analyzer.

"@\""  { yybegin(VSTRING);out.write("<span class=\"s\">\"");}

<VSTRING> {
 \" {WhiteSpace} \"  { out.write(yytext());}
 "\"\""   { out.write("\"\""); }
 \"       { yybegin(YYINITIAL); out.write("\"</span>"); } 
 \\       { out.write("\\"); }
}

-- 
Configure bugmail: https://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
opengrok-dev mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opengrok-dev

Reply via email to