pub trait ClauseParsing<'a, 'ctx, 'int> {
Show 16 methods
// Required methods
fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_disjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_relative_clause(
&mut self,
gap_var: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_gapped_clause(
&mut self,
borrowed_verb: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_counterfactual_antecedent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>;
fn parse_counterfactual_consequent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>;
fn check_wh_word(&self) -> bool;
fn is_counterfactual_context(&self) -> bool;
fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool;
fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>;
fn try_parse_ellipsis(
&mut self,
) -> Option<Result<&'a LogicExpr<'a>, ParseError>>;
fn check_ellipsis_auxiliary(&self) -> bool;
fn check_ellipsis_terminator(&self) -> bool;
}Expand description
Trait for parsing clause-level structures.
Defines methods for parsing sentences, conditionals, conjunctions, and other clause-level constructs.
Required Methods§
Sourcefn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Parses a complete sentence, handling imperatives, ellipsis, and questions.
Sourcefn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “if P then Q” conditionals with DRS scope handling.
Sourcefn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “either P or Q” exclusive disjunctions.
Sourcefn parse_disjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_disjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “P or Q” disjunctions.
Sourcefn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “P and Q” conjunctions with scope coordination.
Sourcefn parse_relative_clause(
&mut self,
gap_var: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_relative_clause( &mut self, gap_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “who/that/which” relative clauses attaching to noun phrases.
Sourcefn parse_gapped_clause(
&mut self,
borrowed_verb: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_gapped_clause( &mut self, borrowed_verb: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Parses a clause with a gap filled by borrowed verb (for VP coordination).
Sourcefn parse_counterfactual_antecedent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_counterfactual_antecedent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “if P were/had” counterfactual antecedent (subjunctive).
Sourcefn parse_counterfactual_consequent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_counterfactual_consequent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>
Parses “Q would” counterfactual consequent.
Sourcefn check_wh_word(&self) -> bool
fn check_wh_word(&self) -> bool
Checks if current token is a wh-word (who, what, which, etc.).
Sourcefn is_counterfactual_context(&self) -> bool
fn is_counterfactual_context(&self) -> bool
Returns true if parsing a counterfactual context.
Sourcefn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool
fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool
Returns true if expression is a complete clause.
Sourcefn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>
fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>
Extracts the main verb from an expression.
Sourcefn try_parse_ellipsis(
&mut self,
) -> Option<Result<&'a LogicExpr<'a>, ParseError>>
fn try_parse_ellipsis( &mut self, ) -> Option<Result<&'a LogicExpr<'a>, ParseError>>
Attempts to parse VP ellipsis (“Mary did too”).
Sourcefn check_ellipsis_auxiliary(&self) -> bool
fn check_ellipsis_auxiliary(&self) -> bool
Checks for ellipsis auxiliary (did, does, can, etc.).
Sourcefn check_ellipsis_terminator(&self) -> bool
fn check_ellipsis_terminator(&self) -> bool
Checks for ellipsis terminator (too, also, as well).