ActionParser::Legacy - Makepp scanner class for legacy interface


makepp documentation Contained in the makepp distribution.

Index


Code Index:

NAME

Top

ActionParser::Legacy - Makepp scanner class for legacy interface

SYNOPSIS

Top

	use ActionParser::Legacy;
	my $scanner=ActionParser::Legacy->new(\&scanner_c_compilation);

DESCRIPTION

Top

ActionParser::Legacy is an adapter class of type ActionParser that can talk to the legacy scanner interface. Its use is deprecated.

METHODS

Top

new

	my $rp = ActionParser::Legacy->new($coderef);

Returns a new ActionParser object that always uses $coderef as its command parser.

find_command_parser

	my $cp = $rp->find_command_parser($command, $rule, $dir, \$found);

Call the predefined coderef with $command, $rule and $dir, and return 0.


makepp documentation Contained in the makepp distribution.
# $Id: Legacy.pm,v 1.7 2006/12/22 02:18:36 topnerd Exp $

use strict;
package ActionParser::Legacy;
use ActionParser;
our @ISA = qw/ActionParser/;


sub new {
  my ($self, $coderef)=@_;
  my $class=ref($self)||$self;
  bless { COMMAND_SCANNER => $coderef }, $class;
}

sub find_command_parser {
  my ($self, $command, $rule, $dir)=@_;
  my $scanner=$self->{COMMAND_SCANNER};
  my $parser = &$scanner($command, $rule, $dir) || 0;
  unless(UNIVERSAL::isa($parser, 'CommandParser')) {
    # This is assumed to mean that calling the $scanner already
    # did the scanning.
    ::log SCAN_UNCACHEABLE => $rule, UNIVERSAL::can( $parser, 'name' ) ? $parser : 'anonymous'
      if $::log_level;
    $parser=0;
    $rule->mark_scaninfo_uncacheable;
  }
  return $parser;
}

1;