01: /*
02: * Copyright 2002-2006 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.commons.jexl.parser;
17:
18: import org.apache.commons.jexl.JexlContext;
19:
20: /**
21: * represents a quoted string.
22: *
23: * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
24: * @version $Id: ASTStringLiteral.java 398324 2006-04-30 12:20:24Z dion $
25: */
26: public class ASTStringLiteral extends SimpleNode {
27: /** the parsed literal. */
28: protected String literal;
29:
30: /**
31: * Create the node given an id.
32: *
33: * @param id node id.
34: */
35: public ASTStringLiteral(int id) {
36: super (id);
37: }
38:
39: /**
40: * Create a node with the given parser and id.
41: *
42: * @param p a parser.
43: * @param id node id.
44: */
45: public ASTStringLiteral(Parser p, int id) {
46: super (p, id);
47: }
48:
49: /** {@inheritDoc} */
50: public Object jjtAccept(ParserVisitor visitor, Object data) {
51: return visitor.visit(this , data);
52: }
53:
54: /** {@inheritDoc} */
55: public Object value(JexlContext jc) throws Exception {
56: return literal;
57: }
58: }
|