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
This commit is contained in:
Wu-cheng Li
2010-04-04 17:14:23 +08:00
parent 479f4a5cc4
commit fcc7cf7799

View File

@@ -58,6 +58,12 @@ public class LinkReference {
= Pattern.compile("^<a href=\"([^\"]*)\">([^<]*)</a>[ \n\r\t]*$", = Pattern.compile("^<a href=\"([^\"]*)\">([^<]*)</a>[ \n\r\t]*$",
Pattern.CASE_INSENSITIVE); 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. * Parse and resolve a link string.
* *
@@ -321,15 +327,15 @@ public class LinkReference {
if (text.startsWith("\"")) { if (text.startsWith("\"")) {
// literal quoted reference (e.g., a book title) // literal quoted reference (e.g., a book title)
result.label = text.substring(1); Matcher matcher = QUOTE_PATTERN.matcher(text);
skipHref = true; if (! matcher.matches()) {
if (!result.label.endsWith("\"")) {
Errors.error(Errors.UNRESOLVED_LINK, pos, Errors.error(Errors.UNRESOLVED_LINK, pos,
"unbalanced quoted link/see tag: " + text.trim()); "unbalanced quoted link/see tag: " + text.trim());
result.makeError(); result.makeError();
return result; return result;
} }
result.label = result.label.substring(0, result.label.length() - 1); skipHref = true;
result.label = matcher.group(1);
result.kind = "@seeJustLabel"; result.kind = "@seeJustLabel";
} }
else if (text.startsWith("<")) { else if (text.startsWith("<")) {