Commit 6fb34b80 authored by Ralf Jung's avatar Ralf Jung
Browse files

update gen-exercises

parent 51d52de9
BEGIN {
in_solution = 0;
in_solution = 0; # for the advanced solution syntax
in_auto_solution = 0; # for the simple solution syntax that recognizes `Qed.`
}
{ # on every line of the input
if (match($0, /^( *)\(\* *SOLUTION *\*\) *Proof.$/, groups)) {
print groups[1] "Proof."
in_solution = 1
} else if (in_solution == 1 && match($0, /^( *)Qed.$/, groups)) {
in_auto_solution = 1
} else if (in_auto_solution == 1 && match($0, /^( *)Qed.$/, groups)) {
print groups[1] " (* exercise *)"
print groups[1] "Admitted."
in_solution = 0
in_auto_solution = 0
} else if (match($0, /^( *)\(\* *BEGIN SOLUTION *\*\)$/, groups)) {
in_solution = 1
} else if (match($0, /^( *)\(\* *END SOLUTION BEGIN TEMPLATE *$/, groups)) {
in_solution = 0
} else if (match($0, /^( *)END TEMPLATE *\*\)$/, groups)) {
# Nothing to do, just do not print this line.
} else if (in_solution == 0) {
} else if (in_solution == 0 && in_auto_solution == 0) {
gsub("From solutions Require", "From exercises Require")
print
}
......
Markdown is supported
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