Re: print and get procedures
- Posted by cargoan Jan 30, 2011
- 1121 views
A possible solution:
In get.e and std/get.e
... constant DIGITS = "0123456789", HEX_DIGITS = DIGITS & "ABCDEF", START_NUMERIC = DIGITS & "-+.#", -- Added - Valid start characters for an euphoria object VALID_START = START_NUMERIC & {'{','\"','\''} ... char ch -- the current character ch = GET_EOF -- Added - Initialize to an invalid start character ...
In get.e
global function get(integer file) ... input_file = file input_string = 0 if not find(ch, VALID_START) then -- added to preserve ch if start character get_ch() -- discards only if ch is an invalid start character (separator) end if return Get() end function global function value(sequence string) ... input_string = string string_next = 1 if not find(ch, VALID_START) then -- added - preserve ch if is a start character get_ch() -- discards only if ch is an invalid start character (separator) end if return Get() end function
In std/get.e
function Get2() ... -- init offset = string_next-1 -- get_ch() -- comment out, same behavior as Get() ... function get_value() ... -- Why different behavior for Get and Get2?, removed if (see Get2) -- if answer_type = GET_SHORT_ANSWER then if not find(ch, VALID_START) then -- added - preserve ch if is a start character get_ch() -- discard only if ch is an invalid start character (separator) end if return call_func(answer_type, {}) end function
It's correct?