]> sourceware.org Git - systemtap.git/blob - parse.h
Fix construction of ".local" variant of the DNS name on server certificates.
[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 <vector>
16 #include <iostream>
17 #include <stdexcept>
18
19 struct stapfile;
20 struct probe;
21
22 struct source_loc
23 {
24 stapfile* file;
25 unsigned line;
26 unsigned column;
27 };
28
29 std::ostream& operator << (std::ostream& o, const source_loc& loc);
30
31 enum parse_context
32 {
33 con_unknown, con_probe, con_global, con_function, con_embedded
34 };
35
36
37 enum token_type
38 {
39 tok_junk, tok_identifier, tok_operator, tok_string, tok_number,
40 tok_embedded, tok_keyword
41 };
42
43
44 struct token
45 {
46 source_loc location;
47 token_type type;
48 std::string content;
49 std::string msg; // for tok_junk
50 void make_junk (std::string msg);
51 const token* chain; // macro invocation that produced this token
52 friend class parser;
53 friend class lexer;
54 private:
55 token() {}
56 token(const token& other):
57 location(other.location), type(other.type), content(other.content),
58 msg(other.msg), chain(other.chain) {}
59 };
60
61
62 std::ostream& operator << (std::ostream& o, const token& t);
63
64
65 typedef enum { ctx_library, ctx_local } macro_ctx;
66
67 /* structs from session.h: */
68 struct systemtap_session;
69 struct macrodecl {
70 const token* tok; // NB: macrodecl owns its token
71 std::string name;
72 std::vector<std::string> formal_args;
73 std::vector<const token*> body;
74 macro_ctx context;
75
76 // Used for identifying subclasses that represent e.g. parameter bindings.
77 virtual bool is_closure() { return false; }
78
79 macrodecl () : tok(0), context(ctx_local) { }
80 virtual ~macrodecl ();
81 };
82
83
84 stapfile* parse (systemtap_session& s, std::istream& i, bool privileged, bool errs_as_warnings);
85 stapfile* parse (systemtap_session& s, const std::string& n, bool privileged, bool errs_as_warnings);
86
87 stapfile* parse_library_macros (systemtap_session& s, const std::string& n, bool errs_as_warnings);
88
89 probe* parse_synthetic_probe (systemtap_session &s, std::istream& i, const token* tok);
90
91 #endif // PARSE_H
92
93 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.039261 seconds and 5 git commands to generate.