Skip to content

Commit

Permalink
Minor bugfixes (including #48 and #51).
Browse files Browse the repository at this point in the history
  • Loading branch information
dloscutoff committed Mar 19, 2022
1 parent b2ba974 commit 7c2905f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ def FROMBASE(self, number, base=None):
if len(number) == 0:
number = 0
try:
result = int(str(number), base)
result = int(str(number).replace("_", " "), base)
return Scalar(result)
except ValueError:
# TBD: make more robust? Or just let it stay nil
Expand Down
4 changes: 2 additions & 2 deletions pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def pip(code=None, argv=None, interactive=True):
"n" if options.newline else
"l" if options.lines else
None)
if not (code or options.execute or options.file or options.stdin):
if code is None and not (options.execute or options.file or options.stdin):
if interactive:
options.stdin = True
print("Enter your program, terminated by Ctrl-D or Ctrl-Z:")
Expand All @@ -152,7 +152,7 @@ def pip(code=None, argv=None, interactive=True):
else:
print(f"Type {sys.argv[0]} -h for usage information.")
sys.exit(0)
if code:
if code is not None:
# Code is passed into function
program = code
elif options.execute:
Expand Down
3 changes: 3 additions & 0 deletions scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def tokenize(code):
# Discard block comments
#!print("Block comment:", repr(m.group()))
code = code[m.end():]
elif code[:2] == "{;":
err.die("Unterminated block comment:", code.strip(),
errorClass=IncompleteSyntax)
elif m := whitespaceRgx.match(code):
# Discard leading whitespace
#!print("Whitespace:", repr(m.group()))
Expand Down

0 comments on commit 7c2905f

Please sign in to comment.