Skip to content

Commit

Permalink
fix: tried fixing weird advance bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xNaCly committed Apr 2, 2023
1 parent 76a1b4c commit 66169a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Parser {
}

fn advance(&mut self) {
if !self.at_end() || self.pos + 1 >= self.input.len() {
if !self.at_end() || self.pos + 1 <= self.input.len() {
self.pos += 1;
self.current_char = self
.input
Expand All @@ -58,7 +58,7 @@ impl Parser {

pub fn parse(&mut self) -> Vec<Token> {
let mut res: Vec<Token> = vec![];
while !self.at_end() {
while !self.at_end() && self.current_char != '\0' {
let mut token_value = String::new();
let mut token_kind = token::TokenKind::Paragraph;

Expand Down
1 change: 1 addition & 0 deletions test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a heading

0 comments on commit 66169a6

Please sign in to comment.