diff options
author | fche <fche> | 2005-02-12 02:28:43 +0000 |
---|---|---|
committer | fche <fche> | 2005-02-12 02:28:43 +0000 |
commit | 2f1a1aead38c1dcd329a694dd8d3290b37320466 (patch) | |
tree | 3700f34d81fadb3b3f2cf850cce7eaec73d70659 /staptree.cxx | |
download | systemtap-steved-2f1a1aead38c1dcd329a694dd8d3290b37320466.tar.gz systemtap-steved-2f1a1aead38c1dcd329a694dd8d3290b37320466.tar.xz systemtap-steved-2f1a1aead38c1dcd329a694dd8d3290b37320466.zip |
* parser prototype snapshot
Diffstat (limited to 'staptree.cxx')
-rw-r--r-- | staptree.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/staptree.cxx b/staptree.cxx new file mode 100644 index 00000000..88067765 --- /dev/null +++ b/staptree.cxx @@ -0,0 +1,44 @@ +// toy driver +// Copyright 2005 Red Hat Inc. +// GPL + +#include "staptree.h" +#include "parse.h" +#include <iostream> + + + +expression::~expression () {} +statement::~statement () {} + + +int main (int argc, char *argv []) +{ + int rc = 0; + + if (argc > 1) + { + // quietly parse all listed input files + for (int i = 1; i < argc; i ++) + { + parser p (argv[i]); + stapfile* f = p.parse (); + if (f) + cout << "file '" << argv[i] << "' parsed ok." << endl; + else + rc = 1; + } + } + else + { + // parse then print just stdin + parser p (cin); + stapfile* f = p.parse (); + if (f) + f->print (cout); + else + rc = 1; + } + + return rc; +} |