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