summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_parser.pm
diff options
context:
space:
mode:
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;
}
#####################################################################