Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
2b2f6935
Commit
2b2f6935
authored
Jun 09, 2021
by
Vladimír Štill
Browse files
checker: Adapt to changes in lib
parent
3b77ae67
Changes
1
Show whitespace changes
Inline
Side-by-side
fja_checker/__main__.py
View file @
2b2f6935
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
(
","
))
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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment