From 6a505121fc997e6f21d26f8c8656f99e58faaaab Mon Sep 17 00:00:00 2001 From: fche Date: Sat, 3 Sep 2005 16:52:41 +0000 Subject: 2005-09-03 Frank Ch. Eigler 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. --- parse.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'parse.cxx') 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& 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& 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 == ",") -- cgit