1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jexl3.parser;
18
19 import org.apache.commons.jexl3.internal.LexicalScope;
20
21
22
23
24
25 public abstract class JexlLexicalNode extends JexlNode implements JexlParser.LexicalUnit {
26 private static final long serialVersionUID = 1L;
27
28 private LexicalScope lexicalScope;
29
30 public JexlLexicalNode(final int id) {
31 super(id);
32 }
33
34 @Override
35 public boolean declareSymbol(final int symbol) {
36 if (lexicalScope == null) {
37 lexicalScope = new LexicalScope();
38 }
39 return lexicalScope.addSymbol(symbol);
40 }
41
42 @Override
43 public LexicalScope getLexicalScope() {
44 return lexicalScope;
45 }
46
47 @Override
48 public int getSymbolCount() {
49 return lexicalScope == null ? 0 : lexicalScope.getSymbolCount();
50 }
51
52 @Override
53 public boolean hasSymbol(final int symbol) {
54 return lexicalScope != null && lexicalScope.hasSymbol(symbol);
55 }
56
57 @Override
58 public boolean isConstant(final int symbol) {
59 return lexicalScope != null && lexicalScope.isConstant(symbol);
60 }
61
62 @Override
63 public void jjtClose() {
64
65 }
66
67 @Override
68 public void setConstant(final int symbol) {
69 lexicalScope.addConstant(symbol);
70 }
71 }