1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

support a new value() attribute that allows us to auto-fill certain

elements. Used at the moment for string lengths.

the regular expression isn't right, but it works for the case I need.
Perl expert needed :)
This commit is contained in:
Andrew Tridgell 0001-01-01 00:00:00 +00:00
parent 7c162eaf3b
commit c7ddd6b2aa
3 changed files with 17 additions and 3 deletions

View File

@ -107,11 +107,12 @@ property: 'unique'
| 'size_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'length_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'switch_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'value' '(' anytext ')' {{ "$item[1]" => "$item{anytext}" }}
| 'switch_type' '(' type ')' {{ "$item[1]" => $item{type} }}
identifier: /[\w?]+/
expression: /[\w?\/+*-]+/
expression: /[\w.?\/+*-_]+/
function : type identifier '(' <commit> element_list2 ');'
{{
@ -132,7 +133,13 @@ type :
| identifier { $item[1] }
| <error>
text: /[\w\s.?-]*/
text: /[\w\s\..?-]*/
anytext: call(s?)
{{ "$item[1][0]" }}
call: expression '(' <commit> expression ')'
{{ "$item[1]($item[4])" }}
constant: /-?\d+/
| '*'

View File

@ -168,7 +168,9 @@ sub ParseElementPushScalar($$$)
my($ndr_flags) = shift;
my $cprefix = util::c_push_prefix($e);
if (defined $e->{VALUE}) {
if (my $value = util::has_property($e, "value")) {
$res .= "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $value));\n";
} elsif (defined $e->{VALUE}) {
$res .= "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $e->{VALUE}));\n";
} elsif (util::need_wire_pointer($e)) {
$res .= "\tNDR_CHECK(ndr_push_ptr(ndr, $var_prefix$e->{NAME}));\n";

View File

@ -353,5 +353,10 @@ sub is_constant($)
return 0;
}
sub dump($)
{
print Dumper shift;
}
1;