cleanup state=None
This commit is contained in:
parent
e6f4ac9b99
commit
9591e86054
@ -54,13 +54,8 @@ class ShellLexer:
|
|||||||
nextchar = None
|
nextchar = None
|
||||||
log.shlexer.vdebug("in state {!r} I see character: {!r}".format(
|
log.shlexer.vdebug("in state {!r} I see character: {!r}".format(
|
||||||
state, nextchar))
|
state, nextchar))
|
||||||
if state is None:
|
if state == ' ':
|
||||||
# past end of file
|
|
||||||
token = None
|
|
||||||
break
|
|
||||||
elif state == ' ':
|
|
||||||
if nextchar is None:
|
if nextchar is None:
|
||||||
state = None
|
|
||||||
break
|
break
|
||||||
elif nextchar in self.whitespace:
|
elif nextchar in self.whitespace:
|
||||||
log.shlexer.vdebug("I see whitespace in whitespace state")
|
log.shlexer.vdebug("I see whitespace in whitespace state")
|
||||||
@ -87,7 +82,6 @@ class ShellLexer:
|
|||||||
quoted = True
|
quoted = True
|
||||||
if nextchar is None:
|
if nextchar is None:
|
||||||
log.shlexer.vdebug("I see EOF in quotes state")
|
log.shlexer.vdebug("I see EOF in quotes state")
|
||||||
state = None
|
|
||||||
break
|
break
|
||||||
if nextchar == state:
|
if nextchar == state:
|
||||||
if self.keep:
|
if self.keep:
|
||||||
@ -106,7 +100,6 @@ class ShellLexer:
|
|||||||
log.shlexer.vdebug("I see EOF in escape state")
|
log.shlexer.vdebug("I see EOF in escape state")
|
||||||
if not self.keep:
|
if not self.keep:
|
||||||
token += state
|
token += state
|
||||||
state = None
|
|
||||||
break
|
break
|
||||||
# In posix shells, only the quote itself or the escape
|
# In posix shells, only the quote itself or the escape
|
||||||
# character may be escaped within quotes.
|
# character may be escaped within quotes.
|
||||||
@ -117,7 +110,6 @@ class ShellLexer:
|
|||||||
state = escapedstate
|
state = escapedstate
|
||||||
elif state == 'a':
|
elif state == 'a':
|
||||||
if nextchar is None:
|
if nextchar is None:
|
||||||
state = None
|
|
||||||
break
|
break
|
||||||
elif nextchar in self.whitespace:
|
elif nextchar in self.whitespace:
|
||||||
log.shlexer.vdebug("shlex: I see whitespace in word state")
|
log.shlexer.vdebug("shlex: I see whitespace in word state")
|
||||||
|
Loading…
Reference in New Issue
Block a user