blob: b7e8290130d387088647fa51ee8066ad666b40a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
/**
* Used for inserting literal code by means of the rewrite facility. The node
* will never appear in an AST tree.
* @since 5.0
*/
public class ASTLiteralNode implements IASTNode {
private final String fCode;
public ASTLiteralNode(String code) {
fCode= code;
}
public String getRawSignature() {
return fCode;
}
public boolean accept(ASTVisitor visitor) {
if (visitor instanceof ASTWriterVisitor) {
((ASTWriterVisitor) visitor).visit(this);
}
return true;
}
public boolean contains(IASTNode node) {
return false;
}
public String getContainingFilename() {
return null;
}
public IASTFileLocation getFileLocation() {
return null;
}
public IASTNodeLocation[] getNodeLocations() {
return null;
}
public IASTNode getParent() {
return null;
}
public IASTNode[] getChildren() {
return IASTNode.EMPTY_NODE_ARRAY;
}
public ASTNodeProperty getPropertyInParent() {
return null;
}
public IASTTranslationUnit getTranslationUnit() {
return null;
}
public boolean isPartOfTranslationUnitFile() {
return false;
}
public void setParent(IASTNode node) {
}
public void setPropertyInParent(ASTNodeProperty property) {
}
public IToken getLeadingSyntax() {
throw new UnsupportedOperationException();
}
public IToken getTrailingSyntax() {
throw new UnsupportedOperationException();
}
public boolean isFrozen() {
return false;
}
}
|