Commit 2b2f6935 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

checker: Adapt to changes in lib

parent 3b77ae67
import lib.reg as reg
import lib.cfl as cfl
from lib.parsing import Parser, ParsingError
from lib import parser
from lib.parser import ParsingError
from lib.checker import get_task, dfa_transform, nfa_transform, check_task, check_empty, check_alphabets, exit_correct, exit_incorrect
import sys
import signal
......@@ -95,19 +96,18 @@ def exit_cfl_ok_but_invalid_constraint(msg : str) -> None:
def cfg_task(teacher_type: str, teacher_string: str, task: str,
student_string: str) -> None:
parser = Parser()
assert task[:3] == "CFG", f"Invalid task prefix {task[:3]}"
if len(task) > 3:
assert task[3] == '+', f"Invalid task suffix {task[3:]}"
constraints = filter(lambda x: len(x) != 0, task[4:].split(","))
teacher_solution = parser.str_to_cfg(teacher_string)
teacher_solution = parser.cfg(teacher_string)
except ParsingError as message:
print(paragraph(f"Error parsing teacher's solution: {message}"))
student_solution = parser.str_to_cfg(student_string)
student_solution = parser.cfg(student_string)
except ParsingError as message:
print(paragraph(f"Error parsing student's solution: {message}"))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment