projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify some corner cases in the scanner code.
[super-star-trek.git]
/
src
/
sst.py
diff --git
a/src/sst.py
b/src/sst.py
index a1c08bbaf1cdd87b0c8c2d5ae7530807455586a5..e4681e29b3331e42bee6e21551911d26d89f9149 100644
(file)
--- a/
src/sst.py
+++ b/
src/sst.py
@@
-6365,6
+6365,8
@@
def makemoves():
if game.options & OPTION_CURSES:
makechart()
continue
if game.options & OPTION_CURSES:
makechart()
continue
+ elif scanner.token == "":
+ continue
game.ididit = False
clrscr()
setwnd(message_window)
game.ididit = False
clrscr()
setwnd(message_window)
@@
-6375,7
+6377,7
@@
def makemoves():
cmd = candidates[0]
break
elif candidates and not (game.options & OPTION_PLAIN):
cmd = candidates[0]
break
elif candidates and not (game.options & OPTION_PLAIN):
- prout("Commands with
that prefix: " + " ".join(candidates
))
+ prout("Commands with
prefix '%s': %s" % (scanner.token, " ".join(candidates)
))
else:
listCommands()
continue
else:
listCommands()
continue
@@
-6568,24
+6570,21
@@
class sstscanner:
# Get a token from the user
self.real = 0.0
self.token = ''
# Get a token from the user
self.real = 0.0
self.token = ''
- #
Read a lin
e if nothing here
-
if
self.inqueue == None:
+ #
Fill the token quu
e if nothing here
+
while
self.inqueue == None:
line = cgetline()
if curwnd==prompt_window:
clrscr()
setwnd(message_window)
clrscr()
line = cgetline()
if curwnd==prompt_window:
clrscr()
setwnd(message_window)
clrscr()
+ if line == '':
+ return None
# Skip leading white space
line = line.lstrip()
# Skip leading white space
line = line.lstrip()
- if line:
- self.inqueue = line.split()
+ if
not
line:
+ continue
else:
else:
- self.inqueue = []
- self.type = IHEOL
- return IHEOL
- elif not self.inqueue:
- self.type = IHEOL
- return IHEOL
+ self.inqueue = line.lstrip().split() + [IHEOL]
# From here on in it's all looking at the queue
self.token = self.inqueue.pop(0)
if self.token == IHEOL:
# From here on in it's all looking at the queue
self.token = self.inqueue.pop(0)
if self.token == IHEOL: