Substitute and parseCommand: The now recognise variables and deal with them as needed

This commit is contained in:
Sekulum Forka 2021-05-11 18:38:32 +02:00
parent 8a5e6c3cea
commit d502efaeb1
1 changed files with 2 additions and 0 deletions

View File

@ -158,6 +158,7 @@ proc substitute(strm: Stream, delim=";\p"): string =
stderr.write("Extra closing bracket")
of '\\':
result.add(strm.readChar())
of '$': result.add(strm.readVariable.evalVariable)
else:
result.add(c)
@ -177,6 +178,7 @@ proc parseCommand(cmd: string): seq[string] =
newitem.add(strm.readInterpelation.eval)
of '"':
newitem.add(strm.readSubstitution.newStringStream.substitute)
of '$': result.add(strm.readVariable.evalVariable)
of ' ':
result.add(newitem)
newitem = ""