Fix parser a bit
This commit is contained in:
parent
c23a868513
commit
e3335ace69
1 changed files with 5 additions and 5 deletions
|
@ -27,12 +27,10 @@ class PathCommand():
|
||||||
self.arg += ch
|
self.arg += ch
|
||||||
|
|
||||||
def arg_next(self, ch: str):
|
def arg_next(self, ch: str):
|
||||||
if len(self.arg) == 0:
|
if len(self.arg) > 0:
|
||||||
return
|
self.args.append(self.arg)
|
||||||
|
|
||||||
self.arg += ch
|
self.arg = ch
|
||||||
self.args.append(self.arg)
|
|
||||||
self.arg = ''
|
|
||||||
|
|
||||||
def arg_finish(self):
|
def arg_finish(self):
|
||||||
if len(self.arg) > 0:
|
if len(self.arg) > 0:
|
||||||
|
@ -115,6 +113,8 @@ class Path():
|
||||||
command.set_command(ch)
|
command.set_command(ch)
|
||||||
elif Path.is_number(c):
|
elif Path.is_number(c):
|
||||||
command.arg_addch(ch)
|
command.arg_addch(ch)
|
||||||
|
elif ch == '-':
|
||||||
|
command.arg_next(ch)
|
||||||
elif ch == ' ' or ch == ',':
|
elif ch == ' ' or ch == ',':
|
||||||
state = State.INT
|
state = State.INT
|
||||||
command.arg_finish()
|
command.arg_finish()
|
||||||
|
|
Loading…
Add table
Reference in a new issue