Advertisement
KeplerBR

[Macro Plugin] Implementação do postfix control com "if"

Dec 18th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.79 KB | None | 0 0
  1. Index: Script.pm
  2. ===================================================================
  3. --- Script.pm   (revision 8787)
  4. +++ Script.pm   (working copy)
  5. @@ -218,6 +218,21 @@
  6.     # TODO: separate line advancing and timeout setting
  7.    
  8.     my $errtpl = "error in ".$self->{line};
  9. +
  10. +   if ($line =~ /.+\s+if\s*\(.*\)$/) {
  11. +       my ($text) = $line =~ /.+if\s+\(\s*(.*)\s*\)$/;
  12. +       $text = parseCmd($text, $self);
  13. +       if (defined $self->{error}) {$self->{error} = "$errtpl: $self->{error}"; return}
  14. +       my $savetxt = particle($text, $self, $errtpl);
  15. +       if (multi($savetxt, $self, $errtpl)) {
  16. +           $line =~ s/\s+if\s*\(.*\)//;
  17. +       } else {
  18. +           $self->{line}++;
  19. +           $self->{timeout} = 0;
  20. +           return "";
  21. +       }
  22. +   }
  23. +  
  24.     ##########################################
  25.     # jump to label: goto label
  26.     if ($line =~ /^goto\s/) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement