Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java104
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java35
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java24
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java5
7 files changed, 79 insertions, 113 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
index ac0d579a0d..dd5de13f03 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Institute for Software - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@@ -44,23 +45,6 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
* @author Emanuel Graf IFS
*/
public class DeclSpecWriter extends NodeWriter {
- private static final String MUTABLE = "mutable "; //$NON-NLS-1$
- private static final String _COMPLEX = "_Complex "; //$NON-NLS-1$
- private static final String LONG_LONG = "long long "; //$NON-NLS-1$
- private static final String REGISTER = "register "; //$NON-NLS-1$
- private static final String AUTO = "auto "; //$NON-NLS-1$
- private static final String TYPEDEF = "typedef "; //$NON-NLS-1$
- private static final String UNION = "union"; //$NON-NLS-1$
- private static final String STRUCT = "struct"; //$NON-NLS-1$
- private static final String CLASS = "class"; //$NON-NLS-1$
- private static final String FRIEND = "friend "; //$NON-NLS-1$
- private static final String CONSTEXPR = "constexpr "; //$NON-NLS-1$
- private static final String EXPLICIT = "explicit "; //$NON-NLS-1$
- private static final String VIRTUAL = "virtual "; //$NON-NLS-1$
- private static final String UNION_SPACE = "union "; //$NON-NLS-1$
- private static final String STRUCT_SPACE = "struct "; //$NON-NLS-1$
- private static final String ENUM_SPACE = "enum "; //$NON-NLS-1$
- private static final String _BOOL = "_Bool"; //$NON-NLS-1$
public DeclSpecWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
@@ -89,23 +73,23 @@ public class DeclSpecWriter extends NodeWriter {
case IASTSimpleDeclSpecifier.t_unspecified:
return ""; //$NON-NLS-1$
case IASTSimpleDeclSpecifier.t_void:
- return VOID;
+ return Keywords.VOID;
case IASTSimpleDeclSpecifier.t_char:
- return CHAR;
+ return Keywords.CHAR;
case IASTSimpleDeclSpecifier.t_int:
- return INT;
+ return Keywords.INT;
case IASTSimpleDeclSpecifier.t_float:
- return FLOAT;
+ return Keywords.FLOAT;
case IASTSimpleDeclSpecifier.t_double:
- return DOUBLE;
+ return Keywords.DOUBLE;
case IASTSimpleDeclSpecifier.t_bool:
- return isCpp ? CPP_BOOL : _BOOL;
+ return isCpp ? Keywords.BOOL : Keywords._BOOL;
case IASTSimpleDeclSpecifier.t_wchar_t:
if (isCpp)
- return WCHAR_T;
+ return Keywords.WCHAR_T;
break;
case IASTSimpleDeclSpecifier.t_char16_t:
if (isCpp)
@@ -134,7 +118,7 @@ public class DeclSpecWriter extends NodeWriter {
private void writeCDeclSpec(ICASTDeclSpecifier cDeclSpec) {
if (cDeclSpec.isRestrict()) {
- scribe.print(RESTRICT);
+ scribe.printStringSpace(Keywords.RESTRICT);
}
if (cDeclSpec instanceof ICASTCompositeTypeSpecifier) {
@@ -152,7 +136,7 @@ public class DeclSpecWriter extends NodeWriter {
private void writeNamedTypeSpecifier(ICPPASTNamedTypeSpecifier namedSpc) {
if (namedSpc.isTypename()) {
- scribe.print(TYPENAME);
+ scribe.printStringSpace(Keywords.TYPENAME);
}
namedSpc.getName().accept(visitor);
}
@@ -162,20 +146,20 @@ public class DeclSpecWriter extends NodeWriter {
}
private void writeElaboratedTypeSec(IASTElaboratedTypeSpecifier elabType) {
- scribe.print(getElabTypeString(elabType.getKind()));
+ scribe.printStringSpace(getElabTypeString(elabType.getKind()));
elabType.getName().accept(visitor);
}
private String getElabTypeString(int kind) {
switch (kind) {
case IASTElaboratedTypeSpecifier.k_enum:
- return ENUM_SPACE;
+ return Keywords.ENUM;
case IASTElaboratedTypeSpecifier.k_struct:
- return STRUCT_SPACE;
+ return Keywords.STRUCT;
case IASTElaboratedTypeSpecifier.k_union:
- return UNION_SPACE;
+ return Keywords.UNION;
case ICPPASTElaboratedTypeSpecifier.k_class:
- return CLASS_SPACE;
+ return Keywords.CLASS;
default:
throw new IllegalArgumentException("Unknown elaborated type: " + kind); //$NON-NLS-1$
@@ -184,19 +168,22 @@ public class DeclSpecWriter extends NodeWriter {
private void writeCPPDeclSpec(ICPPASTDeclSpecifier cppDelcSpec) {
if (cppDelcSpec.isVirtual()) {
- scribe.print(VIRTUAL);
+ scribe.printStringSpace(Keywords.VIRTUAL);
}
if (cppDelcSpec.isConstexpr()) {
- scribe.print(CONSTEXPR);
+ scribe.printStringSpace(Keywords.CONSTEXPR);
}
if (cppDelcSpec.isExplicit()) {
- scribe.print(EXPLICIT);
+ scribe.printStringSpace(Keywords.EXPLICIT);
}
if (cppDelcSpec.isFriend()) {
- scribe.print(FRIEND);
+ scribe.printStringSpace(Keywords.FRIEND);
+ }
+ if (cppDelcSpec.isThreadLocal()) {
+ scribe.printStringSpace(Keywords.THREAD_LOCAL);
}
if (cppDelcSpec.getStorageClass() == IASTDeclSpecifier.sc_mutable) {
- scribe.print(MUTABLE);
+ scribe.printStringSpace(Keywords.MUTABLE);
}
if (cppDelcSpec instanceof ICPPASTCompositeTypeSpecifier) {
@@ -213,7 +200,7 @@ public class DeclSpecWriter extends NodeWriter {
}
private void writeEnumSpec(IASTEnumerationSpecifier enumSpec) {
- scribe.print(ENUM_SPACE);
+ scribe.printStringSpace(Keywords.ENUM);
enumSpec.getName().accept(visitor);
scribe.print('{');
scribe.printSpace();
@@ -288,13 +275,13 @@ public class DeclSpecWriter extends NodeWriter {
private void writeBaseSpecifiers(ICPPASTBaseSpecifier specifier) {
switch (specifier.getVisibility()) {
case ICPPASTBaseSpecifier.v_public:
- scribe.printStringSpace(PUBLIC);
+ scribe.printStringSpace(Keywords.PUBLIC);
break;
case ICPPASTBaseSpecifier.v_protected:
- scribe.printStringSpace(PROTECTED);
+ scribe.printStringSpace(Keywords.PROTECTED);
break;
case ICPPASTBaseSpecifier.v_private:
- scribe.printStringSpace(PRIVATE);
+ scribe.printStringSpace(Keywords.PRIVATE);
break;
}
specifier.getName().accept(visitor);
@@ -306,7 +293,7 @@ public class DeclSpecWriter extends NodeWriter {
}
switch (key) {
case ICPPASTCompositeTypeSpecifier.k_class:
- return CLASS;
+ return Keywords.CLASS;
default:
throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
}
@@ -315,9 +302,9 @@ public class DeclSpecWriter extends NodeWriter {
private String getCompositeTypeString(int key) {
switch (key) {
case IASTCompositeTypeSpecifier.k_struct:
- return STRUCT;
+ return Keywords.STRUCT;
case IASTCompositeTypeSpecifier.k_union:
- return UNION;
+ return Keywords.UNION;
default:
throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
}
@@ -325,30 +312,30 @@ public class DeclSpecWriter extends NodeWriter {
private void writeDeclSpec(IASTDeclSpecifier declSpec) {
if (declSpec.isInline()) {
- scribe.print(INLINE);
+ scribe.printStringSpace(Keywords.INLINE);
}
switch (declSpec.getStorageClass()) {
case IASTDeclSpecifier.sc_typedef:
- scribe.print(TYPEDEF);
+ scribe.printStringSpace(Keywords.TYPEDEF);
break;
case IASTDeclSpecifier.sc_extern:
- scribe.print(EXTERN);
+ scribe.printStringSpace(Keywords.EXTERN);
break;
case IASTDeclSpecifier.sc_static:
- scribe.print(STATIC);
+ scribe.printStringSpace(Keywords.STATIC);
break;
case IASTDeclSpecifier.sc_auto:
- scribe.print(AUTO);
+ scribe.printStringSpace(Keywords.AUTO);
break;
case IASTDeclSpecifier.sc_register:
- scribe.print(REGISTER);
+ scribe.printStringSpace(Keywords.REGISTER);
break;
}
if (declSpec.isConst()) {
- scribe.printStringSpace(CONST);
+ scribe.printStringSpace(Keywords.CONST);
}
if (declSpec.isVolatile()) {
- scribe.printStringSpace(VOLATILE);
+ scribe.printStringSpace(Keywords.VOLATILE);
}
}
@@ -367,22 +354,23 @@ public class DeclSpecWriter extends NodeWriter {
private void printQualifiers(IASTSimpleDeclSpecifier simpDeclSpec) {
if (simpDeclSpec.isSigned()) {
- scribe.printStringSpace(SIGNED);
+ scribe.printStringSpace(Keywords.SIGNED);
} else if (simpDeclSpec.isUnsigned()) {
- scribe.printStringSpace(UNSIGNED);
+ scribe.printStringSpace(Keywords.UNSIGNED);
}
if (simpDeclSpec.isShort()) {
- scribe.printStringSpace(SHORT);
+ scribe.printStringSpace(Keywords.SHORT);
} else if (simpDeclSpec.isLong()) {
- scribe.printStringSpace(LONG);
+ scribe.printStringSpace(Keywords.LONG);
} else if (simpDeclSpec.isLongLong()) {
- scribe.print(LONG_LONG);
+ scribe.printStringSpace(Keywords.LONG);
+ scribe.printStringSpace(Keywords.LONG);
}
if (simpDeclSpec instanceof ICASTSimpleDeclSpecifier) {
ICASTSimpleDeclSpecifier cSimpDeclSpec = (ICASTSimpleDeclSpecifier) simpDeclSpec;
if (cSimpDeclSpec.isComplex()) {
- scribe.print(_COMPLEX);
+ scribe.printStringSpace(Keywords._COMPLEX);
}
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
index 2e4f6fcc36..dc15a60bdc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
@@ -51,10 +51,7 @@ public class DeclarationWriter extends NodeWriter {
private static final String ASM_END = ")"; //$NON-NLS-1$
private static final String ASM_START = "asm("; //$NON-NLS-1$
private static final String TEMPLATE_DECLARATION = "template<"; //$NON-NLS-1$
- private static final String EXPORT = "export "; //$NON-NLS-1$
private static final String TEMPLATE_SPECIALIZATION = "template <> "; //$NON-NLS-1$
- private static final String NAMESPACE = "namespace "; //$NON-NLS-1$
- private static final String USING = "using "; //$NON-NLS-1$
private boolean printSemicolon;
public DeclarationWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
@@ -111,15 +108,15 @@ public class DeclarationWriter extends NodeWriter {
scribe.decrementIndentationLevel();
switch (visiblityLabel.getVisibility()) {
case ICPPASTVisibilityLabel.v_private:
- scribe.print(PRIVATE);
+ scribe.print(Keywords.PRIVATE);
scribe.print(':');
break;
case ICPPASTVisibilityLabel.v_protected:
- scribe.print(PROTECTED);
+ scribe.print(Keywords.PROTECTED);
scribe.print(':');
break;
case ICPPASTVisibilityLabel.v_public:
- scribe.print(PUBLIC);
+ scribe.print(Keywords.PUBLIC);
scribe.print(':');
break;
default:
@@ -129,15 +126,16 @@ public class DeclarationWriter extends NodeWriter {
}
private void writeUsingDirective(ICPPASTUsingDirective usingDirective) {
- scribe.print(USING + NAMESPACE);
+ scribe.printStringSpace(Keywords.USING);
+ scribe.printStringSpace(Keywords.NAMESPACE);
usingDirective.getQualifiedName().accept(visitor);
scribe.printSemicolon();
}
private void writeUsingDeclaration(ICPPASTUsingDeclaration usingDeclaration) {
- scribe.print(USING);
+ scribe.printStringSpace(Keywords.USING);
if (usingDeclaration.isTypename()) {
- scribe.print(TYPENAME);
+ scribe.printStringSpace(Keywords.TYPENAME);
}
usingDeclaration.getName().accept(visitor);
scribe.printSemicolon();
@@ -150,7 +148,7 @@ public class DeclarationWriter extends NodeWriter {
protected void writeTemplateDeclaration(ICPPASTTemplateDeclaration templateDeclaration) {
if (templateDeclaration.isExported()) {
- scribe.print(EXPORT);
+ scribe.printStringSpace(Keywords.EXPORT);
}
scribe.print(TEMPLATE_DECLARATION);
ICPPASTTemplateParameter[] paraDecls = templateDeclaration.getTemplateParameters();
@@ -172,7 +170,7 @@ public class DeclarationWriter extends NodeWriter {
}
private void writeNamespaceDefinition(ICPPASTNamespaceDefinition namespaceDefinition) {
- scribe.print(NAMESPACE);
+ scribe.printStringSpace(Keywords.NAMESPACE);
namespaceDefinition.getName().accept(visitor);
if (!hasTrailingComments(namespaceDefinition.getName())) {
scribe.newLine();
@@ -200,7 +198,7 @@ public class DeclarationWriter extends NodeWriter {
}
private void writeNamespaceAlias(ICPPASTNamespaceAlias namespaceAliasDefinition) {
- scribe.print(NAMESPACE);
+ scribe.printStringSpace(Keywords.NAMESPACE);
namespaceAliasDefinition.getAlias().accept(visitor);
scribe.print(EQUALS);
namespaceAliasDefinition.getMappingName().accept(visitor);
@@ -208,9 +206,8 @@ public class DeclarationWriter extends NodeWriter {
}
private void writeLinkageSpecification(ICPPASTLinkageSpecification linkageSpecification) {
- scribe.print(EXTERN);
- scribe.print(linkageSpecification.getLiteral());
- scribe.printSpaces(1);
+ scribe.printStringSpace(Keywords.EXTERN);
+ scribe.printStringSpace(linkageSpecification.getLiteral());
IASTDeclaration[] declarations = linkageSpecification.getDeclarations();
if (declarations.length > 1) {
@@ -230,17 +227,17 @@ public class DeclarationWriter extends NodeWriter {
private void writeExplicitTemplateInstantiation(ICPPASTExplicitTemplateInstantiation explicitTemplateInstantiation) {
switch(explicitTemplateInstantiation.getModifier()) {
case ICPPASTExplicitTemplateInstantiation.EXTERN:
- scribe.print(EXTERN);
+ scribe.printStringSpace(Keywords.EXTERN);
break;
case ICPPASTExplicitTemplateInstantiation.INLINE:
- scribe.print(INLINE);
+ scribe.printStringSpace(Keywords.INLINE);
break;
case ICPPASTExplicitTemplateInstantiation.STATIC:
- scribe.print(STATIC);
+ scribe.printStringSpace(Keywords.STATIC);
break;
}
- scribe.print(TEMPLATE);
+ scribe.printStringSpace(Keywords.TEMPLATE);
explicitTemplateInstantiation.getDeclaration().accept(visitor);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
index 7d3fdf05c1..bf7a28e139 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
@@ -9,6 +9,7 @@
* Contributors:
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@@ -29,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
@@ -41,7 +43,6 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class DeclaratorWriter extends NodeWriter {
private static final String AMPERSAND_AMPERSAND = "&&"; //$NON-NLS-1$
private static final String PURE_VIRTUAL = " = 0"; //$NON-NLS-1$
- private static final String MUTABLE = "mutable"; //$NON-NLS-1$
private static final String ARROW_OPERATOR = "->"; //$NON-NLS-1$
public DeclaratorWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
@@ -128,15 +129,15 @@ public class DeclaratorWriter extends NodeWriter {
private void writeCppFunctionDeclarator(ICPPASTFunctionDeclarator funcDec) {
if (funcDec.isConst()) {
scribe.printSpace();
- scribe.print(CONST);
+ scribe.print(Keywords.CONST);
}
if (funcDec.isVolatile()) {
scribe.printSpace();
- scribe.print(VOLATILE);
+ scribe.print(Keywords.VOLATILE);
}
if (funcDec.isMutable()) {
scribe.printSpace();
- scribe.print(MUTABLE);
+ scribe.print(Keywords.MUTABLE);
}
if (funcDec.isPureVirtual()) {
scribe.print(PURE_VIRTUAL);
@@ -153,7 +154,7 @@ public class DeclaratorWriter extends NodeWriter {
protected void writeExceptionSpecification(ICPPASTFunctionDeclarator funcDec, IASTTypeId[] exceptions) {
if (exceptions != ICPPASTFunctionDeclarator.NO_EXCEPTION_SPECIFICATION) {
scribe.printSpace();
- scribe.print(THROW);
+ scribe.printStringSpace(Keywords.THROW);
scribe.print('(');
writeNodeList(exceptions);
scribe.print(')');
@@ -182,13 +183,13 @@ public class DeclaratorWriter extends NodeWriter {
}
if (operator.isConst()) {
- scribe.printStringSpace(CONST);
+ scribe.printStringSpace(Keywords.CONST);
}
if (operator.isVolatile()) {
- scribe.printStringSpace(VOLATILE);
+ scribe.printStringSpace(Keywords.VOLATILE);
}
if (operator.isRestrict()) {
- scribe.print(RESTRICT);
+ scribe.printStringSpace(Keywords.RESTRICT);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
index 150f6c7454..774aa8791e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
@@ -39,6 +39,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTBinaryExpression;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
@@ -112,6 +113,7 @@ public class ExpressionWriter extends NodeWriter{
private static final String OPENING_SQUARE_BRACKET = "["; //$NON-NLS-1$
private static final String CLOSING_SQUARE_BRACKET = "]"; //$NON-NLS-1$
private static final String THIS = "this"; //$NON-NLS-1$
+ private static final String THROW = "throw "; //$NON-NLS-1$
private final MacroExpansionHandler macroHandler;
public ExpressionWriter(Scribe scribe, ASTWriterVisitor visitor, MacroExpansionHandler macroHandler, NodeCommentMap commentMap) {
@@ -423,7 +425,7 @@ public class ExpressionWriter extends NodeWriter{
if (fieldRef instanceof ICPPASTFieldReference) {
ICPPASTFieldReference cppFieldRef = (ICPPASTFieldReference) fieldRef;
if (cppFieldRef.isTemplate()) {
- scribe.print(TEMPLATE);
+ scribe.printStringSpace(Keywords.TEMPLATE);
}
}
fieldRef.getFieldName().accept(visitor);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
index 941931511c..610f86a6f3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeParameter;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -58,7 +59,7 @@ public class NameWriter extends NodeWriter {
private void writeTempalteId(ICPPASTTemplateId tempId) {
if (needsTemplateQualifier(tempId)) {
- scribe.print(TEMPLATE);
+ scribe.printStringSpace(Keywords.TEMPLATE);
}
scribe.print(tempId.getTemplateName().toString());
scribe.print('<');
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
index 1a5e4b1e44..6e654b9b71 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
@@ -30,31 +30,7 @@ public class NodeWriter {
protected NodeCommentMap commentMap;
protected static final String COMMA_SPACE = ", "; //$NON-NLS-1$
protected static final String EQUALS = " = "; //$NON-NLS-1$
- protected static final String RESTRICT = "restrict "; //$NON-NLS-1$
- protected static final String TYPENAME = "typename "; //$NON-NLS-1$
- protected static final String PUBLIC = "public"; //$NON-NLS-1$
- protected static final String PRIVATE = "private"; //$NON-NLS-1$
- protected static final String PROTECTED = "protected"; //$NON-NLS-1$
- protected static final String CONST = "const"; //$NON-NLS-1$
- protected static final String VOLATILE = "volatile"; //$NON-NLS-1$
- protected static final String INLINE = "inline "; //$NON-NLS-1$
- protected static final String EXTERN = "extern "; //$NON-NLS-1$
- protected static final String STATIC = "static "; //$NON-NLS-1$
- protected static final String THROW = "throw "; //$NON-NLS-1$
protected static final String SPACE_COLON_SPACE = " : "; //$NON-NLS-1$
- protected static final String TEMPLATE = "template "; //$NON-NLS-1$
- protected static final String DOUBLE = "double"; //$NON-NLS-1$
- protected static final String FLOAT = "float"; //$NON-NLS-1$
- protected static final String INT = "int"; //$NON-NLS-1$
- protected static final String CHAR = "char"; //$NON-NLS-1$
- protected static final String VOID = "void"; //$NON-NLS-1$
- protected static final String WCHAR_T = "wchar_t"; //$NON-NLS-1$
- protected static final String CPP_BOOL = "bool"; //$NON-NLS-1$
- protected static final String LONG = "long"; //$NON-NLS-1$
- protected static final String SHORT = "short"; //$NON-NLS-1$
- protected static final String UNSIGNED = "unsigned"; //$NON-NLS-1$
- protected static final String SIGNED = "signed"; //$NON-NLS-1$
- protected static final String CLASS_SPACE = "class "; //$NON-NLS-1$
protected static final String VAR_ARGS = "..."; //$NON-NLS-1$
protected static final String COLON_COLON = "::"; //$NON-NLS-1$
protected static final String COLON_SPACE = ": "; //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
index 64d1167957..d4e09f4d92 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
@@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
@@ -69,10 +70,10 @@ public class TemplateParameterWriter extends NodeWriter {
private void writeSimpleTypeTemplateParameter(ICPPASTSimpleTypeTemplateParameter simple) {
switch (simple.getParameterType()) {
case ICPPASTSimpleTypeTemplateParameter.st_class:
- scribe.print(CLASS_SPACE);
+ scribe.printStringSpace(Keywords.CLASS);
break;
case ICPPASTSimpleTypeTemplateParameter.st_typename:
- scribe.print(TYPENAME);
+ scribe.printStringSpace(Keywords.TYPENAME);
break;
}

Back to the top