checking in changes
[IRC.git] / Robust / src / IR / Flat / FlatLiteralNode.java
1 package IR.Flat;
2 import IR.TypeDescriptor;
3
4 public class FlatLiteralNode extends FlatNode {
5     Object value;
6     TypeDescriptor type;
7     TempDescriptor dst;
8
9     public FlatLiteralNode(TypeDescriptor type, Object o, TempDescriptor dst) {
10         this.type=type;
11         value=o;
12         this.dst=dst;
13     }
14
15     public Object getValue() {
16         return value;
17     }
18
19     public String printNode(int indent) {
20         /*      if (type==NULL)
21             return dst+"=null";
22             if (type==STRING) {
23             return dst+"="+'"'+escapeString(value.toString())+'"';
24             }*/
25         //return dst+"="+"/*"+getType()+ "*/"+value.toString();
26         return "";
27     }
28     private static String escapeString(String st) {
29         String new_st="";
30         for(int i=0;i<st.length();i++) {
31             char x=st.charAt(i);
32             if (x=='\n')
33                 new_st+="\\n";
34             else if (x=='"')
35                 new_st+="'"+'"'+"'";
36             else new_st+=x;
37         }
38         return new_st;
39     }
40 }