summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_parser.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-05-27 18:14:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:07 -0500
commit55781cdce67bdba9c6f37024ae1c76c74a8881de (patch)
tree7ade50546655331b30e5ed9ba042617c4f8dd6ff /source4/build/pidl/ndr_parser.pm
parent50d2bf00660c8c2c12cd1ea40b2212aa8250e611 (diff)
downloadsamba-55781cdce67bdba9c6f37024ae1c76c74a8881de.tar.gz
samba-55781cdce67bdba9c6f37024ae1c76c74a8881de.tar.bz2
samba-55781cdce67bdba9c6f37024ae1c76c74a8881de.zip
r7036: Allow more operations in several properties (such as size_is, length_is,
switch_is, etc) and simplify the code involved (This used to be commit 86de98ee09348297f2c30ce15888ba5e5637c078)
Diffstat (limited to 'source4/build/pidl/ndr_parser.pm')
-rw-r--r--source4/build/pidl/ndr_parser.pm32
1 files changed, 11 insertions, 21 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm
index 1abf8f7006..f94de5e2be 100644
--- a/source4/build/pidl/ndr_parser.pm
+++ b/source4/build/pidl/ndr_parser.pm
@@ -116,33 +116,23 @@ sub deindent()
# work out the name of a size_is() variable
sub ParseExpr($$)
{
- my($orig_expr) = shift;
+ my($expr) = shift;
my $varlist = shift;
- die("Undefined value in ParseExpr") if not defined($orig_expr);
+ die("Undefined value in ParseExpr") if not defined($expr);
- my $expr = $orig_expr;
+ my @tokens = split /((?:[A-Za-z_])(?:(?:(?:[A-Za-z0-9_.])|(?:->))+))/, $expr;
+ my $ret = "";
- return $expr if (util::is_constant($expr));
-
- my $prefix = "";
- my $postfix = "";
-
- if ($expr =~ /\*(.*)/) {
- $expr = $1;
- $prefix = "*";
- }
-
- if ($expr =~ /^(.*)([\&\|\/+])(.*)$/) {
- $postfix = $2.$3;
- $expr = $1;
- }
-
- if (defined($varlist->{$expr})) {
- return $prefix.$varlist->{$expr}.$postfix;
+ foreach my $t (@tokens) {
+ if (defined($varlist->{$t})) {
+ $ret .= $varlist->{$t};
+ } else {
+ $ret .= $t;
+ }
}
- return $prefix.$expr.$postfix;
+ return $ret;
}
#####################################################################