1 | package de.uka.ipd.sdq.pcm.dialogs.stoex; |
2 | |
3 | import org.antlr.runtime.Token; |
4 | import org.eclipse.jface.text.rules.IToken; |
5 | |
6 | public class ANTLRTokenWrapper implements IToken { |
7 | |
8 | private Token token; |
9 | private boolean isUndefined; |
10 | private ITokenMapper mapper; |
11 | private boolean isWhitespace; |
12 | |
13 | public ANTLRTokenWrapper(Token t, ITokenMapper myMapper) |
14 | { |
15 | this.token = t; |
16 | this.isUndefined = false; |
17 | this.isWhitespace = false; |
18 | this.mapper = myMapper; |
19 | } |
20 | |
21 | public Object getData() { |
22 | if (mapper == null) |
23 | return null; |
24 | return mapper.mapColor(token); |
25 | } |
26 | |
27 | public boolean isEOF() { |
28 | if (token == null) |
29 | return false; |
30 | return token == Token.EOF_TOKEN; |
31 | } |
32 | |
33 | public boolean isOther() { |
34 | return false; |
35 | } |
36 | |
37 | public boolean isUndefined() { |
38 | return isUndefined; |
39 | } |
40 | |
41 | public boolean isWhitespace() { |
42 | return isWhitespace; |
43 | } |
44 | |
45 | public void setIsWhitespace(boolean isWhitespace) { |
46 | this.isWhitespace = isWhitespace; |
47 | } |
48 | |
49 | public Token getToken() { |
50 | return token; |
51 | } |
52 | } |