hi,
this issue has been brought up by wuehlmaus on irc. the fix seems so simple that i wonder if i am missing something fundamental. or is this really just an oversight in the code?
greetings, martin. --- lib/modules/Tools.pmod/Hilfe.pmod | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/modules/Tools.pmod/Hilfe.pmod b/lib/modules/Tools.pmod/Hilfe.pmod index d451f39..e61a193 100644 --- a/lib/modules/Tools.pmod/Hilfe.pmod +++ b/lib/modules/Tools.pmod/Hilfe.pmod @@ -1994,6 +1994,7 @@ class Evaluator { case "do": case "while": case "foreach": + case "switch": // Parse loops. evaluate(expr->code(), 0); return 0;
Let's start with presenting the problem, then we can discuss if the solution is correct.
Excerpts from Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum's message of 2014-05-19 11:45:02 +0200:
Let's start with presenting the problem, then we can discuss if the solution is correct.
heh, of course:
without the patch: Pike v8.0 release 1 running Hilfe v3.5 (Incremental Pike Frontend)
string s ="das"; switch( s ) { case "das": write("gut");};
Compiler Error: 1: switch is a reserved word. Compiler Error: 1: syntax error, unexpected '(' Compiler Error: 1: syntax error, unexpected '}' Compiler Error: 1: Missing ';'.
dump wrapper
Last compiled wrapper: 001: mapping(string:mixed) ___hilfe = ___Hilfe->variables; 002: # 1 003: mixed ___HilfeWrapper() { return switch( (([mapping(string:string)](mixed)___hilfe)->s) ) { case "das": write("gut");} ; } 004:
with the patch: Pike v8.0 release 1 running Hilfe v3.5 (Incremental Pike Frontend)
string s ="das"; switch( s ) { case "das": write("gut");};
gutOk.
dump wrapper
Last compiled wrapper: 001: mapping(string:mixed) ___hilfe = ___Hilfe->variables; 002: # 1 003: mixed ___HilfeWrapper() { switch( (([mapping(string:string)](mixed)___hilfe)->s) ) { case "das": write("gut");} ; } 004:
greetings, martin.
a bear-hug for applying the patch, and a slap with the bear-paw for misspelling my name.
or should that be bähr-hug and bähr-paw? ;-)
greetings, martin (back to hibernation)
pike-devel@lists.lysator.liu.se