]>
sourceware.org Git - systemtap.git/blob - parse.h
2 // Copyright (C) 2005-2007 Red Hat Inc.
3 // Copyright (C) 2007 Bull S.A.S
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
28 std::ostream
& operator << (std::ostream
& o
, const source_loc
& loc
);
32 con_unknown
, con_probe
, con_global
, con_function
, con_embedded
38 tok_junk
, tok_identifier
, tok_operator
, tok_string
, tok_number
,
39 tok_embedded
, tok_keyword
51 std::ostream
& operator << (std::ostream
& o
, const token
& t
);
54 struct parse_error
: public std::runtime_error
58 parse_error (const std::string
& msg
):
59 runtime_error (msg
), tok (0), skip_some (true) {}
60 parse_error (const std::string
& msg
, const token
* t
):
61 runtime_error (msg
), tok (t
), skip_some (true) {}
62 parse_error (const std::string
& msg
, bool skip
):
63 runtime_error (msg
), tok (0), skip_some (skip
) {}
67 struct systemtap_session
;
72 token
* scan (bool expand_args
=true);
73 lexer (std::istream
&, const std::string
&, systemtap_session
&);
78 void input_put (const std::string
&);
79 int input_peek (unsigned n
=0);
81 std::string input_name
;
82 std::vector
<int> lookahead
;
83 unsigned cursor_suspend_count
;
85 unsigned cursor_column
;
86 systemtap_session
& session
;
103 struct expr_statement
;
104 struct return_statement
;
105 struct delete_statement
;
106 struct break_statement
;
107 struct next_statement
;
108 struct continue_statement
;
116 parser (systemtap_session
& s
, std::istream
& i
, bool p
);
117 parser (systemtap_session
& s
, const std::string
& n
, bool p
);
122 static stapfile
* parse (systemtap_session
& s
, std::istream
& i
, bool privileged
);
123 static stapfile
* parse (systemtap_session
& s
, const std::string
& n
, bool privileged
);
126 systemtap_session
& session
;
127 std::string input_name
;
128 std::istream
* free_input
;
131 parse_context context
;
133 // preprocessing subordinate
134 std::vector
<const token
*> enqueued_pp
;
135 const token
* scan_pp (bool expand_args
=true);
138 const token
* last ();
139 const token
* next ();
140 const token
* peek ();
142 const token
* last_t
; // the last value returned by peek() or next()
143 const token
* next_t
; // lookahead token
146 const token
* expect_known (token_type tt
, std::string
const & expected
);
147 const token
* expect_unknown (token_type tt
, std::string
& target
);
148 const token
* expect_unknown2 (token_type tt1
, token_type tt2
,
149 std::string
& target
);
152 const token
* expect_op (std::string
const & expected
);
153 const token
* expect_kw (std::string
const & expected
);
154 const token
* expect_number (int64_t & expected
);
155 const token
* expect_ident (std::string
& target
);
156 const token
* expect_ident_or_keyword (std::string
& target
);
157 bool peek_op (std::string
const & op
);
158 bool peek_kw (std::string
const & kw
);
160 void print_error (const parse_error
& pe
);
163 private: // nonterminals
164 void parse_probe (std::vector
<probe
*>&, std::vector
<probe_alias
*>&);
165 void parse_global (std::vector
<vardecl
*>&, std::vector
<probe
*>&);
166 void parse_functiondecl (std::vector
<functiondecl
*>&);
167 embeddedcode
* parse_embeddedcode ();
168 probe_point
* parse_probe_point ();
169 literal
* parse_literal ();
170 block
* parse_stmt_block ();
171 statement
* parse_statement ();
172 if_statement
* parse_if_statement ();
173 for_loop
* parse_for_loop ();
174 for_loop
* parse_while_loop ();
175 foreach_loop
* parse_foreach_loop ();
176 expr_statement
* parse_expr_statement ();
177 return_statement
* parse_return_statement ();
178 delete_statement
* parse_delete_statement ();
179 next_statement
* parse_next_statement ();
180 break_statement
* parse_break_statement ();
181 continue_statement
* parse_continue_statement ();
182 indexable
* parse_indexable ();
183 const token
*parse_hist_op_or_bare_name (hist_op
*&hop
, std::string
&name
);
184 expression
* parse_expression ();
185 expression
* parse_assignment ();
186 expression
* parse_ternary ();
187 expression
* parse_logical_or ();
188 expression
* parse_logical_and ();
189 expression
* parse_boolean_or ();
190 expression
* parse_boolean_xor ();
191 expression
* parse_boolean_and ();
192 expression
* parse_array_in ();
193 expression
* parse_comparison ();
194 expression
* parse_shift ();
195 expression
* parse_concatenation ();
196 expression
* parse_additive ();
197 expression
* parse_multiplicative ();
198 expression
* parse_unary ();
199 expression
* parse_crement ();
200 expression
* parse_value ();
201 expression
* parse_symbol ();
This page took 0.04883 seconds and 6 git commands to generate.