summaryrefslogtreecommitdiff
path: root/source3/aparser/token.awk
diff options
context:
space:
mode:
Diffstat (limited to 'source3/aparser/token.awk')
-rw-r--r--source3/aparser/token.awk63
1 files changed, 61 insertions, 2 deletions
diff --git a/source3/aparser/token.awk b/source3/aparser/token.awk
index d0703439e9..0c4c7f65b1 100644
--- a/source3/aparser/token.awk
+++ b/source3/aparser/token.awk
@@ -10,7 +10,7 @@ function parse_error(msg) {
next;
}
-/^\#define.*;/ {
+/^\#define.*/ {
split($0,a,"[ \t;]*");
parse_define(a[2], a[3]);
next;
@@ -46,6 +46,20 @@ function parse_error(msg) {
next;
}
+/^[ \t]*typedef union.*\{/ {
+ {if (current_struct!="") parse_error("this cannot appear inside a structure");}
+ split($0,a,"[ \t;()]*");
+ start_union_encap(a[4], a[6], a[7], a[8]);
+ next;
+}
+
+/^[ \t]*STATUS.*\(/ {
+ {if (current_struct!="") parse_error("you cannot have nested structures");}
+ split($0,a,"[ \t;()]*");
+ start_function(a[2], a[3]);
+ next;
+}
+
{if (current_struct=="") parse_error("this must appear inside a structure");}
/^[ \t]*union.*\{/ {
@@ -54,6 +68,13 @@ function parse_error(msg) {
next;
}
+/^[ \t]*\[switch_is.*union.*\{/ {
+ {if (current_union!="") parse_error("you cannot have nested unions");}
+ split($0,a,"[ \t;()]*");
+ start_union_notencap(a[3]);
+ next;
+}
+
/^[ \t]*case.*;/ {
{if (current_union=="") parse_error("this must appear inide a union");}
split($0,a,"[ \t;]*");
@@ -61,12 +82,27 @@ function parse_error(msg) {
next;
}
+/^[ \t]*\[case(.*)\].*;/ {
+ {if (current_union=="") parse_error("this must appear inide a union");}
+ split($0,a,"[ \t;()[\]]*");
+ parse_case(a[6],a[8],a[9]);
+ next;
+}
+
/^[ \t]*\}$/ {
{if (current_union=="") parse_error("this must appear inside a union");}
- end_union();
+ end_union("");
next;
}
+/^[ \t]*\} .*;/ {
+ if (current_union!="") {
+ split($2,a,"[ \t;]*");
+ end_union(a[1]);
+ next;
+ }
+}
+
{if (current_union!="") parse_error("this cannot appear inside a union");}
/^[ \t]*\};/ {
@@ -80,12 +116,35 @@ function parse_error(msg) {
next;
}
+/^[ \t]*\);/ {
+ end_function();
+ next;
+}
+
+/^.*size_is.*\*.*;/ {
+ split($0,a,"[ \t;()]*");
+ add_sizeis_array(a[3], a[5], a[6]);
+ next;
+}
+
/^.*;/ {
split($0,a,"[ \t;]*");
add_struct_elem(a[2], a[3]);
next;
}
+/^[\t ]*void/ {
+ next;
+}
+
+/^[ \t]*\[.*\].*/ {
+ split($0,a,"[ \t;]*");
+ split(a[4], b, "[,]");
+ add_function_param(a[2], a[3], b[1]);
+ next;
+}
+
{
parse_error("Unknown construct.");
}
+