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: XorExpr.java,v 1.14 2006/06/19 10:34:57 alphonse.bendt Exp $
28: */
29:
30: public class XorExpr extends IdlSymbol {
31: public XorExpr xor_expr = null;
32: public AndExpr and_expr;
33:
34: public XorExpr(int num) {
35: super (num);
36: }
37:
38: public void print(PrintWriter ps) {
39: if (xor_expr != null) {
40: xor_expr.print(ps);
41: ps.print(" ^ ");
42: }
43: and_expr.print(ps);
44: }
45:
46: public void setDeclaration(ConstDecl declared_in) {
47: and_expr.setDeclaration(declared_in);
48: }
49:
50: public void setPackage(String s) {
51: s = parser.pack_replace(s);
52: if (pack_name.length() > 0)
53: pack_name = s + "." + pack_name;
54: else
55: pack_name = s;
56: if (xor_expr != null) {
57: xor_expr.setPackage(s);
58: }
59: and_expr.setPackage(s);
60: }
61:
62: public void parse() {
63: if (xor_expr != null) {
64: xor_expr.parse();
65: }
66: and_expr.parse();
67: }
68:
69: int pos_int_const() {
70: return and_expr.pos_int_const();
71: }
72:
73: public String value() {
74: String x = "";
75: if (xor_expr != null) {
76: x = xor_expr.value() + "^";
77: }
78: return x + and_expr.value();
79: }
80:
81: public String toString() {
82: String x = "";
83: if (xor_expr != null) {
84: x = xor_expr + "^";
85: }
86: return x + and_expr;
87: }
88:
89: public str_token get_token() {
90: return and_expr.get_token();
91: }
92: }
|