Browse Source

prototyping lisp v0

ada 5 years ago
parent
commit
8ad7001664
1 changed files with 1 additions and 4 deletions
  1. 1 4
      lisp/lisp.rs

+ 1 - 4
lisp/lisp.rs

@@ -81,18 +81,15 @@ impl InPort {
 
 
     pub fn next_token(&mut self) -> String {
     pub fn next_token(&mut self) -> String {
         loop {
         loop {
-           if self.line.is_empty()  || self.line == "#<eof-object>".to_string() {
-               // TODO add match 
+           if self.line.is_empty() {
                self.line = self.lines.get(self.cur_line).unwrap_or(&"#<eof-object>".to_string()).to_string();
                self.line = self.lines.get(self.cur_line).unwrap_or(&"#<eof-object>".to_string()).to_string();
                self.cur_line = self.cur_line + 1;
                self.cur_line = self.cur_line + 1;
            }
            }
            if self.line.is_empty() {
            if self.line.is_empty() {
-               self.cur_line = self.cur_line + 1;
                return "#<eof-object>".to_string();
                return "#<eof-object>".to_string();
            }
            }
            let (token, rest) = InPort::tokenize(self.line.clone());
            let (token, rest) = InPort::tokenize(self.line.clone());
            self.line = rest;
            self.line = rest;
-            self.cur_line = self.cur_line + 1;
            if !token.is_empty() {
            if !token.is_empty() {
                return token;
                return token;
            }
            }