[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: line parsing in lua
- From: Tomas <tomas@...>
- Date: Wed, 13 Dec 2000 09:42:32 -0200 (BRST)
> BTW, \1 is octal \001?
Yes. The best choice is a character that will not be present in
the string (like '\n', as Luiz noted).
Another thing you must need is a escape for `"' inside a quoted
string. For example:
cmd first-arg "second arg" 3 "a\"b" de "fg"
Must be splitted in:
1 cmd
2 first-arg
3 second arg
4 3
5 a"b
6 de
7 fg
To achieve that, just add the following line as the first substitution:
s = gsub(s,'\\"','\2')
And change the correction of the `\1', to correct these too:
local s=gsub(gsub(str,'\1',' '), '\2', '"')
Got it?
Tomas