Re: Rosetta code: help needed

new topic     » goto parent     » topic index » view thread      » older message » newer message
ed_davis said...

Where? Which task, and which solution?

The lexical analyser, test case 3, Euphoria, C, and Python.

The problem is with

if next_ch() = '*' and next_ch() = '/' then 

I solved it (for Euphoria/Phix) with

    -- comment found 
    the_ch = next_ch() 
    while true do 
--DEV I suspect this will break on "**/": [YEP, IT DOES] 
--      if next_ch() = '*' and next_ch() = '/' then 
        if the_ch = '*' then 
            if next_ch() = '/' then 
                the_ch = next_ch() 
                return get_tok() 
            end if 
        elsif the_ch = EOF then 
            error("%d %d EOF in comment", {tok_line, tok_col}) 
        else 
            the_ch = next_ch() 
        end if 
    end while 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu