lua-users home
lua-l archive

Re: patch: C-style string lexing

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le Wed 30/01/2008 à 17:06 Eric Tetz à écrit:
> I just posted a small patch to the wiki that allows C-style string
> lexing, where string literals separated by whitespace are collected
> as a single string. I've always appreciated that in C, and miss it
> when using languages that don't lex strings that way (lika Java or
> Lua).
There is another way you can do it ... That can be found in the Lisaac
language (pretty unknown at the moment, but I like it much).
You can define an escape sequence that could be written \%s+\ and that
does nothing. For instance your example could be written:
 if something then
 for k,v in pairs(foo) do
 if v then
 bar()
 else
 io.write "This is a big chunk of text \
 \that for whatever reason (typically \
 \readability) is broken into multiple \
 \lines in the source code.\n"
 end
 end
And this does not create ambiguity with the call syntax.
Mildred
-- 
Mildred Ki'lya
E-Mail:	mildred593(at)online.fr
Site:	<http://mildred632.free.fr/>
XMPP:	<mildred@jabber.fr> (GoogleTalk, Jabber)
GPG:	197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]

AltStyle によって変換されたページ (->オリジナル) /