Parcourir la source

prototyping lisp v0

ada il y a 5 ans
Parent
commit
8ad7001664
1 fichiers modifiés avec 1 ajouts et 4 suppressions
  1. 1 4
      lisp/lisp.rs

+ 1 - 4
lisp/lisp.rs

@@ -81,18 +81,15 @@ impl InPort {
 
     pub fn next_token(&mut self) -> String {
         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.cur_line = self.cur_line + 1;
            }
            if self.line.is_empty() {
-               self.cur_line = self.cur_line + 1;
                return "#<eof-object>".to_string();
            }
            let (token, rest) = InPort::tokenize(self.line.clone());
            self.line = rest;
-            self.cur_line = self.cur_line + 1;
            if !token.is_empty() {
                return token;
            }