Skip to content

Commit

Permalink
Make parsing fail on non-empty queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mroik committed Jul 24, 2024
1 parent 4f87287 commit 4cd211e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ impl App {
| State::OrState(OrState::EliminateGetAssumption) => {
("And expression to eliminate", true)
}
State::AndState(AndState::EliminateGetProposition(_)) => {
("Resulting expression", true)
}
State::AndState(AndState::EliminateGetProposition(_)) => ("Resulting expression", true),
State::OrState(OrState::EliminateGetLeftSubproof(_))
| State::OrState(OrState::EliminateGetRightSubproof(_, _))
| State::ImpliesState(ImpliesState::Introduce)
Expand Down Expand Up @@ -319,6 +317,9 @@ impl App {
parser::Result::Failure => app_context
.info_buffer
.push_str("The input expression is not valid"),
parser::Result::Success(_, rest) if rest.trim() != "" => app_context
.info_buffer
.push_str("The input expression is not valid"),
parser::Result::Success(ris, _) => {
if !app_context.model.introduce_or(ass, &ris) {
app_context.info_buffer.push_str(
Expand Down Expand Up @@ -436,6 +437,9 @@ impl App {
parser::Result::Failure => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(_, rest) if rest.trim() != "" => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(r, _) => {
if !app_context.model.eliminate_and(assum, &r) {
app_context
Expand Down Expand Up @@ -507,6 +511,9 @@ impl App {
parser::Result::Failure => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(_, rest) if rest.trim() != "" => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(ded, _) => {
if !app_context.model.eliminate_absurdum(assum, &ded) {
app_context
Expand Down Expand Up @@ -565,6 +572,9 @@ impl App {
parser::Result::Failure => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(_, rest) if rest.trim() != "" => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(expr, _) => {
app_context.model.add_subproof(&expr);
app_context.state = State::Noraml;
Expand All @@ -582,6 +592,9 @@ impl App {
parser::Result::Failure => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(_, rest) if rest.trim() != "" => app_context
.info_buffer
.push_str("Expression entered is invalid"),
parser::Result::Success(expr, _) => {
if !app_context.model.add_assumption(&expr) {
app_context
Expand Down

0 comments on commit 4cd211e

Please sign in to comment.