summaryrefslogtreecommitdiffstats
path: root/staptree.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'staptree.cxx')
-rw-r--r--staptree.cxx66
1 files changed, 35 insertions, 31 deletions
diff --git a/staptree.cxx b/staptree.cxx
index 090f0bd3..bc552454 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -405,52 +405,56 @@ void functioncall::print (ostream& o) const
}
-bool
-print_format::parse_print(const std::string &name,
- bool &stream, bool &format, bool &delim, bool &newline, bool &_char)
+print_format*
+print_format::create(const token *t)
{
- const char *n = name.c_str();
+ bool stream, format, delim, newline, _char;
+ const char *n = t->content.c_str();
stream = true;
format = delim = newline = _char = false;
if (strcmp(n, "print_char") == 0)
+ _char = true;
+ else
{
- _char = true;
- return true;
- }
-
- if (*n == 's')
- {
- stream = false;
- ++n;
- }
+ if (*n == 's')
+ {
+ stream = false;
+ ++n;
+ }
- if (0 != strncmp(n, "print", 5))
- return false;
- n += 5;
+ if (0 != strncmp(n, "print", 5))
+ return NULL;
+ n += 5;
- if (*n == 'f')
- {
- format = true;
- ++n;
- }
- else
- {
- if (*n == 'd')
- {
- delim = true;
+ if (*n == 'f')
+ {
+ format = true;
++n;
}
+ else
+ {
+ if (*n == 'd')
+ {
+ delim = true;
+ ++n;
+ }
- if (*n == 'l' && *(n+1) == 'n')
- {
- newline = true;
- n += 2;
+ if (*n == 'l' && *(n+1) == 'n')
+ {
+ newline = true;
+ n += 2;
+ }
}
+
+ if (*n != '\0')
+ return NULL;
}
- return (*n == '\0');
+ print_format *pf = new print_format(stream, format, delim, newline, _char);
+ pf->tok = t;
+ return pf;
}