01: package org.jacorb.idl;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Library General Public License for more details.
17: *
18: * You should have received a copy of the GNU Library General Public
19: * License along with this library; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: */
22:
23: import java.io.PrintWriter;
24:
25: /**
26: * @author Gerald Brose
27: * @version $Id: AndExpr.java,v 1.16 2006/06/19 10:34:57 alphonse.bendt Exp $
28: */
29:
30: public class AndExpr extends IdlSymbol {
31: public AndExpr and_expr = null;
32: public ShiftExpr shift_expr;
33:
34: public AndExpr(int num) {
35: super (num);
36: }
37:
38: public void print(PrintWriter ps) {
39: if (and_expr != null) {
40: and_expr.print(ps);
41: ps.print(" & ");
42: }
43: shift_expr.print(ps);
44: }
45:
46: public void setDeclaration(ConstDecl declared_in) {
47: shift_expr.setDeclaration(declared_in);
48: }
49:
50: public void setPackage(String packageName) {
51: packageName = parser.pack_replace(packageName);
52: if (pack_name.length() > 0) {
53: pack_name = packageName + "." + pack_name;
54: } else {
55: pack_name = packageName;
56: }
57:
58: if (and_expr != null) {
59: and_expr.setPackage(packageName);
60: }
61: shift_expr.setPackage(packageName);
62: }
63:
64: public void parse() {
65: if (and_expr != null) {
66: and_expr.parse();
67: }
68: shift_expr.parse();
69: }
70:
71: int pos_int_const() {
72: return shift_expr.pos_int_const();
73: }
74:
75: public String value() {
76: String x = "";
77: if (and_expr != null) {
78: x = and_expr.value() + "&";
79: }
80: return x + shift_expr.value();
81: }
82:
83: public String toString() {
84: String x = "";
85: if (and_expr != null) {
86: x = and_expr + "&";
87: }
88: return x + shift_expr;
89: }
90:
91: public str_token get_token() {
92: return shift_expr.get_token();
93: }
94: }
|