Loading fja_checker/__main__.py +4 −4 Original line number Diff line number Diff line 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 Loading Loading @@ -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(",")) try: 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}")) exit(1) try: 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}")) exit(1) Loading Loading
fja_checker/__main__.py +4 −4 Original line number Diff line number Diff line 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 Loading Loading @@ -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(",")) try: 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}")) exit(1) try: 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}")) exit(1) Loading