From 177a8ead26e48a61efd904103a9d189cb27009dd Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 1 Nov 2005 16:13:35 +0000 Subject: 2005-11-01 Frank Ch. Eigler PR 1425. * configure.ac: Look for rpm-devel headers and libs. * configure: Regenerated. * session.h: New file to contain systemtap_session decl. * staptree.h: Likewise evict statistics_decl. * elaborate.h: Corresponding changes. * main.cxx (usage): Elaborate. Re-enable "-r RELEASE" option. * parse.cxx (parser): Add systemtap_session& field. Update users. (scan_pp, eval_pp_conditional): New routines for preprocessing. (peek, next): Call it. (lexer::scan): Lex the preprocessor operators. (parser::parse): Include an extra level of exception catching for parse errors that occur during recovery. * parse.h: Corresponding changes. (parse_error): Allow explicit token parameter. * stap.1.in: Document preprocessing. * testsuite/parseok/fourteen.stp: New test. --- parse.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'parse.h') diff --git a/parse.h b/parse.h index f8ef1ac2..efb78646 100644 --- a/parse.h +++ b/parse.h @@ -46,7 +46,10 @@ std::ostream& operator << (std::ostream& o, const token& t); struct parse_error: public std::runtime_error { - parse_error (const std::string& msg): runtime_error (msg) {} + const token* tok; + parse_error (const std::string& msg): runtime_error (msg), tok (0) {} + parse_error (const std::string& msg, const token* t): runtime_error (msg), + tok (t) {} }; @@ -70,21 +73,26 @@ private: class parser { public: - parser (std::istream& i, bool p); - parser (const std::string& n, bool p); + parser (systemtap_session& s, std::istream& i, bool p); + parser (systemtap_session& s, const std::string& n, bool p); ~parser (); stapfile* parse (); - static stapfile* parse (std::istream& i, bool privileged); - static stapfile* parse (const std::string& n, bool privileged); + static stapfile* parse (systemtap_session& s, std::istream& i, bool privileged); + static stapfile* parse (systemtap_session& s, const std::string& n, bool privileged); private: + systemtap_session& session; std::string input_name; std::istream* free_input; lexer input; bool privileged; + // preprocessing subordinate + std::vector enqueued_pp; + const token* scan_pp (); + // scanning state const token* last (); const token* next (); -- cgit