@@ -137,6 +137,15 @@ private static boolean matchesOneOf(String token, String... regexp) {
137
137
return token .matches ("\\ (\\ s*(" + String .join ("|" , regexp ) + ")[\\ S\\ s]*" );
138
138
}
139
139
140
+ /**
141
+ * Check if the token is <code>(set-logic ..)</code>.
142
+ *
143
+ * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
144
+ */
145
+ public static boolean isSetLogicToken (String token ) {
146
+ return matchesOneOf (token , "set-logic" );
147
+ }
148
+
140
149
/**
141
150
* Check if the token is a function or variable declaration.
142
151
*
@@ -165,16 +174,43 @@ public static boolean isAssertToken(String token) {
165
174
}
166
175
167
176
/**
168
- * Check if the token is <code>(set-logic ..)</code>.
177
+ * Check if the token is an <code>(push . ..)</code>.
169
178
*
170
179
* <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
171
180
*/
172
- public static boolean isSetLogicToken (String token ) {
173
- return matchesOneOf (token , "set-logic" );
181
+ public static boolean isPushToken (String token ) {
182
+ return matchesOneOf (token , "push" );
183
+ }
184
+
185
+ /**
186
+ * Check if the token is an <code>(pop ...)</code>.
187
+ *
188
+ * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
189
+ */
190
+ public static boolean isPopToken (String token ) {
191
+ return matchesOneOf (token , "pop" );
192
+ }
193
+
194
+ /**
195
+ * Check if the token is an <code>(reset-assertions ...)</code>.
196
+ *
197
+ * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
198
+ */
199
+ public static boolean isResetAssertionsToken (String token ) {
200
+ return matchesOneOf (token , "reset-assertions" );
201
+ }
202
+
203
+ /**
204
+ * Check if the token is an <code>(reset)</code>.
205
+ *
206
+ * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
207
+ */
208
+ public static boolean isResetToken (String token ) {
209
+ return matchesOneOf (token , "reset" );
174
210
}
175
211
176
212
/**
177
- * Check if the token is <code>(exit ... )</code>.
213
+ * Check if the token is <code>(exit)</code>.
178
214
*
179
215
* <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
180
216
*/
@@ -197,6 +233,9 @@ public static boolean isExitToken(String token) {
197
233
* <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
198
234
*/
199
235
public static boolean isUnsupportedToken (String token ) {
200
- return matchesOneOf (token , "push" , "pop" , "reset-assertions" , "reset" );
236
+ return isPushToken (token )
237
+ | isPopToken (token )
238
+ | isResetAssertionsToken (token )
239
+ | isResetToken (token );
201
240
}
202
241
}
0 commit comments