summaryrefslogtreecommitdiff
path: root/source4/build/pidl/idl.gram
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-22 22:53:08 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-22 22:53:08 +0000
commit868555bca5fdc87d4e46df6e853c19e5d5f5f796 (patch)
treea2a0627062c1e77af1c5dee11ac305f0d2dbf41f /source4/build/pidl/idl.gram
parente79e6bc4726dc96d553e245e34e94e39de7c2da3 (diff)
downloadsamba-868555bca5fdc87d4e46df6e853c19e5d5f5f796.tar.gz
samba-868555bca5fdc87d4e46df6e853c19e5d5f5f796.tar.bz2
samba-868555bca5fdc87d4e46df6e853c19e5d5f5f796.zip
added support for enumerated types in IDL files. This makes unions
easier to work with. (This used to be commit 60be15d306e7b65efdd27df02250c0264996ccf3)
Diffstat (limited to 'source4/build/pidl/idl.gram')
-rw-r--r--source4/build/pidl/idl.gram31
1 files changed, 15 insertions, 16 deletions
diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram
index 70d1c36b5e..1e19ae6cf1 100644
--- a/source4/build/pidl/idl.gram
+++ b/source4/build/pidl/idl.gram
@@ -48,6 +48,15 @@ typedef : 'typedef' <commit> type identifier array_len(?) ';'
}}
| <error?>
+enum: 'enum' <commit> '{' enum_element(s? /,/) '}'
+ {{
+ "TYPE" => "ENUM",
+ "ELEMENTS" => $item[4]
+ }}
+ | <error?>
+
+enum_element: /[\w\s=]+/
+
struct: property_list(s?) 'struct' <commit> '{' element_list1(?) '}'
{{
"TYPE" => "STRUCT",
@@ -65,16 +74,16 @@ union: property_list(s?) 'union' <commit> '{' union_element(s?) '}'
| <error?>
union_element:
- '[' 'case' '(' constant ')' ']' base_element ';'
+ '[' 'case' '(' identifier ')' ']' base_element ';'
{{
"TYPE" => "UNION_ELEMENT",
- "CASE" => $item{constant},
+ "CASE" => $item{identifier},
"DATA" => $item{base_element}
}}
- | '[' 'case' '(' constant ')' ']' ';'
+ | '[' 'case' '(' identifier ')' ']' ';'
{{
"TYPE" => "EMPTY",
- "CASE" => $item{constant},
+ "CASE" => $item{identifier},
}}
| '[' 'default' ']' base_element ';'
{{
@@ -124,20 +133,16 @@ property: 'unique'
| 'in'
| 'out'
| 'ref'
- | 'context_handle'
- | 'string'
| 'public'
| 'noprint'
| 'relative'
| 'nodiscriminant'
| 'subcontext' '(' constant ')' {{ "$item[1]" => "$item{constant}" }}
| 'flag' '(' anytext ')' {{ "$item[1]" => "$item{anytext}" }}
- | 'byte_count_pointer' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| '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?]+/
@@ -153,12 +158,9 @@ function : type identifier '(' <commit> element_list2 ');'
| <error?>
type :
- 'unsigned' type { "$item[1] $item[2]" }
- | 'long' { $item[1] }
- | 'string' { $item[1] }
- | 'wchar_t' { $item[1] }
- | struct { $item[1] }
+ struct { $item[1] }
| union { $item[1] }
+ | enum { $item[1] }
| identifier { $item[1] }
| <error>
@@ -172,9 +174,6 @@ anytext: text2 '(' <commit> anytext ')' anytext
{{ "$item[1]+$item[3]" }}
| text2
-call: expression '(' <commit> expression ')'
- {{ "$item[1]($item[4])" }}
-
constant: /-?[\dx]+/
| '*'