blob: d0ae73b718e5c23712b7630dde9d032a9cb439bd (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*******************************************************************************
* Copyright (c) 2009, 2020 Borland Software Corp, CEA LIST, Artal
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Alexander Shatalin (Borland) - initial API and implementation
* Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
*****************************************************************************/
package org.eclipse.papyrus.gmf.internal.xpand.ast;
import org.eclipse.papyrus.gmf.internal.xpand.model.XpandAdvice;
import org.eclipse.papyrus.gmf.internal.xpand.model.XpandDefinition;
import org.eclipse.papyrus.gmf.internal.xpand.ocl.ExpressionHelper;
public abstract class AbstractAstVisitor implements AstVisitor {
public boolean visit(Template template) {
return true;
}
public boolean visit(XpandAdvice advice) {
if (advice instanceof AbstractDefinition) {
return visit((AbstractDefinition) advice);
}
return true;
}
public boolean visit(XpandDefinition definition) {
if (definition instanceof AbstractDefinition) {
return visit((AbstractDefinition) definition);
}
return true;
}
protected boolean visit(AbstractDefinition definition) {
return true;
}
public boolean visit(ErrorStatement statement) {
visitExpressionHelper(statement.getMessage());
return true;
}
public boolean visit(ExpandStatement statement) {
for (ExpressionHelper parameter : statement.getParameters()) {
visitExpressionHelper(parameter);
}
if (statement.getSeparator() != null) {
visitExpressionHelper(statement.getSeparator());
}
if (statement.getTarget() != null) {
visitExpressionHelper(statement.getTarget());
}
return true;
}
public boolean visit(ExpressionStatement statement) {
visitExpressionHelper(statement.getExpression());
return true;
}
public boolean visit(FileStatement statement) {
visitExpressionHelper(statement.getTargetFileName());
return true;
}
public boolean visit(ForEachStatement statement) {
if (statement.getSeparator() != null) {
visitExpressionHelper(statement.getSeparator());
}
visitExpressionHelper(statement.getTarget());
return true;
}
public boolean visit(IfStatement statement) {
if (statement.getCondition() != null) {
visitExpressionHelper(statement.getCondition());
}
return true;
}
public boolean visit(LetStatement statement) {
visitExpressionHelper(statement.getVarValue());
return true;
}
public boolean visit(ProtectStatement statement) {
visitExpressionHelper(statement.getCommentStart());
visitExpressionHelper(statement.getCommentEnd());
visitExpressionHelper(statement.getId());
return true;
}
public boolean visit(TextStatement statement) {
return true;
}
public boolean visit(Statement statement) {
return true;
}
protected void visitExpressionHelper(ExpressionHelper expressionHelper) {
}
}
|