summaryrefslogtreecommitdiffstats
path: root/parsetest.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-03-02 01:28:50 +0000
committerfche <fche>2005-03-02 01:28:50 +0000
commit56099f083d7a68722ace316be4d288d21caabaee (patch)
tree3e67ec78134a358c1f90f701c165c4c577d62177 /parsetest.cxx
parent2f1a1aead38c1dcd329a694dd8d3290b37320466 (diff)
downloadsystemtap-steved-56099f083d7a68722ace316be4d288d21caabaee.tar.gz
systemtap-steved-56099f083d7a68722ace316be4d288d21caabaee.tar.xz
systemtap-steved-56099f083d7a68722ace316be4d288d21caabaee.zip
* some semantic analysis
2005-03-01 Frank Ch. Eigler <fche@redhat.com> * parse.cxx: Implement left-associativity for several types of operators. Add some more statement types. Parse functions. Be able to print tokens. Simplify error generating functions. Save tokens in all parse tree nodes. * parse.h: Corresponding changes. * staptree.cxx: Move tree-printing functions here. Add many new functions for symbol and type resolution. * staptree.h: Corresponding changes. * semtest.cxx: New semantic analysis pass & test driver. * testsuite/sem*/*: New tests. * parsetest.cxx: Separated parse test driver. * testsuite/parse*/*: Adapt tests to parsetest driver. * Makefile.am: Build semtest. Run its tests. * Makefile.in: Regenerated. * parse.cxx, parse.h: New files: parser.
Diffstat (limited to 'parsetest.cxx')
-rw-r--r--parsetest.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/parsetest.cxx b/parsetest.cxx
new file mode 100644
index 00000000..ab1d53c8
--- /dev/null
+++ b/parsetest.cxx
@@ -0,0 +1,40 @@
+// toy driver
+// Copyright 2005 Red Hat Inc.
+// GPL
+
+
+#include "staptree.h"
+#include "parse.h"
+#include <iostream>
+
+
+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;
+}