This repository has been archived by the owner on Jun 9, 2018. It is now read-only.
/
luac.pl
84 lines (63 loc) · 1.38 KB
/
luac.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! perl
# Copyright (C) 2005-2009, Parrot Foundation.
# $Id$
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/src/yapp";
use Getopt::Std;
use Lua::parser;
my %opts;
getopts( 'hv', \%opts );
if ( $opts{v} ) {
print "$0\n";
print "Perl $] on $^O\n";
exit;
}
if ( $opts{h} or scalar(@ARGV) != 1 ) {
use Pod::Usage;
pod2usage( -verbose => 1 );
}
my $parser = new Lua::parser();
$parser->YYData->{verbose_error} = 1; # 0, 1
$parser->YYData->{verbose_warning} = 1; # 0, 1
$parser->YYData->{verbose_info} = 1; # 0, 1
$parser->Run(@ARGV);
if ( exists $parser->YYData->{nb_error} ) {
my $nb = $parser->YYData->{nb_error};
print "$nb error(s).\n";
}
if ( $parser->YYData->{verbose_warning}
and exists $parser->YYData->{nb_warning} )
{
my $nb = $parser->YYData->{nb_warning};
print "$nb warning(s).\n";
}
if ( $parser->YYData->{verbose_info}
and exists $parser->YYData->{nb_info} )
{
my $nb = $parser->YYData->{nb_info};
print "$nb info(s).\n";
}
unless ( exists $parser->YYData->{nb_error} ) {
$parser->Generate();
}
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
__END__
=head1 Lua compiler
=head2 Synopsis
luac [options] I<source>.lua
=head2 Options
=over 8
=item B<-h>
Display help.
=item B<-v>
Display version.
=back
=head2 Description
=cut