]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/PrintingContext.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / contexts / PrintingContext.java
1 package org.simantics.scl.compiler.elaboration.contexts;
2
3 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
4
5 public class PrintingContext {
6     StringBuilder b;
7     public TypeUnparsingContext tuc;
8     int indentation;
9     
10     public PrintingContext() {
11         this.b = new StringBuilder();
12         this.tuc = new TypeUnparsingContext();
13         this.indentation = 0;
14     }
15     
16     public void indent() {
17         ++indentation;
18     }
19     
20     public void dedent() {
21         --indentation;
22     }
23     
24     public void newLine() {
25         b.append('\n');
26         for(int i=0;i<indentation;++i)
27             b.append("    ");
28     }
29     
30     public void append(String str) {
31         b.append(str);
32     }
33     
34     @Override
35     public String toString() {
36         return b.toString();
37     }
38
39     public void append(char c) {
40         b.append(c);
41     }
42
43     public void append(Object obj) {
44         b.append(obj);
45     }
46 }