From 5862f39a81facdfe27b1025ef17e268573a90336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Mayer?= Date: Thu, 8 Feb 2007 13:54:27 +0000 Subject: Update from samba tree revision 20292 to 21237 ============================ Samba log start ============ ------------------------------------------------------------------------ r20298 | jelmer | 2006-12-21 02:51:35 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/build/smb_build/output.pm M /branches/SAMBA_4_0/source/include/includes.h M /branches/SAMBA_4_0/source/pidl/tests/Util.pm Fix pidl tests (missing symlink..). ------------------------------------------------------------------------ r20299 | jelmer | 2006-12-21 03:48:46 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl Disable two new tests that are apparently broken. ------------------------------------------------------------------------ r20358 | metze | 2006-12-27 16:36:50 +0100 (Wed, 27 Dec 2006) | 6 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.c M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h - fix ejs generated code for ipv4address - (not Parse::Pidl::Typelist::scalar_is_reference($e->{TYPE})) is much more generic than ($e->{TYPE} ne "string") and handles ipv4address and other special types... metze ------------------------------------------------------------------------ r20511 | jelmer | 2007-01-03 16:34:01 +0100 (Wed, 03 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Compat.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm Combine warnings/errors/fatal functions and move them to Parse::Pidl. ------------------------------------------------------------------------ r20543 | jelmer | 2007-01-05 13:56:15 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/util.pl Merge some pidl bug fixes: * C expressions that just started with a constant were erroneously flagged as being a constant. * 1-length variable names in expressions were broken. ------------------------------------------------------------------------ r20545 | jelmer | 2007-01-05 15:25:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix is_constant(). ------------------------------------------------------------------------ r20547 | jelmer | 2007-01-05 15:55:26 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr_compat.pl A /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Add tests for expected errors/warnings. ------------------------------------------------------------------------ r20548 | jelmer | 2007-01-05 16:03:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_align.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_alloc.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_array.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_simple.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Remove unnecessary "use lib", fix warnings. ------------------------------------------------------------------------ r20550 | jelmer | 2007-01-05 16:20:23 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/parse_idl.pl Use standard error mechanism in parser. Make sure errors are reported correctly. ------------------------------------------------------------------------ r20556 | jelmer | 2007-01-05 18:18:22 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl Add more tests to make sure nothing breaks when I replace the ParseExpr code. ------------------------------------------------------------------------ r20561 | jelmer | 2007-01-05 21:12:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: A /branches/SAMBA_4_0/source/pidl/expr.yp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Add parser for subexpressions used in IDL attributes. ------------------------------------------------------------------------ r20562 | jelmer | 2007-01-05 21:13:48 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/Makefile.PL A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp/Driver.pm Start building expr parser. Add separate copy of Yapp::Driver rather than including it in each individual parser. ------------------------------------------------------------------------ r20563 | jelmer | 2007-01-05 21:18:33 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Start using the new parser in ParseExpr(). It's now trivial to use this to check for NULL pointers when pointers are being dereferenced (#4218). There are exactly 500 tests for pidl now :-) ------------------------------------------------------------------------ r20564 | jelmer | 2007-01-05 21:23:48 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Regenerate. ------------------------------------------------------------------------ r20567 | jelmer | 2007-01-05 21:52:12 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Print proper errors with filename and line numbers in ParseExpr() ------------------------------------------------------------------------ r20571 | jelmer | 2007-01-05 22:26:28 +0100 (Fri, 05 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl fix '' case ------------------------------------------------------------------------ r20573 | metze | 2007-01-05 22:36:57 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm fix handling of pointers handling to elements with the charset property metze ------------------------------------------------------------------------ r20625 | jelmer | 2007-01-09 07:02:41 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix couple of warnings. ------------------------------------------------------------------------ r20631 | jelmer | 2007-01-09 16:50:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add some tests for the ndr parser. ------------------------------------------------------------------------ r20633 | jelmer | 2007-01-09 16:54:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add another test, fix warnings. ------------------------------------------------------------------------ r20637 | jelmer | 2007-01-10 00:41:25 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Don't check for NULL pointers when the pointer is guaranteed to not be NULL (if it is a ref pointer). ------------------------------------------------------------------------ r20638 | jelmer | 2007-01-10 01:37:30 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Check for NULL pointers (where possible) in print functions. Fixes #4218, but without reintroducing coverity warnings. ------------------------------------------------------------------------ r20675 | jelmer | 2007-01-11 03:10:01 +0100 (Thu, 11 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/MANIFEST M /branches/SAMBA_4_0/source/pidl/Makefile.PL Fix installation. ------------------------------------------------------------------------ r20688 | jelmer | 2007-01-11 23:47:29 +0100 (Thu, 11 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/pidl Use argv[0] equivalent of perl. ------------------------------------------------------------------------ r20746 | jelmer | 2007-01-14 02:33:16 +0100 (Sun, 14 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm D /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh M /branches/SAMBA_4_0/source/script/tests/tests_all.sh A /branches/SAMBA_4_0/testprogs/blackbox A /branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh (from /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh:20745) Don't report each individual test in test_smbclient as a single testsuite. Create separate directory for blackbox tests. ------------------------------------------------------------------------ r20830 | jelmer | 2007-01-16 15:44:23 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/librpc/idl/mgmt.idl M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/rpc_server/config.mk M /branches/SAMBA_4_0/source/rpc_server/dcerpc_server.c A /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c (from /branches/SAMBA_4_0/source/rpc_server/mgmt/dcesrv_mgmt.c:20829) D /branches/SAMBA_4_0/source/rpc_server/mgmt M /branches/SAMBA_4_0/source/script/tests/test_rpc.sh M /branches/SAMBA_4_0/source/torture/rpc/mgmt.c merge mgmt work ------------------------------------------------------------------------ r20834 | jelmer | 2007-01-16 16:51:37 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm No longer generate extra pointers for top-level [out] unique pointers. ------------------------------------------------------------------------ r20836 | jelmer | 2007-01-16 18:45:33 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Use real type name, to fix compilation with -WC++-compat ------------------------------------------------------------------------ r20850 | jelmer | 2007-01-17 15:49:36 +0100 (Wed, 17 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Template.pm M /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c M /branches/SAMBA_4_0/source/rpc_server/drsuapi/dcesrv_drsuapi.c M /branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c M /branches/SAMBA_4_0/source/rpc_server/epmapper/rpc_epmapper.c M /branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c M /branches/SAMBA_4_0/source/rpc_server/netlogon/dcerpc_netlogon.c M /branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c M /branches/SAMBA_4_0/source/rpc_server/samr/samr_password.c M /branches/SAMBA_4_0/source/rpc_server/spoolss/dcesrv_spoolss.c M /branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c M /branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c M /branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c M /branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c Prefix all server calls with dcesrv_ ------------------------------------------------------------------------ r20942 | jelmer | 2007-01-22 01:04:59 +0100 (Mon, 22 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/build/m4/check_cc.m4 M /branches/SAMBA_4_0/source/build/m4/check_perl.m4 M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument. ------------------------------------------------------------------------ r20967 | jelmer | 2007-01-23 11:08:08 +0100 (Tue, 23 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_align.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/script/tests/tests_all.sh M /branches/SAMBA_4_0/source/torture/config.mk Allow pidl tests to work with gcov ------------------------------------------------------------------------ r21075 | jelmer | 2007-01-31 12:54:01 +0100 (Wed, 31 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Generate parameters in structs for the server side Samba 3 code. The current code in Samba 3 is already generated using this pidl patch. ------------------------------------------------------------------------ r21222 | jelmer | 2007-02-07 20:03:19 +0100 (Wed, 07 Feb 2007) | 8 lines Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/TODO M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl D /branches/SAMBA_4_0/source/pidl/ref_notes.txt A /branches/SAMBA_4_0/source/pidl/tests/ndr_deprecations.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/util.pl M /branches/SAMBA_4_0/source/torture/smbtorture.c M /branches/SAMBA_4_0/source/torture/torture.c Merge a couple of pidl fixes: * Pidl will now warn when trying to use pointers as integers in expressions. * "subcontext()" is now marked as deprecated. The alternatives, transmit_as() / represent_as() should be available soon. * More tests. * Remove some unused code in smbtorture. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=20744 --- tools/pidl/expr.yp | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 tools/pidl/expr.yp (limited to 'tools/pidl/expr.yp') diff --git a/tools/pidl/expr.yp b/tools/pidl/expr.yp new file mode 100644 index 0000000000..a8074875ff --- /dev/null +++ b/tools/pidl/expr.yp @@ -0,0 +1,150 @@ +# expr.yp +# Copyright (C) 2006 Jelmer Vernooij +# Published under the GNU GPL +# +%left '->' +%right '!' '~' +%left '*' '/' '%' +%left '+' '-' +%left '<<' '>>' +%left '>' '<' +%left '==' '!=' +%left '&' +%left '|' +%left '&&' +%left '||' +%left '?' ':' +%left NEG DEREF ADDROF INV +%left '.' + +%% +exp: NUM + | TEXT { "\"$_[1]\"" } + | func + | var + | '~' exp %prec INV { "~$_[2]" } + | exp '+' exp { "$_[1] + $_[3]" } + | exp '-' exp { "$_[1] - $_[3]" } + | exp '*' exp { "$_[1] * $_[3]" } + | exp '%' exp { "$_[1] % $_[3]" } + | exp '<' exp { "$_[1] < $_[3]" } + | exp '>' exp { "$_[1] > $_[3]" } + | exp '|' exp { "$_[1] | $_[3]" } + | exp '==' exp { "$_[1] == $_[3]" } + | exp '<=' exp { "$_[1] <= $_[3]" } + | exp '=>' exp { "$_[1] => $_[3]" } + | exp '<<' exp { "$_[1] << $_[3]" } + | exp '>>' exp { "$_[1] >> $_[3]" } + | exp '!=' exp { "$_[1] != $_[3]" } + | exp '||' exp { "$_[1] || $_[3]" } + | exp '&&' exp { "$_[1] && $_[3]" } + | exp '&' exp { "$_[1] & $_[3]" } + | exp '?' exp ':' exp { "$_[1]?$_[3]:$_[5]" } + | '~' exp { "~$_[1]" } + | '!' exp { "not $_[1]" } + | exp '/' exp { "$_[1] / $_[3]" } + | '-' exp %prec NEG { "-$_[2]" } + | '&' exp %prec ADDROF { "&$_[2]" } + | exp '^' exp { "$_[1]^$_[3]" } + | '(' exp ')' { "($_[2])" } +; + +possible_pointer: + VAR { $_[0]->_Lookup($_[1]) } + | '*' possible_pointer %prec DEREF { $_[0]->_Dereference($_[2]); "*$_[2]" } + ; + +var: possible_pointer { $_[0]->_Use($_[1]) } + | var '.' VAR { $_[0]->_Use("$_[1].$_[3]") } + | '(' var ')' { "($_[2])" } + | var '->' VAR { $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] } +; + + +func: VAR '(' opt_args ')' { "$_[1]($_[3])" }; +opt_args: { "" } | args; +exp_or_possible_pointer: exp | possible_pointer; +args: exp_or_possible_pointer + | exp_or_possible_pointer ',' args { "$_[1], $_[3]" } +; + +%% + +package Parse::Pidl::Expr; + +sub _Lexer { + my($parser)=shift; + + $parser->YYData->{INPUT}=~s/^[ \t]//; + + for ($parser->YYData->{INPUT}) { + if (s/^(0x[0-9A-Fa-f]+)//) { + $parser->YYData->{LAST_TOKEN} = $1; + return('NUM',$1); + } + if (s/^([0-9]+(?:\.[0-9]+)?)//) { + $parser->YYData->{LAST_TOKEN} = $1; + return('NUM',$1); + } + if (s/^([A-Za-z_][A-Za-z0-9_]*)//) { + $parser->YYData->{LAST_TOKEN} = $1; + return('VAR',$1); + } + if (s/^\"(.*?)\"//) { + $parser->YYData->{LAST_TOKEN} = $1; + return('TEXT',$1); + } + if (s/^(==|!=|<=|>=|->|\|\||<<|>>|&&)//s) { + $parser->YYData->{LAST_TOKEN} = $1; + return($1,$1); + } + if (s/^(.)//s) { + $parser->YYData->{LAST_TOKEN} = $1; + return($1,$1); + } + } +} + +sub _Use($$) +{ + my ($self, $x) = @_; + if (defined($self->YYData->{USE})) { + return $self->YYData->{USE}->($x); + } + return $x; +} + +sub _Lookup($$) +{ + my ($self, $x) = @_; + return $self->YYData->{LOOKUP}->($x); +} + +sub _Dereference($$) +{ + my ($self, $x) = @_; + if (defined($self->YYData->{DEREFERENCE})) { + $self->YYData->{DEREFERENCE}->($x); + } +} + +sub _Error($) +{ + my ($self) = @_; + if (defined($self->YYData->{LAST_TOKEN})) { + $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."' near `". $self->YYData->{LAST_TOKEN} . "'"); + } else { + $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."'"); + } +} + +sub Run { + my($self, $data, $error, $lookup, $deref, $use) = @_; + $self->YYData->{FULL_INPUT} = $data; + $self->YYData->{INPUT} = $data; + $self->YYData->{LOOKUP} = $lookup; + $self->YYData->{DEREFERENCE} = $deref; + $self->YYData->{ERROR} = $error; + $self->YYData->{USE} = $use; + return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); +} -- cgit v1.2.1