Fix some parsing bugs in doc.go.

skipPast got confused when STACK_OF wasn't in the front of the string (which it
rarely was due to OPENSSL_EXPORT).

It also couldn't parse comments which end with a '*/' on their own.
(Stylistically we don't do this, but ssl_cipher_preference_list_st ends with an
ASCII art diagram which probably shouldn't gain a comment marker in the middle.)

Change-Id: I7687f4fd126003108906b995da0f2cd53f7d693a
Reviewed-on: https://boringssl-review.googlesource.com/4288
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-04-08 23:17:55 -04:00 committed by Adam Langley
parent e00fc887e4
commit 48b3150c08

View File

@ -111,7 +111,9 @@ func extractComment(lines []string, lineNo int) (comment []string, rest []string
err = fmt.Errorf("comment doesn't start with block prefix on line %d: %s", restLineNo, line) err = fmt.Errorf("comment doesn't start with block prefix on line %d: %s", restLineNo, line)
return return
} }
if len(line) == 2 || line[2] != '/' {
line = line[2:] line = line[2:]
}
if strings.HasPrefix(line, " ") { if strings.HasPrefix(line, " ") {
/* Identing the lines of a paragraph marks them as /* Identing the lines of a paragraph marks them as
* preformatted. */ * preformatted. */
@ -193,7 +195,7 @@ func extractDecl(lines []string, lineNo int) (decl string, rest []string, restLi
func skipPast(s, skip string) string { func skipPast(s, skip string) string {
i := strings.Index(s, skip) i := strings.Index(s, skip)
if i > 0 { if i > 0 {
return s[len(skip):] return s[i:]
} }
return s return s
} }