diff options
author | 2010-04-04 17:14:23 +0800 | |
---|---|---|
committer | 2010-04-13 23:49:18 +0800 | |
commit | fcc7cf779905613d6bd48344b5c3a994237c02bd (patch) | |
tree | 3cfe1e9b1f682b6537bb17582711a56a85b675e1 | |
parent | 479f4a5cc4db72024123d36145028fe557e72f98 (diff) |
Fix the check of double quoted @see tag.
Originally \n was not discarded so a balanced quoted string still
has compile error.
bug:2553570
Change-Id: I073c0c0ba370d55493d3ee6d17c7ebe9f42afe7a
-rw-r--r-- | tools/droiddoc/src/LinkReference.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/droiddoc/src/LinkReference.java b/tools/droiddoc/src/LinkReference.java index bbcd4db3fa..b1f998ab9b 100644 --- a/tools/droiddoc/src/LinkReference.java +++ b/tools/droiddoc/src/LinkReference.java @@ -59,6 +59,12 @@ public class LinkReference { Pattern.CASE_INSENSITIVE); /** + * regex pattern to use when matching double-quoted reference text + */ + private static final Pattern QUOTE_PATTERN + = Pattern.compile("^\"([^\"]*)\"[ \n\r\t]*$"); + + /** * Parse and resolve a link string. * * @param text the original text @@ -321,15 +327,15 @@ public class LinkReference { if (text.startsWith("\"")) { // literal quoted reference (e.g., a book title) - result.label = text.substring(1); - skipHref = true; - if (!result.label.endsWith("\"")) { + Matcher matcher = QUOTE_PATTERN.matcher(text); + if (! matcher.matches()) { Errors.error(Errors.UNRESOLVED_LINK, pos, "unbalanced quoted link/see tag: " + text.trim()); result.makeError(); return result; } - result.label = result.label.substring(0, result.label.length() - 1); + skipHref = true; + result.label = matcher.group(1); result.kind = "@seeJustLabel"; } else if (text.startsWith("<")) { |