diff options
author | fche <fche> | 2005-09-03 16:52:41 +0000 |
---|---|---|
committer | fche <fche> | 2005-09-03 16:52:41 +0000 |
commit | 6a505121fc997e6f21d26f8c8656f99e58faaaab (patch) | |
tree | a40bb598454cf046c55c54ddfb46f83492fbdcb9 /parse.cxx | |
parent | d9e1dc7a03b0341bc924ba4a008a31676dbc9510 (diff) | |
download | systemtap-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.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 == ",") |