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: /**
24: * @author Gerald Brose
25: * @version $Id: ShiftExpr.java,v 1.14 2006/06/19 10:34:57 alphonse.bendt Exp $
26: */
27:
28: import java.io.PrintWriter;
29:
30: public class ShiftExpr extends IdlSymbol {
31: public ShiftExpr shift_expr = null;
32: public AddExpr add_expr;
33: public String operator;
34:
35: public ShiftExpr(int num) {
36: super (num);
37: }
38:
39: public void print(PrintWriter ps) {
40: if (shift_expr != null) {
41: shift_expr.print(ps);
42: ps.print(operator);
43: }
44: add_expr.print(ps);
45: }
46:
47: public void setDeclaration(ConstDecl declared_in) {
48: add_expr.setDeclaration(declared_in);
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: if (shift_expr != null) {
58: shift_expr.setPackage(s);
59: }
60: add_expr.setPackage(s);
61: }
62:
63: public void parse() {
64: if (shift_expr != null) {
65: shift_expr.parse();
66: }
67: add_expr.parse();
68: }
69:
70: int pos_int_const() {
71: return add_expr.pos_int_const();
72: }
73:
74: public String value() {
75: String x = "";
76: if (shift_expr != null) {
77: x = shift_expr.value() + operator;
78: }
79: return x + add_expr.value();
80: }
81:
82: public String toString() {
83: String x = "";
84: if (shift_expr != null) {
85: x = shift_expr + operator;
86: }
87: return x + add_expr;
88: }
89:
90: public str_token get_token() {
91: return add_expr.get_token();
92: }
93: }
|