mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Comment adjustments.
This commit is contained in:
parent
1502e06ab7
commit
033e61ab6f
1 changed files with 15 additions and 15 deletions
|
@ -714,14 +714,14 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
if (!startNode(node)) { return PROCESS_SKIP; }
|
if (!startNode(node)) { return PROCESS_SKIP; }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// common to all declarators
|
// Common to all declarators
|
||||||
final IASTPointerOperator[] pointerOperators= node.getPointerOperators();
|
final IASTPointerOperator[] pointerOperators= node.getPointerOperators();
|
||||||
formatPointers(pointerOperators);
|
formatPointers(pointerOperators);
|
||||||
if (node instanceof IASTStandardFunctionDeclarator) {
|
if (node instanceof IASTStandardFunctionDeclarator) {
|
||||||
if (preferences.insert_new_line_before_identifier_in_function_declaration) {
|
if (preferences.insert_new_line_before_identifier_in_function_declaration) {
|
||||||
scribe.startNewLine();
|
scribe.startNewLine();
|
||||||
} else {
|
} else {
|
||||||
// preserve newline if not explicitly requested
|
// Preserve newline if not explicitly requested
|
||||||
if (scribe.printCommentPreservingNewLines()) {
|
if (scribe.printCommentPreservingNewLines()) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
IASTName name= node.getName();
|
IASTName name= node.getName();
|
||||||
if (name != null && name.getSimpleID().length != 0) {
|
if (name != null && name.getSimpleID().length != 0) {
|
||||||
if (isFirstDeclarator(node)) {
|
if (isFirstDeclarator(node)) {
|
||||||
// preserve non-space between pointer operator and name
|
// Preserve non-space between pointer operator and name
|
||||||
if (pointerOperators.length == 0 || scribe.printComment()) {
|
if (pointerOperators.length == 0 || scribe.printComment()) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
@ -1595,7 +1595,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
// template parameters
|
// Template parameters
|
||||||
final ICPPASTTemplateParameter[] templateParameters= node.getTemplateParameters();
|
final ICPPASTTemplateParameter[] templateParameters= node.getTemplateParameters();
|
||||||
if (templateParameters.length > 0) {
|
if (templateParameters.length > 0) {
|
||||||
final ListOptions options= new ListOptions(Alignment.M_COMPACT_SPLIT);
|
final ListOptions options= new ListOptions(Alignment.M_COMPACT_SPLIT);
|
||||||
|
@ -1608,7 +1608,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
// declaration
|
// Declaration
|
||||||
final IASTDeclaration declaration= node.getDeclaration();
|
final IASTDeclaration declaration= node.getDeclaration();
|
||||||
if (preferences.insert_new_line_after_template_declaration) {
|
if (preferences.insert_new_line_after_template_declaration) {
|
||||||
scribe.startNewLine();
|
scribe.startNewLine();
|
||||||
|
@ -1616,7 +1616,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.indent();
|
scribe.indent();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// preserve newline if not explicitly requested
|
// Preserve newline if not explicitly requested
|
||||||
scribe.printCommentPreservingNewLines();
|
scribe.printCommentPreservingNewLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,7 +1681,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
// consider macro expansion
|
// Consider macro expansion
|
||||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||||
continueNode(node);
|
continueNode(node);
|
||||||
}
|
}
|
||||||
|
@ -1703,7 +1703,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
name.accept(this);
|
name.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// member declarations
|
// Member declarations
|
||||||
IASTDeclaration[] memberDecls= node.getMembers();
|
IASTDeclaration[] memberDecls= node.getMembers();
|
||||||
formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
|
formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
|
||||||
formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
|
formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
|
||||||
|
@ -1726,13 +1726,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.printComment();
|
scribe.printComment();
|
||||||
final int line= scribe.line;
|
final int line= scribe.line;
|
||||||
|
|
||||||
// storage class and other modifiers
|
// Storage class and other modifiers
|
||||||
if (scribe.printModifiers()) {
|
if (scribe.printModifiers()) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
final int headerIndent= scribe.numberOfIndentations;
|
final int headerIndent= scribe.numberOfIndentations;
|
||||||
|
|
||||||
// consider macro expansion
|
// Consider macro expansion
|
||||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||||
continueNode(node);
|
continueNode(node);
|
||||||
}
|
}
|
||||||
|
@ -1757,7 +1757,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
name.accept(this);
|
name.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// base specifiers
|
// Base specifiers
|
||||||
final List<ICPPASTBaseSpecifier> baseSpecifiers= Arrays.asList(node.getBaseSpecifiers());
|
final List<ICPPASTBaseSpecifier> baseSpecifiers= Arrays.asList(node.getBaseSpecifiers());
|
||||||
if (baseSpecifiers.size() > 0) {
|
if (baseSpecifiers.size() > 0) {
|
||||||
ICPPASTBaseSpecifier baseSpecifier = baseSpecifiers.get(0);
|
ICPPASTBaseSpecifier baseSpecifier = baseSpecifiers.get(0);
|
||||||
|
@ -1777,7 +1777,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
formatList(baseSpecifiers, options, false, false, null);
|
formatList(baseSpecifiers, options, false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// member declarations
|
// Member declarations
|
||||||
formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
|
formatLeftCurlyBrace(line, preferences.brace_position_for_type_declaration);
|
||||||
formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
|
formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration);
|
||||||
final int braceIndent= scribe.numberOfIndentations;
|
final int braceIndent= scribe.numberOfIndentations;
|
||||||
|
@ -1867,7 +1867,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
private int visit(IASTElaboratedTypeSpecifier node) {
|
private int visit(IASTElaboratedTypeSpecifier node) {
|
||||||
// storage class and other modifiers
|
// Storage class and other modifiers
|
||||||
if (scribe.printModifiers()) {
|
if (scribe.printModifiers()) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +1896,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
private int visit(IASTEnumerationSpecifier node) {
|
private int visit(IASTEnumerationSpecifier node) {
|
||||||
scribe.printComment();
|
scribe.printComment();
|
||||||
final int line= scribe.line;
|
final int line= scribe.line;
|
||||||
// storage class and other modifiers
|
// Storage class and other modifiers
|
||||||
if (scribe.printModifiers()) {
|
if (scribe.printModifiers()) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
|
@ -1927,7 +1927,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
options.fContinuationIndentation= enumIndent == headerIndent ? 1 : 0;
|
options.fContinuationIndentation= enumIndent == headerIndent ? 1 : 0;
|
||||||
formatList(Arrays.asList(enumerators), options, false, false, null);
|
formatList(Arrays.asList(enumerators), options, false, false, null);
|
||||||
|
|
||||||
// handle trailing comma
|
// Handle trailing comma
|
||||||
if (peekNextToken() == Token.tCOMMA) {
|
if (peekNextToken() == Token.tCOMMA) {
|
||||||
scribe.printNextToken(Token.tCOMMA, options.fSpaceBeforeComma);
|
scribe.printNextToken(Token.tCOMMA, options.fSpaceBeforeComma);
|
||||||
if (options.fSpaceAfterComma) {
|
if (options.fSpaceAfterComma) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue