Blatte::Syntax - parse tree structure for Blatte documents


Blatte documentation  | view source Contained in the Blatte distribution.

Index


NAME

Top

Blatte::Syntax - parse tree structure for Blatte documents

SYNOPSIS

Top

  package MySyntax;

  use Blatte::Syntax;

  @ISA = qw(Blatte::Syntax);

  sub transform {
    my($self, $column) = @_;

    ...return a string containing a Perl expression...
  }

  ...

  use Blatte::Parser;
  use MySyntax;

  $parser = new Blatte::Parser();
  $parser->add_special_form(\&my_special_form);

  sub my_special_form {
    my($self, $input_arg) = @_;
    my $input = $input_arg;
    if (ref($input)) {
      $input = $$input_arg;
    }

    ...examine $input...
    ...return undef if no match...
    ...else consume matching text from beginning of $input...

    if (ref($input_arg)) {
      $$input_arg = $input;
    }

    return new MySyntax(...);
  }

DESCRIPTION

Top

Blatte::Syntax is the base class of a family of objects used to represent a Blatte parse tree. A tree of Blatte::Syntax objects is returned by expr() and other parsing methods of Blatte::Parser. All Blatte::Syntax objects have a transform() method that converts them to strings of Perl code.

AUTHOR

Top

Bob Glickstein <bobg@zanshin.com>.

Visit the Blatte website, <http://www.blatte.org/>.

LICENSE

Top

Copyright 2001 Bob Glickstein. All rights reserved.

Blatte is distributed under the terms of the GNU General Public License, version 2. See the file LICENSE that accompanies the Blatte distribution.

SEE ALSO

Top

Blatte::Parser(3).


Blatte documentation  | view source Contained in the Blatte distribution.