]> sourceware.org Git - systemtap.git/blob - parse.h
Don't compile csclient.cxx and cscommon.cxx when HAVE_NSS is false.
[systemtap.git] / parse.h
1 // -*- C++ -*-
2 // Copyright (C) 2005-2010 Red Hat Inc.
3 // Copyright (C) 2007 Bull S.A.S
4 //
5 // This file is part of systemtap, and is free software. You can
6 // redistribute it and/or modify it under the terms of the GNU General
7 // Public License (GPL); either version 2, or (at your option) any
8 // later version.
9
10
11 #ifndef PARSE_H
12 #define PARSE_H
13
14 #include <string>
15 #include <iostream>
16 #include <stdexcept>
17
18 struct stapfile;
19
20 struct source_loc
21 {
22 stapfile* file;
23 unsigned line;
24 unsigned column;
25 };
26
27 std::ostream& operator << (std::ostream& o, const source_loc& loc);
28
29 enum parse_context
30 {
31 con_unknown, con_probe, con_global, con_function, con_embedded
32 };
33
34
35 enum token_type
36 {
37 tok_junk, tok_identifier, tok_operator, tok_string, tok_number,
38 tok_embedded, tok_keyword
39 };
40
41
42 struct token
43 {
44 source_loc location;
45 token_type type;
46 std::string content;
47 };
48
49
50 std::ostream& operator << (std::ostream& o, const token& t);
51
52
53 struct parse_error: public std::runtime_error
54 {
55 const token* tok;
56 bool skip_some;
57 parse_error (const std::string& msg):
58 runtime_error (msg), tok (0), skip_some (true) {}
59 parse_error (const std::string& msg, const token* t):
60 runtime_error (msg), tok (t), skip_some (true) {}
61 parse_error (const std::string& msg, bool skip):
62 runtime_error (msg), tok (0), skip_some (skip) {}
63 };
64
65
66 struct systemtap_session;
67
68 stapfile* parse (systemtap_session& s, std::istream& i, bool privileged);
69 stapfile* parse (systemtap_session& s, const std::string& n, bool privileged);
70
71
72 #endif // PARSE_H
73
74 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.037905 seconds and 5 git commands to generate.