Re: A Puzzle in Eu -- what would you do?

new topic     » goto parent     » topic index » view thread      » older message » newer message

cklester wrote:
> DB James wrote:
> > What if the line contents above were this?:
> > line=InnocentRtn("--In Eu, a comment begins with 2 hyphens") --A real
> > comment
> > 
> > The "x" would report the first "--" and miss the real comment (oops).
> > 
> > The puzzle:
> > How do *you* deal with this?
> 
> In this case, just reverse the string first. Then, the first set of '--' is
> the real comment. Snip it, reverse it back, and carry on.
> 
> x = "code --fake comment -- real comment"
> 
> becomes
> 
> x = "tnemmoc laer -- tnemmoc ekaf-- edoc"
> 
> then becomes
> 
> x = " tnemmoc ekaf-- edoc"
> 
> which finalizes to
> 
> x = "code --fake comment "

This won't work if the real comment also contains --, like this
s = "-- fake comment" -- real comment with -- in it


--
The Internet combines the excitement of typing 
with the reliability of anonymous hearsay.

tommy online: http://users.telenet.be/tommycarlier
tommy.blog: http://tommycarlier.blogspot.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu