Commits

Leonardo Santagada  committed 75b5ea9

rpython doesn't have raw_input, so using os

  • Participants
  • Parent commits d5d1bb4

Comments (0)

Files changed (1)

 def repl(prompt='lis.py> '):
     "A prompt-read-eval-print loop."
     while True:
-        val = eval(parse(raw_input(prompt)))
+        os.write(2,prompt)
+        val = eval(parse(readline()))
         if val is not None: print to_string(val)
 
+def readline():
+    result = []
+    while 1:
+        s = os.read(0, 1)
+        result.append(s)
+        if s == "\n":
+            break
+        if s == '':
+            if len(result) > 1:
+                break
+            raise SystemExit
+    return "".join(result)
+
 def main(args):
     repl()