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

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

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 "

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu