[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4969-g55d1dac
Günther Deschner
gd at samba.org
Tue Feb 17 01:40:00 GMT 2009
The branch, v3-3-test has been updated
via 55d1dacf4d49abcaace17a5f8a200c319e0389eb (commit)
from a6f8d9dad6ffedd62345922a2c5bef877f67dd9b (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 55d1dacf4d49abcaace17a5f8a200c319e0389eb
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 17 02:35:00 2009 +0100
pidl: add copy of pidl to 3-3-test in order to regenerate librpc code.
pidl's reference is 79190992b3820cd028c961c48bdea9b35baf13c9 here.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/pidl/MANIFEST | 43 +
source/pidl/META.yml | 18 +
source/pidl/Makefile.PL | 17 +
source/pidl/README | 64 +
source/pidl/TODO | 47 +
source/pidl/config.m4 | 9 +
source/pidl/config.mk | 31 +
source/pidl/expr.yp | 150 ++
source/pidl/idl.yp | 497 ++++
source/pidl/lib/Parse/Pidl.pm | 38 +
source/pidl/lib/Parse/Pidl/CUtil.pm | 52 +
source/pidl/lib/Parse/Pidl/Compat.pm | 163 ++
source/pidl/lib/Parse/Pidl/Dump.pm | 294 +++
source/pidl/lib/Parse/Pidl/Expr.pm | 1442 +++++++++++
source/pidl/lib/Parse/Pidl/IDL.pm | 2534 ++++++++++++++++++
source/pidl/lib/Parse/Pidl/NDR.pm | 1235 +++++++++
source/pidl/lib/Parse/Pidl/ODL.pm | 117 +
source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 243 ++
source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 268 ++
source/pidl/lib/Parse/Pidl/Samba4.pm | 119 +
source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm | 155 ++
source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm | 221 ++
source/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm | 327 +++
source/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 874 +++++++
source/pidl/lib/Parse/Pidl/Samba4/Header.pm | 475 ++++
source/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 156 ++
source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 2695 ++++++++++++++++++++
source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm | 328 +++
source/pidl/lib/Parse/Pidl/Samba4/Python.pm | 1216 +++++++++
source/pidl/lib/Parse/Pidl/Samba4/SWIG.pm | 177 ++
source/pidl/lib/Parse/Pidl/Samba4/TDR.pm | 281 ++
source/pidl/lib/Parse/Pidl/Samba4/Template.pm | 98 +
source/pidl/lib/Parse/Pidl/Typelist.pm | 301 +++
source/pidl/lib/Parse/Pidl/Util.pm | 182 ++
.../pidl/lib/Parse/Pidl/Wireshark/Conformance.pm | 439 ++++
source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 1141 +++++++++
source/pidl/lib/Parse/Yapp/Driver.pm | 471 ++++
source/pidl/pidl | 808 ++++++
source/pidl/tests/Util.pm | 179 ++
source/pidl/tests/cutil.pl | 21 +
source/pidl/tests/dump.pl | 15 +
source/pidl/tests/header.pl | 108 +
source/pidl/tests/ndr.pl | 558 ++++
source/pidl/tests/ndr_align.pl | 143 ++
source/pidl/tests/ndr_alloc.pl | 118 +
source/pidl/tests/ndr_array.pl | 37 +
source/pidl/tests/ndr_compat.pl | 21 +
source/pidl/tests/ndr_deprecations.pl | 26 +
source/pidl/tests/ndr_fullptr.pl | 44 +
source/pidl/tests/ndr_refptr.pl | 526 ++++
source/pidl/tests/ndr_represent.pl | 71 +
source/pidl/tests/ndr_simple.pl | 28 +
source/pidl/tests/ndr_string.pl | 90 +
source/pidl/tests/ndr_tagtype.pl | 66 +
source/pidl/tests/parse_idl.pl | 164 ++
source/pidl/tests/samba-ejs.pl | 37 +
source/pidl/tests/samba-ndr.pl | 296 +++
source/pidl/tests/samba3-cli.pl | 126 +
source/pidl/tests/samba3-srv.pl | 18 +
source/pidl/tests/tdr.pl | 49 +
source/pidl/tests/test_util.pl | 21 +
source/pidl/tests/typelist.pl | 85 +
source/pidl/tests/util.pl | 115 +
source/pidl/tests/wireshark-conf.pl | 205 ++
source/pidl/tests/wireshark-ndr.pl | 274 ++
65 files changed, 21167 insertions(+), 0 deletions(-)
create mode 100644 source/pidl/MANIFEST
create mode 100644 source/pidl/META.yml
create mode 100755 source/pidl/Makefile.PL
create mode 100644 source/pidl/README
create mode 100644 source/pidl/TODO
create mode 100644 source/pidl/config.m4
create mode 100644 source/pidl/config.mk
create mode 100644 source/pidl/expr.yp
create mode 100644 source/pidl/idl.yp
create mode 100644 source/pidl/lib/Parse/Pidl.pm
create mode 100644 source/pidl/lib/Parse/Pidl/CUtil.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Compat.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Dump.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Expr.pm
create mode 100644 source/pidl/lib/Parse/Pidl/IDL.pm
create mode 100644 source/pidl/lib/Parse/Pidl/NDR.pm
create mode 100644 source/pidl/lib/Parse/Pidl/ODL.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/EJS.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/Header.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/Python.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/SWIG.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/TDR.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Samba4/Template.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Typelist.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Util.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
create mode 100644 source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
create mode 100644 source/pidl/lib/Parse/Yapp/Driver.pm
create mode 100755 source/pidl/pidl
create mode 100644 source/pidl/tests/Util.pm
create mode 100755 source/pidl/tests/cutil.pl
create mode 100755 source/pidl/tests/dump.pl
create mode 100755 source/pidl/tests/header.pl
create mode 100755 source/pidl/tests/ndr.pl
create mode 100755 source/pidl/tests/ndr_align.pl
create mode 100755 source/pidl/tests/ndr_alloc.pl
create mode 100755 source/pidl/tests/ndr_array.pl
create mode 100755 source/pidl/tests/ndr_compat.pl
create mode 100755 source/pidl/tests/ndr_deprecations.pl
create mode 100755 source/pidl/tests/ndr_fullptr.pl
create mode 100755 source/pidl/tests/ndr_refptr.pl
create mode 100755 source/pidl/tests/ndr_represent.pl
create mode 100755 source/pidl/tests/ndr_simple.pl
create mode 100755 source/pidl/tests/ndr_string.pl
create mode 100755 source/pidl/tests/ndr_tagtype.pl
create mode 100755 source/pidl/tests/parse_idl.pl
create mode 100755 source/pidl/tests/samba-ejs.pl
create mode 100755 source/pidl/tests/samba-ndr.pl
create mode 100755 source/pidl/tests/samba3-cli.pl
create mode 100644 source/pidl/tests/samba3-srv.pl
create mode 100755 source/pidl/tests/tdr.pl
create mode 100755 source/pidl/tests/test_util.pl
create mode 100755 source/pidl/tests/typelist.pl
create mode 100755 source/pidl/tests/util.pl
create mode 100755 source/pidl/tests/wireshark-conf.pl
create mode 100755 source/pidl/tests/wireshark-ndr.pl
Changeset truncated at 500 lines:
diff --git a/source/pidl/MANIFEST b/source/pidl/MANIFEST
new file mode 100644
index 0000000..051c5d2
--- /dev/null
+++ b/source/pidl/MANIFEST
@@ -0,0 +1,43 @@
+MANIFEST
+tests/parse_idl.pl
+tests/Util.pm
+tests/ndr_refptr.pl
+tests/ndr_string.pl
+tests/ndr_simple.pl
+tests/ndr_align.pl
+tests/ndr_alloc.pl
+tests/ndr_array.pl
+tests/ndr.pl
+tests/samba-ndr.pl
+tests/util.pl
+tests/test_util.pl
+tests/ndr_represent.pl
+tests/ndr_compat.pl
+tests/ndr_fullptr.pl
+tests/ndr_tagtype.pl
+tests/header.pl
+lib/Parse/Pidl/Samba3/ClientNDR.pm
+lib/Parse/Pidl/Samba3/ServerNDR.pm
+lib/Parse/Pidl/Samba4/NDR/Server.pm
+lib/Parse/Pidl/Samba4/NDR/Parser.pm
+lib/Parse/Pidl/Samba4/NDR/Client.pm
+lib/Parse/Pidl/Samba4/Header.pm
+lib/Parse/Pidl/Samba4/SWIG.pm
+lib/Parse/Pidl/Samba4/TDR.pm
+lib/Parse/Pidl/Samba4/Template.pm
+lib/Parse/Pidl/Samba4/EJS.pm
+lib/Parse/Pidl/Samba4.pm
+lib/Parse/Pidl/Wireshark/Conformance.pm
+lib/Parse/Pidl/Wireshark/NDR.pm
+lib/Parse/Pidl/Typelist.pm
+lib/Parse/Pidl/Dump.pm
+lib/Parse/Pidl/Compat.pm
+lib/Parse/Pidl/Util.pm
+lib/Parse/Pidl/NDR.pm
+lib/Parse/Pidl.pm
+Makefile.PL
+idl.yp
+TODO
+README
+pidl
+META.yml
diff --git a/source/pidl/META.yml b/source/pidl/META.yml
new file mode 100644
index 0000000..e523c30
--- /dev/null
+++ b/source/pidl/META.yml
@@ -0,0 +1,18 @@
+name: Parse-Pidl
+abstract: Generate parsers / DCE/RPC-clients from IDL
+author:
+ - Andrew Tridgell <tridge at samba.org>
+ - Jelmer Vernooij <jelmer at samba.org>
+ - Stefan Metzmacher <metze at samba.org>
+ - Tim Potter <tpot at samba.org>
+license: gplv3
+installdirs: site
+homepage: http://www.samba.org/
+bugtracker: http://bugzilla.samba.org/
+requires:
+ Parse::Yapp: 0
+recommends:
+ Data::Dumper: 0
+meta-spec:
+ version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
diff --git a/source/pidl/Makefile.PL b/source/pidl/Makefile.PL
new file mode 100755
index 0000000..2a405fc
--- /dev/null
+++ b/source/pidl/Makefile.PL
@@ -0,0 +1,17 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ 'NAME' => 'Parse::Pidl',
+ 'VERSION_FROM' => 'lib/Parse/Pidl.pm',
+ 'EXE_FILES' => [ 'pidl' ],
+ 'test' => { 'TESTS' => 'tests/*.pl' }
+);
+
+sub MY::postamble {
+<<'EOT';
+lib/Parse/Pidl/IDL.pm: idl.yp
+ yapp -m 'Parse::Pidl::IDL' -o lib/Parse/Pidl/IDL.pm idl.yp
+
+lib/Parse/Pidl/Expr.pm: expr.yp
+ yapp -m 'Parse::Pidl::Expr' -o lib/Parse/Pidl/Expr.pm expr.yp
+EOT
+}
diff --git a/source/pidl/README b/source/pidl/README
new file mode 100644
index 0000000..9c5d7e6
--- /dev/null
+++ b/source/pidl/README
@@ -0,0 +1,64 @@
+Introduction:
+=============
+This directory contains the source code of the pidl (Perl IDL)
+compiler for Samba 4.
+
+The main sources for pidl are available by Subversion on
+svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/pidl
+
+Pidl works by building a parse tree from a .pidl file (a simple
+dump of it's internal parse tree) or a .idl file
+(a file format mostly like the IDL file format midl uses).
+The IDL file parser is in idl.yp (a yacc file converted to
+perl code by yapp)
+
+After a parse tree is present, pidl will call one of it's backends
+(which one depends on the options given on the command-line). Here is
+a list of current backends:
+
+Standalone installation:
+========================
+Run Makefile.PL to generate the Makefile.
+
+Then run "make install" (as root) to install.
+
+Internals overview:
+===================
+
+-- Generic --
+Parse::Pidl::Dump - Converts the parse tree back to an IDL file
+Parse::Pidl::Samba4::Header - Generates header file with data structures defined in IDL file
+Parse::Pidl::NDR - Generates intermediate datastructures for use by NDR parses/generators
+Parse::Pidl::ODL - Generates IDL structures from ODL structures for use in the NDR parser generator
+Parse::Pidl::Test - Utility functions for use in pidl's testsuite
+
+-- Samba NDR --
+Parse::Pidl::Samba4::NDR::Client - Generates client call functions in C using the NDR parser
+Parse::Pidl::Samba4::SWIG - Generates SWIG interface files (.i)
+Parse::Pidl::Samba4::NDR::Parser - Generates pull/push functions for parsing NDR
+Parse::Pidl::Samba4::NDR::Server - Generates server side implementation in C
+Parse::Pidl::Samba4::TDR - Parser generator for the "Trivial Data Representation"
+Parse::Pidl::Samba4::Template - Generates stubs in C for server implementation
+Parse::Pidl::Samba4::EJS - Generates bindings for Embedded JavaScript (EJS)
+Parse::Pidl::Samba4::Python - Generates bindings for Python
+
+-- Samba COM / DCOM --
+Parse::Pidl::Samba4::COM::Proxy - Generates proxy object for DCOM (client-side)
+Parse::Pidl::Samba4::COM::Stub - Generates stub call handler for DCOM (server-side)
+Parse::Pidl::Samba4::COM::Header - Generates headers for COM
+
+-- Wireshark --
+Parse::Pidl::Wireshark::NDR - Generates a parser for the Wireshark network sniffer
+Parse::Pidl::Wireshark::Conformance - Reads conformance files containing additional data for generating Wireshark parsers
+
+-- Utility modules --
+Parse::Pidl::Util - Misc utility functions used by *.pm and pidl.pl
+Parse::Pidl::Typelist - Utility functions for keeping track of known types and their representation in C
+
+Tips for hacking on pidl:
+ - Look at the pidl's parse tree by using the --keep option and looking
+ at the generated .pidl file.
+ - The various backends have a lot in common, if you don't understand how one
+ implements something, look at the others
+ - See pidl(1) and the documentation on midl
+ - See 'info bison' and yapp(1) for information on the file format of idl.yp
diff --git a/source/pidl/TODO b/source/pidl/TODO
new file mode 100644
index 0000000..8b6b184
--- /dev/null
+++ b/source/pidl/TODO
@@ -0,0 +1,47 @@
+- warn when union instances don't have a discriminant
+
+- EJS output backend shouldn't use the NDR levels stuff but instead
+ as the "C levels" and NDR levels don't necessarily match.
+
+- true multiple dimension array / strings in arrays support
+
+- compatibility mode for generating MIDL-readable data:
+ - strip out pidl-specific properties
+
+- make bitmap an optional attribute on enum
+- support nested elements
+- support typedefs properly (e.g. allow "typedef void **bla;")
+- make typedefs generate real typedefs
+- improve represent_as(): allow it to be used for arrays and other complex
+ types
+
+- --explain-ndr option that dumps out parse tree ?
+
+- seperate tables for NDR and DCE/RPC
+ - maybe no tables for NDR at all? we only need them for ndrdump
+ and that can use dlsym()
+
+- allow data structures outside of interfaces
+
+- mem_ctx in the interface rather than as struct ndr member.
+
+- real typelibs
+
+- fix [in,out] handling and allocation for samba3:
+ - add inout
+ - make NULL to mean "allocate me"
+ - remove NDR_AUTO_REF_ALLOC flag
+
+- automatic test generator based on IDL pointer types
+
+- support converting structs to tuples in Python rather than objects
+- convert structs with a single mattering member to that member directly, e.g.:
+ struct bar {
+ int size;
+ [size_is(size)] uint32 *array;
+ };
+
+ should be converted to an array of uint32's
+
+- python: fill in size members automatically in some places if the struct isn't being returned
+ (so we don't have to cope with the array growing)
diff --git a/source/pidl/config.m4 b/source/pidl/config.m4
new file mode 100644
index 0000000..8b8bc5a
--- /dev/null
+++ b/source/pidl/config.m4
@@ -0,0 +1,9 @@
+# Check whether ExtUtils::ExtMaker is available
+
+if perl -e "use ExtUtils::MakeMaker" 2>/dev/null; then
+ HAVE_PERL_EXTUTILS_MAKEMAKER=1
+else
+ HAVE_PERL_EXTUTILS_MAKEMAKER=0
+fi
+
+AC_SUBST(HAVE_PERL_EXTUTILS_MAKEMAKER)
diff --git a/source/pidl/config.mk b/source/pidl/config.mk
new file mode 100644
index 0000000..b1b68b9
--- /dev/null
+++ b/source/pidl/config.mk
@@ -0,0 +1,31 @@
+PIDL = $(PERL) $(pidldir)/pidl
+
+$(pidldir)/Makefile: $(pidldir)/Makefile.PL
+ cd $(pidldir) && $(PERL) Makefile.PL PREFIX=$(prefix)
+
+pidl-testcov: $(pidldir)/Makefile
+ cd $(pidldir) && cover -test
+
+installpidl:: $(pidldir)/Makefile
+ $(MAKE) -C $(pidldir) install_vendor VENDORPREFIX=$(prefix) \
+ INSTALLVENDORLIB=$(datarootdir)/perl5 \
+ INSTALLVENDORBIN=$(bindir) \
+ INSTALLVENDORSCRIPT=$(bindir) \
+ INSTALLVENDORMAN1DIR=$(mandir)/man1 \
+ INSTALLVENDORMAN3DIR=$(mandir)/man3
+
+ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1)
+install:: installpidl
+endif
+
+$(pidldir)/lib/Parse/Pidl/IDL.pm: $(pidldir)/idl.yp
+ -$(YAPP) -m 'Parse::Pidl::IDL' -o $(pidldir)/lib/Parse/Pidl/IDL.pm $(pidldir)/idl.yp ||\
+ touch $(pidldir)/lib/Parse/Pidl/IDL.pm
+
+$(pidldir)/lib/Parse/Pidl/Expr.pm: $(pidldir)/idl.yp
+ -$(YAPP) -m 'Parse::Pidl::Expr' -o $(pidldir)/lib/Parse/Pidl/Expr.pm $(pidldir)/expr.yp ||\
+ touch $(pidldir)/lib/Parse/Pidl/Expr.pm
+
+testcov-html:: pidl-testcov
+
+
diff --git a/source/pidl/expr.yp b/source/pidl/expr.yp
new file mode 100644
index 0000000..ffdbdaf
--- /dev/null
+++ b/source/pidl/expr.yp
@@ -0,0 +1,150 @@
+# expr.yp
+# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
+# 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);
+}
diff --git a/source/pidl/idl.yp b/source/pidl/idl.yp
new file mode 100644
index 0000000..6bd0994
--- /dev/null
+++ b/source/pidl/idl.yp
@@ -0,0 +1,497 @@
+########################
+# IDL Parse::Yapp parser
+# Copyright (C) Andrew Tridgell <tridge at samba.org>
+# released under the GNU GPL version 3 or later
+
+
+
+# the precedence actually doesn't matter at all for this grammar, but
+# by providing a precedence we reduce the number of conflicts
+# enormously
+%left '-' '+' '&' '|' '*' '>' '.' '/' '(' ')' '[' ',' ';'
+
+
+################
+# grammar
+%%
+idl:
+ #empty { {} }
+ | idl interface { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl coclass { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl import { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl include { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl importlib { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl cpp_quote { push(@{$_[1]}, $_[2]); $_[1] }
+;
+
+import: 'import' commalist ';' {{
+ "TYPE" => "IMPORT",
+ "PATHS" => $_[2],
+ "FILE" => $_[0]->YYData->{FILE},
+ "LINE" => $_[0]->YYData->{LINE}
+ }}
+;
+include: 'include' commalist ';' {{
+ "TYPE" => "INCLUDE",
+ "PATHS" => $_[2],
+ "FILE" => $_[0]->YYData->{FILE},
+ "LINE" => $_[0]->YYData->{LINE}
+ }}
+;
+importlib: 'importlib' commalist ';' {{
+ "TYPE" => "IMPORTLIB",
+ "PATHS" => $_[2],
+ "FILE" => $_[0]->YYData->{FILE},
+ "LINE" => $_[0]->YYData->{LINE}
+ }}
+;
+
+commalist:
+ text { [ $_[1] ] }
+ | commalist ',' text { push(@{$_[1]}, $_[3]); $_[1] }
+;
+
+coclass: property_list 'coclass' identifier '{' interface_names '}' optional_semicolon
+ {{
+ "TYPE" => "COCLASS",
+ "PROPERTIES" => $_[1],
+ "NAME" => $_[3],
+ "DATA" => $_[5],
+ "FILE" => $_[0]->YYData->{FILE},
+ "LINE" => $_[0]->YYData->{LINE},
+ }}
+;
+
+interface_names:
+ #empty { {} }
+ | interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] }
--
Samba Shared Repository
More information about the samba-cvs
mailing list