line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SQL::Translator::Parser; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
174
|
use strict; |
|
21
|
|
|
|
|
64
|
|
|
21
|
|
|
|
|
651
|
|
4
|
21
|
|
|
21
|
|
135
|
use warnings; |
|
21
|
|
|
|
|
75
|
|
|
21
|
|
|
|
|
1495
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.63'; |
6
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
0
|
|
sub parse { "" } |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
1; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
12
|
|
|
|
|
|
|
# Enough! or Too much. |
13
|
|
|
|
|
|
|
# William Blake |
14
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
SQL::Translator::Parser - describes how to write a parser |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Parser modules that get invoked by SQL::Translator need to implement a |
25
|
|
|
|
|
|
|
single function: B. This function will be called by the |
26
|
|
|
|
|
|
|
SQL::Translator instance as $class::parse($tr, $data_as_string), where |
27
|
|
|
|
|
|
|
$tr is a SQL::Translator instance. Other than that, the classes are |
28
|
|
|
|
|
|
|
free to define any helper functions, or use any design pattern |
29
|
|
|
|
|
|
|
internally that make the most sense. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
When the parser has determined what exists, it will communicate the |
32
|
|
|
|
|
|
|
structure to the producer through the SQL::Translator::Schema object. |
33
|
|
|
|
|
|
|
This object can be retrieved from the translator (the first argument |
34
|
|
|
|
|
|
|
pass to B) by calling the B method: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $schema = $tr->schema; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The Schema object has methods for adding tables, fields, indices, etc. |
39
|
|
|
|
|
|
|
For more information, consult the docs for SQL::Translator::Schema and |
40
|
|
|
|
|
|
|
its related modules. For examples of how this works, examine the |
41
|
|
|
|
|
|
|
source code for existing SQL::Translator::Parser::* modules. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 AUTHORS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Ken Youens-Clark, Ekclark@cpan.org, |
46
|
|
|
|
|
|
|
darren chamberlain Edarren@cpan.orgE. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
perl(1), SQL::Translator, SQL::Translator::Schema. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |