Haldrik
12-29-2015, 06:26 PM
Heyo,
Uncovered a bug with exec. It's not parsing <> correctly.
--- Lich: exec2 active.
[bigshot: inside wait_swing while]
--- SyntaxError: exec2:10: end pattern with unmatched parenthesis: /(?:^<style id=""/
exec2:10: syntax error, unexpected '<'
...if line !~ /(?:^<style id=""/><style id="roomDesc"/>|<compon...
... ^
exec2:10: syntax error, unexpected '>'
...e id=""/><style id="roomDesc"/>|<component id='room objs'>|<...
... ^
exec2:10: syntax error, unexpected '|'
..."/>|<component id='room objs'>|<compDef id='room objs'>)/;
... ^
exec2:10: syntax error, unexpected ')'
...bjs'>|<compDef id='room objs'>)/;
... ^
exec2:17: syntax error, unexpected keyword_end, expecting end-of-input
end;
^
E:/Gemstone IV/lich/lich.rbw:3144:in `eval'
--- Lich: exec2 has exited.
I tried about 10 different ways of the below. Removed (?:), escaped all the <>, split the if statement. Nothing worked.
start_exec_script( <<-eos
status_tags;
while line = get;
echo line if $bigshot_debug;
echo "Inside stop_wait exec" if $bigshot_debug;
echo $global_target if $bigshot_debug;
echo $pcs if $bigshot_debug;
echo $stop_wait if $bigshot_debug;
echo "#{$global_target}.*#{$pcs}" if $bigshot_debug;
if line =~ /#{target.id}.*(#{pcs})/ && line !~ /(?^<style id=""\/><style id="roomDesc"\/>|<component id='room objs'>|<compDef id='room objs'>/ objs'/;
echo "inside if statement for stop_swing exec" if $bigshot_debug;
$stop_wait = true;
end;
break if $stop_wait;
break if !running? 'bigshot';
end;
status_tags;
eos
)
This is the working code:
start_exec_script( <<-eos
status_tags;
while line = get;
echo line if $bigshot_debug;
echo "Inside stop_wait exec" if $bigshot_debug;
echo $global_target if $bigshot_debug;
echo $pcs if $bigshot_debug;
echo $stop_wait if $bigshot_debug;
echo "#{$global_target}.*#{$pcs}" if $bigshot_debug;
if line =~ /#{$global_target}.*#{$pcs}/ and line !~ /style id="".*style id="roomDesc"|(?:component|compDef) id='room objs'/;
echo "inside if statement for stop_swing exec" if $bigshot_debug;
$stop_wait = true;
end;
break if $stop_wait;
break if !running? 'bigshot';
end;
status_tags;
eos
)
Uncovered a bug with exec. It's not parsing <> correctly.
--- Lich: exec2 active.
[bigshot: inside wait_swing while]
--- SyntaxError: exec2:10: end pattern with unmatched parenthesis: /(?:^<style id=""/
exec2:10: syntax error, unexpected '<'
...if line !~ /(?:^<style id=""/><style id="roomDesc"/>|<compon...
... ^
exec2:10: syntax error, unexpected '>'
...e id=""/><style id="roomDesc"/>|<component id='room objs'>|<...
... ^
exec2:10: syntax error, unexpected '|'
..."/>|<component id='room objs'>|<compDef id='room objs'>)/;
... ^
exec2:10: syntax error, unexpected ')'
...bjs'>|<compDef id='room objs'>)/;
... ^
exec2:17: syntax error, unexpected keyword_end, expecting end-of-input
end;
^
E:/Gemstone IV/lich/lich.rbw:3144:in `eval'
--- Lich: exec2 has exited.
I tried about 10 different ways of the below. Removed (?:), escaped all the <>, split the if statement. Nothing worked.
start_exec_script( <<-eos
status_tags;
while line = get;
echo line if $bigshot_debug;
echo "Inside stop_wait exec" if $bigshot_debug;
echo $global_target if $bigshot_debug;
echo $pcs if $bigshot_debug;
echo $stop_wait if $bigshot_debug;
echo "#{$global_target}.*#{$pcs}" if $bigshot_debug;
if line =~ /#{target.id}.*(#{pcs})/ && line !~ /(?^<style id=""\/><style id="roomDesc"\/>|<component id='room objs'>|<compDef id='room objs'>/ objs'/;
echo "inside if statement for stop_swing exec" if $bigshot_debug;
$stop_wait = true;
end;
break if $stop_wait;
break if !running? 'bigshot';
end;
status_tags;
eos
)
This is the working code:
start_exec_script( <<-eos
status_tags;
while line = get;
echo line if $bigshot_debug;
echo "Inside stop_wait exec" if $bigshot_debug;
echo $global_target if $bigshot_debug;
echo $pcs if $bigshot_debug;
echo $stop_wait if $bigshot_debug;
echo "#{$global_target}.*#{$pcs}" if $bigshot_debug;
if line =~ /#{$global_target}.*#{$pcs}/ and line !~ /style id="".*style id="roomDesc"|(?:component|compDef) id='room objs'/;
echo "inside if statement for stop_swing exec" if $bigshot_debug;
$stop_wait = true;
end;
break if $stop_wait;
break if !running? 'bigshot';
end;
status_tags;
eos
)