Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use word_opt instead of tag_opt #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ impl<'cxt, 's> Parser<'cxt, 's> {

if let Some(pos) = self.tag_opt_pos("(") {
self.ws_cmt();
if self.tag_opt(keywords::let_) {
if self.word_opt(keywords::let_) {
n += 1;
self.push_bind();
self.ws_cmt();
Expand Down Expand Up @@ -1751,21 +1751,10 @@ impl<'cxt, 's> Parser<'cxt, 's> {

/// Bool parser.
pub fn bool(&mut self) -> Option<bool> {
let start_pos = self.pos();
if self.tag_opt("true") {
if !self.legal_id_char() {
Some(true)
} else {
self.backtrack_to(start_pos);
None
}
} else if self.tag_opt("false") {
if !self.legal_id_char() {
Some(false)
} else {
self.backtrack_to(start_pos);
None
}
if self.word_opt("true") {
Some(true)
} else if self.word_opt("false") {
Some(false)
} else {
None
}
Expand Down Expand Up @@ -2411,7 +2400,7 @@ impl<'cxt, 's> Parser<'cxt, 's> {
op_pos,
bind_count,
)));
} else if self.tag_opt(keywords::op::as_) {
} else if self.word_opt(keywords::op::as_) {
return Ok(TermTokenRes::Push(TermFrame::new(
FrameOp::Cast,
op_pos,
Expand All @@ -2436,7 +2425,7 @@ impl<'cxt, 's> Parser<'cxt, 's> {
op_pos,
bind_count,
)));
} else if self.tag_opt(keywords::op::lambda_) {
} else if self.word_opt(keywords::op::lambda_) {
self.ws_cmt();
self.word(keywords::op::is_)?;
self.ws_cmt();
Expand Down Expand Up @@ -2981,16 +2970,16 @@ impl<'cxt, 's> Parser<'cxt, 's> {
let mut ptterm = if let Some(pos) = self.tag_opt_pos("(") {
self.ws_cmt();

if self.tag_opt("and") {
if self.word_opt("and") {
stack.push(Frame::And(vec![]));
continue 'go_down;
} else if self.tag_opt("or") {
} else if self.word_opt("or") {
stack.push(Frame::Or(vec![]));
continue 'go_down;
} else if self.tag_opt("not") {
} else if self.word_opt("not") {
stack.push(Frame::Not);
continue 'go_down;
} else if self.tag_opt("=>") {
} else if self.word_opt("=>") {
stack.push(Frame::Impl(vec![]));
continue 'go_down;
} else {
Expand Down Expand Up @@ -3403,9 +3392,9 @@ impl<'cxt, 's> Parser<'cxt, 's> {

let bind_count = self.let_bindings(&VarMap::new(), &BTreeMap::new(), instance)?;

let idx = if self.tag_opt("true") {
let idx = if self.word_opt("true") {
ClauseRes::Skipped
} else if self.tag_opt("false") {
} else if self.word_opt("false") {
ClauseRes::Skipped
} else {
self.ws_cmt();
Expand Down
Loading