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>
diff --git a/util/doc.go b/util/doc.go
index 48eac61..7063036 100644
--- a/util/doc.go
+++ b/util/doc.go
@@ -111,7 +111,9 @@
err = fmt.Errorf("comment doesn't start with block prefix on line %d: %s", restLineNo, line)
return
}
- line = line[2:]
+ if len(line) == 2 || line[2] != '/' {
+ line = line[2:]
+ }
if strings.HasPrefix(line, " ") {
/* Identing the lines of a paragraph marks them as
* preformatted. */
@@ -193,7 +195,7 @@
func skipPast(s, skip string) string {
i := strings.Index(s, skip)
if i > 0 {
- return s[len(skip):]
+ return s[i:]
}
return s
}