1. re:find_replace_callback() -- example fails
- Posted by _tom (admin) Sep 22, 2010
- 1166 views
Example 1 in the documentation for find_replace_callback() is not working.
A cut and paste copy of the example produces an error...
include std/regex.e as re include std/console.e function my_convert(sequence params) switch params[1] do case "1" then return "one " case "2" then return "two " case else return "unknown " end switch end function regex r = re:new(`\d`) sequence result = re:find_replace_callback(r, "125", routine_id("my_convert")) -- result = "one two unknown " display( result ) /* bash-3.1# eui demo demo.ex:5 in function my_convert() A machine-level exception occurred during execution of this statement ... called from /root/euphoria/include/std/regex.e:1218 in function find_replace_callback() ... called from demo.ex:15 --> See ex.err */
2. Re: re:find_replace_callback() -- example fails
- Posted by ne1uno Sep 23, 2010
- 1143 views
Example 1 in the documentation for find_replace_callback() is not working.
A cut and paste copy of the example produces an error...
it does work translated. it also crashes using previous interpreters back to 3155 and probably beyond.
3. Re: re:find_replace_callback() -- example fails
- Posted by jimcbrown (admin) Sep 23, 2010
- 1188 views
Example 1 in the documentation for find_replace_callback() is not working.
A cut and paste copy of the example produces an error...
it does work translated. it also crashes using previous interpreters back to 3155 and probably beyond.
I tested with 3023 and still got a crash.
I just tried it with 3414 and eu.ex, and got the error "Unknown opcode" in line 9.
I suspect we have a fencepost error somewhere in the math that deals with switches for sequences. Changing the following function in execute.e fixes eu.ex and allows the demo to run correctly:
procedure opSWITCH() -- pc+1: switch value -- pc+2: case values -- pc+3: jump_table -- pc+4: else jump a = find( val[Code[pc+1]], val[Code[pc+2]] ) if a then pc += val[Code[pc+3]][a] if Code[pc] > MAX_OPCODE then pc -= 1 end if else pc = Code[pc + 4] end if end procedure
4. Re: re:find_replace_callback() -- example fails
- Posted by mattlewis (admin) Sep 24, 2010
- 1180 views
I tested with 3023 and still got a crash.
I just tried it with 3414 and eu.ex, and got the error "Unknown opcode" in line 9.
The eu.ex issue sounds like a problem with some opcode not advancing the instruction pointer correctly. I've added ticket:204 for this issue.
Matt
5. Re: re:find_replace_callback() -- example fails
- Posted by mattlewis (admin) Sep 26, 2010
- 1082 views
I tested with 3023 and still got a crash.
I just tried it with 3414 and eu.ex, and got the error "Unknown opcode" in line 9.
The eu.ex issue sounds like a problem with some opcode not advancing the instruction pointer correctly. I've added ticket:204 for this issue.
ticket:204 is now fixed in svn:3425.
Matt