PageRenderTime 50ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/perl/Choicetool/Rules/UnaryOp.pm

#
Perl | 88 lines | 46 code | 22 blank | 20 comment | 1 complexity | c6a31627c6704eef29b59943b534066b MD5 | raw file
Possible License(s): GPL-2.0
  1. # -*- perl -*-
  2. #
  3. # UnaryOp.pm
  4. #
  5. # Copyright (C) 2008, 2009 Francesco Salvestrini
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License along
  18. # with this program; if not, write to the Free Software Foundation, Inc.,
  19. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. #
  21. package Choicetool::Rules::UnaryOp;
  22. use 5.8.0;
  23. use warnings;
  24. use strict;
  25. use diagnostics;
  26. use Choicetool::Base::Debug;
  27. use Choicetool::Base::Trace;
  28. use vars qw(@ISA);
  29. @ISA = qw(Choicetool::Rules::Rule);
  30. sub new ($$)
  31. {
  32. my $class = shift;
  33. assert(defined($class));
  34. my $self = { };
  35. $self->{OPERAND} = undef;
  36. return bless($self, $class);
  37. }
  38. sub operand ($$)
  39. {
  40. my $self = shift;
  41. my $oper = shift;
  42. assert(defined($self));
  43. if (defined($oper)) {
  44. $self->{OPERAND} = $oper;
  45. }
  46. return $self->{OPERAND};
  47. }
  48. sub m4ify_header ($$)
  49. {
  50. my $self = shift;
  51. my $prefix = shift;
  52. assert(defined($self));
  53. assert(defined($prefix));
  54. assert(defined($self->id()));
  55. return $prefix . "\n";
  56. }
  57. sub m4ify_footer ($$)
  58. {
  59. my $self = shift;
  60. my $prefix = shift;
  61. assert(defined($self));
  62. assert(defined($prefix));
  63. assert(defined($self->id()));
  64. return $prefix . "\n";
  65. }
  66. 1;