diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-01-05 20:52:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:37:01 -0500 |
commit | a7bc3801f94891880a90b2974dfbadc9e9f8c2ee (patch) | |
tree | 2cc690d4b35022398e8062847f70982fd34585e0 /source4/pidl/lib/Parse/Pidl/Expr.pm | |
parent | 38ba8bf8ba75c19ab8d34eb4862b05befc8e1497 (diff) | |
download | samba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.tar.gz samba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.tar.bz2 samba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.zip |
r20567: Print proper errors with filename and line numbers in ParseExpr()
(This used to be commit f5dc1b47ecf18068a47f8f68016463ef4a55dc03)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Expr.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Expr.pm | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Expr.pm b/source4/pidl/lib/Parse/Pidl/Expr.pm index 2f1a98f374..fc0a3a92aa 100644 --- a/source4/pidl/lib/Parse/Pidl/Expr.pm +++ b/source4/pidl/lib/Parse/Pidl/Expr.pm @@ -1085,7 +1085,7 @@ sub new { [#Rule 2 'exp', 1, sub -#line 22 "pidl/expr.yp" +#line 22 "expr.yp" { "\"$_[1]\"" } ], [#Rule 3 @@ -1094,187 +1094,187 @@ sub [#Rule 4 'exp', 3, sub -#line 24 "pidl/expr.yp" +#line 24 "expr.yp" { "$_[1].$_[3]" } ], [#Rule 5 'exp', 1, sub -#line 25 "pidl/expr.yp" -{ $_[0]->Lookup($_[1]) } +#line 25 "expr.yp" +{ $_[0]->_Lookup($_[1]) } ], [#Rule 6 'exp', 2, sub -#line 26 "pidl/expr.yp" -{ $_[0]->Dereference($_[2]); "*$_[2]" } +#line 26 "expr.yp" +{ $_[0]->_Dereference($_[2]); "*$_[2]" } ], [#Rule 7 'exp', 2, sub -#line 27 "pidl/expr.yp" +#line 27 "expr.yp" { "~$_[2]" } ], [#Rule 8 'exp', 3, sub -#line 28 "pidl/expr.yp" +#line 28 "expr.yp" { "$_[1] + $_[3]" } ], [#Rule 9 'exp', 3, sub -#line 29 "pidl/expr.yp" +#line 29 "expr.yp" { "$_[1] - $_[3]" } ], [#Rule 10 'exp', 3, sub -#line 30 "pidl/expr.yp" +#line 30 "expr.yp" { "$_[1] * $_[3]" } ], [#Rule 11 'exp', 3, sub -#line 31 "pidl/expr.yp" +#line 31 "expr.yp" { "$_[1] % $_[3]" } ], [#Rule 12 'exp', 3, sub -#line 32 "pidl/expr.yp" +#line 32 "expr.yp" { "$_[1] < $_[3]" } ], [#Rule 13 'exp', 3, sub -#line 33 "pidl/expr.yp" +#line 33 "expr.yp" { "$_[1] > $_[3]" } ], [#Rule 14 'exp', 3, sub -#line 34 "pidl/expr.yp" +#line 34 "expr.yp" { "$_[1] | $_[3]" } ], [#Rule 15 'exp', 3, sub -#line 35 "pidl/expr.yp" +#line 35 "expr.yp" { "$_[1] == $_[3]" } ], [#Rule 16 'exp', 3, sub -#line 36 "pidl/expr.yp" +#line 36 "expr.yp" { "$_[1] <= $_[3]" } ], [#Rule 17 'exp', 3, sub -#line 37 "pidl/expr.yp" +#line 37 "expr.yp" { "$_[1] => $_[3]" } ], [#Rule 18 'exp', 3, sub -#line 38 "pidl/expr.yp" +#line 38 "expr.yp" { "$_[1] << $_[3]" } ], [#Rule 19 'exp', 3, sub -#line 39 "pidl/expr.yp" +#line 39 "expr.yp" { "$_[1] >> $_[3]" } ], [#Rule 20 'exp', 3, sub -#line 40 "pidl/expr.yp" +#line 40 "expr.yp" { "$_[1] != $_[3]" } ], [#Rule 21 'exp', 3, sub -#line 41 "pidl/expr.yp" +#line 41 "expr.yp" { "$_[1] || $_[3]" } ], [#Rule 22 'exp', 3, sub -#line 42 "pidl/expr.yp" +#line 42 "expr.yp" { "$_[1] && $_[3]" } ], [#Rule 23 'exp', 3, sub -#line 43 "pidl/expr.yp" +#line 43 "expr.yp" { "$_[1] & $_[3]" } ], [#Rule 24 'exp', 3, sub -#line 44 "pidl/expr.yp" +#line 44 "expr.yp" { $_[1]."->".$_[3] } ], [#Rule 25 'exp', 5, sub -#line 45 "pidl/expr.yp" +#line 45 "expr.yp" { "$_[1]?$_[3]:$_[5]" } ], [#Rule 26 'exp', 2, sub -#line 46 "pidl/expr.yp" +#line 46 "expr.yp" { "~$_[1]" } ], [#Rule 27 'exp', 2, sub -#line 47 "pidl/expr.yp" +#line 47 "expr.yp" { "not $_[1]" } ], [#Rule 28 'exp', 3, sub -#line 48 "pidl/expr.yp" +#line 48 "expr.yp" { "$_[1] / $_[3]" } ], [#Rule 29 'exp', 2, sub -#line 49 "pidl/expr.yp" +#line 49 "expr.yp" { "-$_[2]" } ], [#Rule 30 'exp', 2, sub -#line 50 "pidl/expr.yp" +#line 50 "expr.yp" { "&$_[2]" } ], [#Rule 31 'exp', 3, sub -#line 51 "pidl/expr.yp" +#line 51 "expr.yp" { "$_[1]^$_[3]" } ], [#Rule 32 'exp', 3, sub -#line 52 "pidl/expr.yp" +#line 52 "expr.yp" { "($_[2])" } ], [#Rule 33 'func', 4, sub -#line 55 "pidl/expr.yp" +#line 55 "expr.yp" { "$_[1]($_[3])" } ], [#Rule 34 'opt_args', 0, sub -#line 56 "pidl/expr.yp" +#line 56 "expr.yp" { "" } ], [#Rule 35 @@ -1286,7 +1286,7 @@ sub [#Rule 37 'args', 3, sub -#line 57 "pidl/expr.yp" +#line 57 "expr.yp" { "$_[1], $_[3]" } ] ], @@ -1294,7 +1294,7 @@ sub bless($self,$class); } -#line 59 "pidl/expr.yp" +#line 59 "expr.yp" package Parse::Pidl::Expr; @@ -1332,13 +1332,13 @@ sub _Lexer { } } -sub Lookup($$) +sub _Lookup($$) { my ($self, $x) = @_; return $self->YYData->{LOOKUP}->($x); } -sub Dereference($$) +sub _Dereference($$) { my ($self, $x) = @_; if (defined($self->YYData->{DEREFERENCE})) { @@ -1346,12 +1346,20 @@ sub Dereference($$) } } +sub _Error($) +{ + my ($self) = @_; + $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."' near `". $self->YYData->{LAST_TOKEN} . "'"); +} + sub Run { my($self, $data, $error, $lookup, $deref) = @_; + $self->YYData->{FULL_INPUT} = $data; $self->YYData->{INPUT} = $data; $self->YYData->{LOOKUP} = $lookup; $self->YYData->{DEREFERENCE} = $deref; - return $self->YYParse( yylex => \&_Lexer, yyerror => $error ); + $self->YYData->{ERROR} = $error; + return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); } 1; |