@@ -137,6 +137,15 @@ private static boolean matchesOneOf(String token, String... regexp) {
137137 return token .matches ("\\ (\\ s*(" + String .join ("|" , regexp ) + ")[\\ S\\ s]*" );
138138 }
139139
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+
140149 /**
141150 * Check if the token is a function or variable declaration.
142151 *
@@ -165,16 +174,43 @@ public static boolean isAssertToken(String token) {
165174 }
166175
167176 /**
168- * Check if the token is <code>(set-logic ..)</code>.
177+ * Check if the token is an <code>(push . ..)</code>.
169178 *
170179 * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
171180 */
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" );
174210 }
175211
176212 /**
177- * Check if the token is <code>(exit ... )</code>.
213+ * Check if the token is <code>(exit)</code>.
178214 *
179215 * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
180216 */
@@ -197,6 +233,9 @@ public static boolean isExitToken(String token) {
197233 * <p>Use {@link #tokenize(String)} to turn an SMT-LIB2 script into a string of input tokens.
198234 */
199235 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 );
201240 }
202241}
0 commit comments