blob: 8806776535f5ef8754eee78e644f035dbf4d6c47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
}
|