Corrected the docs a bit (no more data structure to pass around!), but
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser.pm
1 package SQL::Translator::Parser;
2
3 # ----------------------------------------------------------------------
4 # $Id: Parser.pm,v 1.7 2003-08-22 22:48:20 kycl4rk Exp $
5 # ----------------------------------------------------------------------
6 # Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
7 #                    darren chamberlain <darren@cpan.org>,
8 #                    Chris Mungall <cjm@fruitfly.org>.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation; version 2.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 # 02111-1307  USA
23 # ----------------------------------------------------------------------
24
25 use strict;
26 use vars qw( $VERSION );
27 $VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/;
28
29 sub parse { "" }
30
31 1;
32
33 # ----------------------------------------------------------------------
34 # Enough! or Too much.
35 # William Blake
36 # ----------------------------------------------------------------------
37
38 =pod
39
40 =head1 NAME
41
42 SQL::Translator::Parser - describes how to write a parser
43
44 =head1 DESCRIPTION
45
46 Parser modules that get invoked by SQL::Translator need to implement a
47 single function: B<parse>.  This function will be called by the
48 SQL::Translator instance as $class::parse($tr, $data_as_string), where
49 $tr is a SQL::Translator instance.  Other than that, the classes are
50 free to define any helper functions, or use any design pattern
51 internally that make the most sense.
52
53 When the parser has determined what exists, it will communicate the
54 structure to the producer through the SQL::Translator::Schema object.
55 This object can be retrieved from the translator (the first argument
56 pass to B<parse>) by calling the B<schema> method:
57
58   my $schema = $tr->schema;
59
60 The Schema object has methods for adding tables, fields, indices, etc.
61 For more information, consult the docs for SQL::Translator::Schema and
62 its related modules.  For examples of how this works, examine the
63 source code for existing SQL::Translator::Parser::* modules.
64
65 =head1 AUTHORS
66
67 Ken Y. Clark, E<lt>kclark@cpan.org<gt>, 
68 darren chamberlain E<lt>darren@cpan.orgE<gt>.
69
70 =head1 SEE ALSO
71
72 perl(1), SQL::Translator::Schema.
73
74 =cut