diff options
author | fche <fche> | 2006-06-02 18:09:29 +0000 |
---|---|---|
committer | fche <fche> | 2006-06-02 18:09:29 +0000 |
commit | 6e3347a9815f4a457b6393a22f21b6f2c6b588af (patch) | |
tree | 601c0606344da1c306fe96ee32a264a29c42b5a0 /parse.cxx | |
parent | 988b22347d6598de909457326d9a7a470e3f631c (diff) | |
download | systemtap-steved-6e3347a9815f4a457b6393a22f21b6f2c6b588af.tar.gz systemtap-steved-6e3347a9815f4a457b6393a22f21b6f2c6b588af.tar.xz systemtap-steved-6e3347a9815f4a457b6393a22f21b6f2c6b588af.zip |
2006-06-02 Frank Ch. Eigler <fche@elastic.org>
PR 2645.
* stapprobes.5.in: Document "?" probe point suffix.
* parse.cxx (parse_probe_point): Recognize "?" optional suffix.
* elaborate.cxx (derive_probes): Observe probe_point->optional.
* staptree.h, staptree.cxx: Corresponding changes.
* tapsets.cxx (never_derived_probe, never_builder): New classes.
(register_standard_tapsets): Support "never" probe point.
* testsuite/buildok/six.stp, parseok/five.stp: Modifed tests.
* translate.cxx (emit_module_init): Format "-t" (benchmarking)
cycle-time reports similarly to "-v" (verbose) times.
Diffstat (limited to 'parse.cxx')
-rw-r--r-- | parse.cxx | 40 |
1 files changed, 24 insertions, 16 deletions
@@ -1140,7 +1140,7 @@ parser::parse_probe_point () probe_point::component* c = new probe_point::component; c->functor = t->content; pl->components.push_back (c); - // NB though we still may add c->arg soon + // NB we may add c->arg soon const token* last_t = t; t = peek (); @@ -1164,11 +1164,7 @@ parser::parse_probe_point () t = peek (); } - if (t && t->type == tok_operator - && (t->content == "{" || t->content == "," || t->content == "=" - || t->content == "+=" )) - break; - + // consume optional parameter if (t && t->type == tok_operator && t->content == "(") { next (); // consume "(" @@ -1179,19 +1175,31 @@ parser::parse_probe_point () throw parse_error ("expected ')'"); t = peek (); - if (t && t->type == tok_operator - && (t->content == "{" || t->content == "," || t->content == "=")) - break; - else if (t && t->type == tok_operator && - t->content == "(") - throw parse_error ("unexpected '.' or ',' or '{'"); } - // fall through if (t && t->type == tok_operator && t->content == ".") - next (); - else - throw parse_error ("expected '.' or ',' or '(' or '{' or '=' or '+='"); + { + next (); + continue; + } + + // We only fall through here at the end of a probe point (past + // all the dotted/parametrized components). + + if (t && t->type == tok_operator && t->content == "?") + { + pl->optional = true; + next (); + t = peek (); + // fall through + } + + if (t && t->type == tok_operator + && (t->content == "{" || t->content == "," || + t->content == "=" || t->content == "+=" )) + break; + + throw parse_error ("expected '.' or ',' or '(' or '?' or '{' or '=' or '+='"); } return pl; |