Re: print and get procedures

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

I changed get.e to:

function Get() 
-- read a Euphoria data object as a string of characters 
-- and return {error_flag, value} 
-- Note: ch is "live" at entry and exit of this routine 
    sequence s, e 
    skip_blanks() 
    if find(ch, START_NUMERIC) then 
	return get_number() 
    elsif ch = '{' then 
	-- process a sequence 
	s = {} 
	get_ch() 
	skip_blanks() 
	if ch = '}' then 
--	    get_ch()          -- removed      
	    return {GET_SUCCESS, s} -- empty sequence 
	end if 
	while TRUE do 
	    e = Get() -- read next element 
	    if e[1] != GET_SUCCESS then 
		return e 
	    end if 
	    s = append(s, e[2]) 
	    skip_blanks() 
	    if ch = '}' then 
--		get_ch()          -- removed   
		return {GET_SUCCESS, s} 
	    elsif ch != ',' then 
		return {GET_FAIL, 0} 
	    end if 
	    get_ch() -- skip comma 
	end while 
    elsif ch = '\"' then 
	return get_string() 
    elsif ch = '\'' then 
	return get_qchar() 
    elsif ch = -1 then 
	return {GET_EOF, 0} 
    else 
	return {GET_FAIL, 0} 
    end if 
end function 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu