#!/bin/bash

# for runsolver
# result=`head -n 1 $1 | sed 's/^[^\t]*\t//'`
# for BenchExev
result=`head -n 1 $1`

regex="YES|NO|AST|SAST|PAST|WORST_CASE\((\?|NON_POLY|Omega\(n\^([0-9]+)\)),(\?|POLY|O\((1|n\^([0-9]+))\))\)"

# WORST_CASE(?,?) is matched by the regex above, but it's not valid:
# http://cl-informatik.uibk.ac.at/users/georg/cbr/competition/rules.php
if [ "$result" = "WORST_CASE(?,?)" ];
then
    echo "starexec-result=MAYBE"
elif [[ "$result" =~ $regex ]];
then
    echo "starexec-result=$result"
else
    echo "starexec-result=MAYBE"
fi

