forked from regb/scala-smtlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Printer.scala
71 lines (59 loc) · 1.74 KB
/
Printer.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package smtlib
package printer
import parser.Commands._
import parser.CommandsResponses._
import parser.Terms._
import java.io.Writer
import java.io.StringWriter
import java.io.BufferedWriter
trait Printer {
val name: String
def printScript(script: Script, writer: Writer): Unit
def printCommand(command: Command, writer: Writer): Unit
def printTerm(term: Term, writer: Writer): Unit
def printSort(sort: Sort, writer: Writer): Unit
def printCommandResponse(response: CommandResponse, writer: Writer): Unit
def printSExpr(sExpr: SExpr, writer: Writer): Unit
def toString(script: Script): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printScript(script, sWriter)
sWriter.flush()
output.toString
}
def toString(command: Command): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printCommand(command, sWriter)
sWriter.flush()
output.toString
}
def toString(term: Term): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printTerm(term, sWriter)
sWriter.flush()
output.toString
}
def toString(sort: Sort): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printSort(sort, sWriter)
sWriter.flush()
output.toString
}
def toString(response: CommandResponse): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printCommandResponse(response, sWriter)
sWriter.flush()
output.toString
}
def toString(sExpr: SExpr): String = {
val output = new StringWriter
val sWriter = new BufferedWriter(output)
printSExpr(sExpr, sWriter)
sWriter.flush()
output.toString
}
}