--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Wed Jul 05 21:13:10 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Fri Jan 15 15:40:24 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@
? body.head.pos
: !tags.isEmpty() ? tags.head.pos : Position.NOPOS;
- DCDocComment dc = m.at(pos).DocComment(comment, body, tags);
+ DCDocComment dc = m.at(pos).newDocCommentTree(comment, body, tags);
return dc;
}
@@ -171,7 +171,7 @@
case '>':
newline = false;
addPendingText(trees, bp - 1);
- trees.add(m.at(bp).Erroneous(newString(bp, bp+1), diagSource, "dc.bad.gt"));
+ trees.add(m.at(bp).newErroneousTree(newString(bp, bp + 1), diagSource, "dc.bad.gt"));
nextChar();
if (textStart == -1) {
textStart = bp;
@@ -231,7 +231,7 @@
TagParser tp = tagParsers.get(name);
if (tp == null) {
List<DCTree> content = blockContent();
- return m.at(p).UnknownBlockTag(name, content);
+ return m.at(p).newUnknownBlockTagTree(name, content);
} else {
switch (tp.getKind()) {
case BLOCK:
@@ -284,7 +284,7 @@
DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_ALL);
if (text != null) {
nextChar();
- return m.at(p).UnknownInlineTag(name, List.of(text)).setEndPos(bp);
+ return m.at(p).newUnknownInlineTagTree(name, List.of(text)).setEndPos(bp);
}
} else {
if (!tp.retainWhiteSpace) {
@@ -354,7 +354,7 @@
case '}':
if (--depth == 0) {
- return m.at(pos).Text(newString(pos, bp));
+ return m.at(pos).newTextTree(newString(pos, bp));
}
newline = false;
lastNonWhite = bp;
@@ -384,6 +384,7 @@
*/
// TODO: boolean allowMember should be enum FORBID, ALLOW, REQUIRE
// TODO: improve quality of parse to forbid bad constructions.
+ // TODO: update to use ReferenceParser
@SuppressWarnings("fallthrough")
protected DCReference reference(boolean allowMember) throws ParseException {
int pos = bp;
@@ -481,7 +482,7 @@
fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
}
- return m.at(pos).Reference(sig, qualExpr, member, paramTypes).setEndPos(bp);
+ return m.at(pos).newReferenceTree(sig, qualExpr, member, paramTypes).setEndPos(bp);
}
JCTree parseType(String s) throws ParseException {
@@ -537,7 +538,7 @@
if (isJavaIdentifierStart(ch)) {
Name name = readJavaIdentifier();
- return m.at(pos).Identifier(name);
+ return m.at(pos).newIdentifierTree(name);
}
throw new ParseException("dc.identifier.expected");
@@ -565,7 +566,7 @@
case '"':
nextChar();
// trim trailing white-space?
- return m.at(pos).Text(newString(pos, bp));
+ return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
@@ -593,7 +594,7 @@
// fallthrough
case '\r': case '\f': case ' ': case '\t':
- return m.at(pos).Text(newString(pos, bp));
+ return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
@@ -605,7 +606,7 @@
case '}':
if (depth == 0 || --depth == 0)
- return m.at(pos).Text(newString(pos, bp));
+ return m.at(pos).newTextTree(newString(pos, bp));
break;
}
newline = false;
@@ -729,7 +730,7 @@
if (ch != ';')
return erroneous("dc.missing.semicolon", p);
nextChar();
- return m.at(p).Entity(name);
+ return m.at(p).newEntityTree(name);
}
}
@@ -751,7 +752,7 @@
}
if (ch == '>') {
nextChar();
- DCTree dctree = m.at(p).StartElement(name, attrs, selfClosing).setEndPos(bp);
+ DCTree dctree = m.at(p).newStartElementTree(name, attrs, selfClosing).setEndPos(bp);
return dctree;
}
}
@@ -762,7 +763,7 @@
skipWhitespace();
if (ch == '>') {
nextChar();
- return m.at(p).EndElement(name);
+ return m.at(p).newEndElementTree(name);
}
}
} else if (ch == '!') {
@@ -777,11 +778,13 @@
dash++;
nextChar();
}
- // strictly speaking, a comment should not contain "--"
+ // Strictly speaking, a comment should not contain "--"
// so dash > 2 is an error, dash == 2 implies ch == '>'
+ // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
+ // for more details.
if (dash >= 2 && ch == '>') {
nextChar();
- return m.at(p).Comment(newString(p, bp));
+ return m.at(p).newCommentTree(newString(p, bp));
}
nextChar();
@@ -844,7 +847,7 @@
skipWhitespace();
value = v.toList();
}
- DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
+ DCAttribute attr = m.at(namePos).newAttributeTree(name, vkind, value);
attrs.add(attr);
}
@@ -869,7 +872,7 @@
protected void addPendingText(ListBuffer<DCTree> list, int textEnd) {
if (textStart != -1) {
if (textStart <= textEnd) {
- list.add(m.at(textStart).Text(newString(textStart, textEnd + 1)));
+ list.add(m.at(textStart).newTextTree(newString(textStart, textEnd + 1)));
}
textStart = -1;
}
@@ -891,7 +894,7 @@
i--;
}
textStart = -1;
- return m.at(pos).Erroneous(newString(pos, i + 1), diagSource, code);
+ return m.at(pos).newErroneousTree(newString(pos, i + 1), diagSource, code);
}
protected boolean isIdentifierStart(char ch) {
@@ -1017,7 +1020,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.AUTHOR) {
public DCTree parse(int pos) {
List<DCTree> name = blockContent();
- return m.at(pos).Author(name);
+ return m.at(pos).newAuthorTree(name);
}
},
@@ -1026,7 +1029,7 @@
public DCTree parse(int pos) throws ParseException {
DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
nextChar();
- return m.at(pos).Code((DCText) text);
+ return m.at(pos).newCodeTree((DCText) text);
}
},
@@ -1034,7 +1037,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.DEPRECATED) {
public DCTree parse(int pos) {
List<DCTree> reason = blockContent();
- return m.at(pos).Deprecated(reason);
+ return m.at(pos).newDeprecatedTree(reason);
}
},
@@ -1043,7 +1046,7 @@
public DCTree parse(int pos) throws ParseException {
if (ch == '}') {
nextChar();
- return m.at(pos).DocRoot();
+ return m.at(pos).newDocRootTree();
}
inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
nextChar();
@@ -1057,7 +1060,7 @@
skipWhitespace();
DCReference ref = reference(false);
List<DCTree> description = blockContent();
- return m.at(pos).Exception(ref, description);
+ return m.at(pos).newExceptionTree(ref, description);
}
},
@@ -1079,7 +1082,7 @@
} else {
nextChar();
}
- return m.at(pos).Index(term, description);
+ return m.at(pos).newIndexTree(term, description);
}
},
@@ -1088,7 +1091,7 @@
public DCTree parse(int pos) throws ParseException {
if (ch == '}') {
nextChar();
- return m.at(pos).InheritDoc();
+ return m.at(pos).newInheritDocTree();
}
inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
nextChar();
@@ -1101,7 +1104,7 @@
public DCTree parse(int pos) throws ParseException {
DCReference ref = reference(true);
List<DCTree> label = inlineContent();
- return m.at(pos).Link(ref, label);
+ return m.at(pos).newLinkTree(ref, label);
}
},
@@ -1110,7 +1113,7 @@
public DCTree parse(int pos) throws ParseException {
DCReference ref = reference(true);
List<DCTree> label = inlineContent();
- return m.at(pos).LinkPlain(ref, label);
+ return m.at(pos).newLinkPlainTree(ref, label);
}
},
@@ -1119,7 +1122,7 @@
public DCTree parse(int pos) throws ParseException {
DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
nextChar();
- return m.at(pos).Literal((DCText) text);
+ return m.at(pos).newLiteralTree((DCText) text);
}
},
@@ -1144,7 +1147,7 @@
skipWhitespace();
List<DCTree> desc = blockContent();
- return m.at(pos).Param(typaram, id, desc);
+ return m.at(pos).newParamTree(typaram, id, desc);
}
},
@@ -1152,7 +1155,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.RETURN) {
public DCTree parse(int pos) {
List<DCTree> description = blockContent();
- return m.at(pos).Return(description);
+ return m.at(pos).newReturnTree(description);
}
},
@@ -1167,7 +1170,7 @@
skipWhitespace();
if (ch == '@'
|| ch == EOI && bp == buf.length - 1) {
- return m.at(pos).See(List.<DCTree>of(string));
+ return m.at(pos).newSeeTree(List.<DCTree>of(string));
}
}
break;
@@ -1175,7 +1178,7 @@
case '<':
List<DCTree> html = blockContent();
if (html != null)
- return m.at(pos).See(html);
+ return m.at(pos).newSeeTree(html);
break;
case '@':
@@ -1192,7 +1195,7 @@
if (isJavaIdentifierStart(ch) || ch == '#') {
DCReference ref = reference(true);
List<DCTree> description = blockContent();
- return m.at(pos).See(description.prepend(ref));
+ return m.at(pos).newSeeTree(description.prepend(ref));
}
}
throw new ParseException("dc.unexpected.content");
@@ -1203,7 +1206,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL_DATA) {
public DCTree parse(int pos) {
List<DCTree> description = blockContent();
- return m.at(pos).SerialData(description);
+ return m.at(pos).newSerialDataTree(description);
}
},
@@ -1219,7 +1222,7 @@
skipWhitespace();
description = blockContent();
}
- return m.at(pos).SerialField(name, type, description);
+ return m.at(pos).newSerialFieldTree(name, type, description);
}
},
@@ -1227,7 +1230,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL) {
public DCTree parse(int pos) {
List<DCTree> description = blockContent();
- return m.at(pos).Serial(description);
+ return m.at(pos).newSerialTree(description);
}
},
@@ -1235,7 +1238,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.SINCE) {
public DCTree parse(int pos) {
List<DCTree> description = blockContent();
- return m.at(pos).Since(description);
+ return m.at(pos).newSinceTree(description);
}
},
@@ -1245,7 +1248,7 @@
skipWhitespace();
DCReference ref = reference(false);
List<DCTree> description = blockContent();
- return m.at(pos).Throws(ref, description);
+ return m.at(pos).newThrowsTree(ref, description);
}
},
@@ -1256,7 +1259,7 @@
skipWhitespace();
if (ch == '}') {
nextChar();
- return m.at(pos).Value(ref);
+ return m.at(pos).newValueTree(ref);
}
nextChar();
throw new ParseException("dc.unexpected.content");
@@ -1267,7 +1270,7 @@
new TagParser(Kind.BLOCK, DCTree.Kind.VERSION) {
public DCTree parse(int pos) {
List<DCTree> description = blockContent();
- return m.at(pos).Version(description);
+ return m.at(pos).newVersionTree(description);
}
},
};