File tree 1 file changed +16
-1
lines changed
src/org/sosy_lab/java_smt/solvers/yices2
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ public void appendTo(Appendable out) throws IOException {
88
88
}
89
89
if (types .length > 0 ) {
90
90
out .append ("(declare-fun " );
91
- out .append (PrintTerm . quoteIdentifier (entry .getKey ()));
91
+ out .append (quoteIdentifier (entry .getKey ()));
92
92
out .append (" (" );
93
93
for (int i = 0 ; i < types .length - 1 ; i ++) {
94
94
out .append (getTypeRepr (types [i ]));
@@ -111,4 +111,19 @@ private String getTypeRepr(int type) {
111
111
}
112
112
};
113
113
}
114
+
115
+ /** copied from {@link PrintTerm#quoteIdentifier(String)} */
116
+ private static String quoteIdentifier (String id ) {
117
+ assert id .indexOf ('|' ) < 0 && id .indexOf ('\\' ) < 0 ;
118
+ for (int idx = 0 ; idx < id .length (); idx ++) {
119
+ final char c = id .charAt (idx );
120
+ if (!(c >= 'A' && c <= 'Z' )
121
+ && !(c >= 'a' && c <= 'z' )
122
+ && !(c >= '0' && c <= '9' && idx > 0 )
123
+ && "~!@$%^&*_+-=<>.?/" .indexOf (c ) < 0 ) {
124
+ return "|" + id + "|" ;
125
+ }
126
+ }
127
+ return id ;
128
+ }
114
129
}
You can’t perform that action at this time.
0 commit comments