summaryrefslogtreecommitdiffstats
path: root/parse.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-09-03 16:52:41 +0000
committerfche <fche>2005-09-03 16:52:41 +0000
commit6a505121fc997e6f21d26f8c8656f99e58faaaab (patch)
treea40bb598454cf046c55c54ddfb46f83492fbdcb9 /parse.cxx
parentd9e1dc7a03b0341bc924ba4a008a31676dbc9510 (diff)
downloadsystemtap-steved-6a505121fc997e6f21d26f8c8656f99e58faaaab.tar.gz
systemtap-steved-6a505121fc997e6f21d26f8c8656f99e58faaaab.tar.xz
systemtap-steved-6a505121fc997e6f21d26f8c8656f99e58faaaab.zip
2005-09-03 Frank Ch. Eigler <fche@elastic.org>
PR 1292, by popular request. * parse.cxx (parse_functiondecl): Allow optional value/param type declarations. * stap.1.in: Document this. * tapset/*.stp: Convert most functions accordingly. * testsuite/parseok/twelve.stp, semok/seven.stp, semko/twenty.stp: Test this.
Diffstat (limited to 'parse.cxx')
-rw-r--r--parse.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/parse.cxx b/parse.cxx
index c4f028b7..a1a54011 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -774,6 +774,18 @@ parser::parse_functiondecl (std::vector<functiondecl*>& functions)
fd->tok = t;
t = next ();
+ if (t->type == tok_operator && t->content == ":")
+ {
+ t = next ();
+ if (t->type == tok_identifier && t->content == "string")
+ fd->type = pe_string;
+ else if (t->type == tok_identifier && t->content == "long")
+ fd->type = pe_long;
+ else throw parse_error ("expected 'string' or 'long'");
+
+ t = next ();
+ }
+
if (! (t->type == tok_operator && t->content == "("))
throw parse_error ("expected '('");
@@ -792,6 +804,17 @@ parser::parse_functiondecl (std::vector<functiondecl*>& functions)
fd->formal_args.push_back (vd);
t = next ();
+ if (t->type == tok_operator && t->content == ":")
+ {
+ t = next ();
+ if (t->type == tok_identifier && t->content == "string")
+ vd->type = pe_string;
+ else if (t->type == tok_identifier && t->content == "long")
+ vd->type = pe_long;
+ else throw parse_error ("expected 'string' or 'long'");
+
+ t = next ();
+ }
if (t->type == tok_operator && t->content == ")")
break;
if (t->type == tok_operator && t->content == ",")