summaryrefslogtreecommitdiffstats
path: root/parse.h
Commit message (Collapse)AuthorAgeFilesLines
* PR11004: try / catch error-handling script syntaxFrank Ch. Eigler2010-03-031-0/+2
| | | | | | | | | | | | | | | * parse.h (try_block): New class. Update basic visitors. * staptree.cxx: Implement basic visitors. * parse.cxx (expect_kw): Fix to actually look for keywords. (parse_try_block): New function. (lexer ctor): Designate 'try' and 'catch' as keywords. * elaborate.cxx (dead_assignment_remover, dead_statmtexpr_remover): Optimize. (other visitors): Implement. * translate.cxx (c_unparser): Implement via super-handy __local__ labels. (emit_probe, emit_function): Make outer out: label also __local__. * testsuite/buildok/fortyone.stp, semko/fortynine.stp, systemtap.base/trycatch.exp: Test it. * NEWS, doc/langref.txt, stap.1.in: Document it.
* PR11005: @defined($tvar) predicate, part 1Frank Ch. Eigler2010-02-231-1/+3
| | | | | | | | | | | | | | | | | | * staptree.h (defined_op): New class. * all files: Extend all visitors as appropriate, mostly dummy/pass-through implementation. * parse.cxx (parse_target_symbol): New function, factored out of parse_symbol(). (parse_define_op): New function. * NEWS: Mention it. * parse.h: Corresponding changes. * tapsets.cxx (var_expanding_visitor::visit_defined_op): Implement @defined() semantics. (dwarf_var_expanding_visitor::visit_target_symbol): Adjust. * tapset-utrace.c (visit_target_symbol_arg): Avoid crashes on $argZZZ. * tapsets.cxx (sdt_var_expanding_visitor): Ditto. * semok/thirtysix.stp: New test.
* PR11195: Prevent all nested argument substitutionJosh Stone2010-01-191-1/+3
| | | | | | | | | | | Our existing protection only made sure that the first token in a substitution wasn't a nested substitution. That's not sufficient when there could be multiple tokens involved. This patch makes sure that no nested tokens are ever allowed to be argument substitutions. This also adds a cursor_suspended_line/column and resets the main cursor_line/column to the beginning of the substitution, so errors will point a little closer to the right place.
* Refactor parser for target_symbol->componentsJosh Stone2009-07-311-0/+3
| | | | | | | | The components were being parsed for both target_symbols and cast_ops, so this change refactors that code into a single function. * parse.cxx (parser::parse_target_symbol_components): New. (parser::parse_symbol): Use the new function.
* Remove the filename copy from token->locationJosh Stone2009-07-091-3/+1
| | | | | The location already has a pointer to a stapfile with the filename, so there's no need to keep an extra copy.
* Optimize string usage in the lexerJosh Stone2009-07-091-5/+6
| | | | | This speeds up the parsing stage >2x, mostly by minimizing string construction and comparison where char comparison will do.
* Add Vim modelines for GNU style in stapJosh Stone2009-01-281-0/+2
|
* Display source context for error and warning messages (6701)Rajan Arora2008-10-091-3/+7
|
* gcc 4.4 build compatibility tweaksFrank Ch. Eigler2008-09-121-1/+1
|
* parser/scanner speedupFrank Ch. Eigler2008-09-101-1/+2
|
* trailing whitespace removal, as approved by emacsFrank Ch. Eigler2008-08-281-5/+5
| | | | (add-hook 'before-save-hook 'delete-trailing-whitespace)
* PR6470: fix preprocessor construct nesting/expansion logicFrank Ch. Eigler2008-06-101-2/+2
|
* 2007-12-03 Masami Hiramatsu <mhiramat@redhat.com>hiramatu2007-12-031-4/+4
| | | | | | | | | | | | | PR 5376 * parse.cxx (lexer::scan): Treat '*' as an alphabet if the wildcard flag is true. (parser::parse_probe_point): Call parser::next() with wildcard = true. (parser::scan_pp): Add wildcard flag and pass it to lexer::scan. (parser::next): Ditto. (parser::peek): Ditto. * parse.h : Ditto. * testsuites/perseko/twentytwo.stp: Change testcase to the wildcarded probe points with spaces.
* 2007-08-07 Frank Ch. Eigler <fche@redhat.com>fche2007-08-081-0/+3
| | | | | | | | | | | | | | | | PR 4846 * parse.cxx (input_put): New function, sort of like stdio ungetc. (input_get): Skip cursor position changing for input_put strings. (scan): Rework $.../@... substitution into character pasting. * parse.h: Corresponding changes. * util.h (lex_cast_qstring): Octal-quote unprintable characters. * stap.1.in, NEWS: Document new behaviour. 2007-08-07 Frank Ch. Eigler <fche@redhat.com> PR 4846 * parseko/preprocess13.stp, parseok/nineteen.stp, semok/twentyfive.stp: New tests.
* update copyrightfche2007-04-041-1/+1
|
* 2007-04-03 Pierre Peiffer <pierre.peiffer@bull.net>fche2007-04-041-2/+3
| | | | | | | | | | | | | | | * parse.cxx, parse.h (lexer::scan): Add $# and @# identifiers. (eval_pp_conditional, scan_pp): Allow the use of $x and @x identifiers. Produce more accurate error messages. * stap.1.in: Document $# and @# identifiers. 2007-04-04 Pierre Peiffer <pierre.peiffer@bull.net> * parseok/fourteen.stp: Add test about $# and @# usage during the preprocessing. * parseko/preprocess10.stp: New test. * parseko/preprocess11.stp: New test. * parseko/preprocess12.stp: New test.
* 2007-04-03 Frank Ch. Eigler <fche@elastic.org>fche2007-04-031-3/+7
| | | | | | | | Improve error messages for underprivileged scripts. * parse.h (parse_error): Add skip_some member, true default. * parse.cxx (parse_embedded_code): Send false on missing -g. * parse.cxx (parser::parse): Respect flag during parse error recovery.
* 2006-09-06 Frank Ch. Eigler <fche@elastic.org>fche2006-09-061-1/+1
| | | | | | | | | | | | | Add basic support for initialized globals. * parse.cxx (parse_global): Parse initialization clause, implement by rewriting to "probe begin { var = value }". * parse.h: Corresponding changes. * stap.1.in: Document optional initialization. 2006-09-06 Frank Ch. Eigler <fche@elastic.org> * parseok/eighteen.stp, semok/twentythree.stp: New files for testing initialized globals.
* 2006-08-28 David Smith <dsmith@redhat.com>dsmith2006-08-281-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * translate.cxx: Added inclusion of session.h. (translate_pass): Instead of asking each probe to emit itself, we ask the session's probes member variable to emit all the probes. * tapsets.cxx: Added inclusion of session.h. Added a register_probe member function to all derived_probe based classes. Added a derived_probe_group derived class for all probe types: (be_derived_probe_group): New class. (never_derived_probe_group): New class. (dwarf_derived_probe_group): New class. (timer_derived_probe_group): New class. (profile_derived_probe_group): New class. (mark_derived_probe_group): New class. (hrtimer_derived_probe_group): New class (derived_probe_group_container): New class. * elaborate.h: Removed inclusion of session.h since session.h now includes elaborate.h. (derived_probe): Added register_probe member function. (derived_probe_group): Added class definition. This is the base class of all of the derived probe groups - dwarf, timer, etc. (derived_probe_group_container): Added class definition. An instance of this class will be stored in the session and contain all the other probe groups. * elaborate.cxx (derived_probe_group::register_probe): Added derived_probe_group::register_probe stubs. (alias_derived_probe::register_probe): Added register_probe member function. (semantic_pass_symbols): After deriving a probe, the probes now register themselves with the session. * session.h: Includes elaborate.h to get derived_probe_group_container definition. systemtap_session class 'probes' member variable switched from a vector of derived probes to a derived_probe_group_container. * buildrun.cxx: Added inclusion of session.h since it was removed from elaborate.h. * main.cxx: Added inclusion of session.h since it was removed from elaborate.h. * parse.h: Added forward struct declarations. * staptree.h: Removed inclusion of session.h.
* 2006-07-13 David Smith <dsmith@redhat.com>dsmith2006-07-131-0/+3
| | | | | | | | | | | | | | * parse.cxx (parser::expect_unknown2): New function that looks for 2 possible token types. * parse.cxx (parser::expect_ident_or_keyword): New function that calls parser::expect_unknown2. * parse.cxx (parser::parse_symbol): Calls parser::expect_ident_or_keyword to allow keywords to appear when expanding target symbols (Bugzilla #2913). * parse.h: Added prototypes for parser::expect_unknown2 and parser::expect_ident_or_keyword. * testsuite/parseok/seventeen.stp: New test to check for allowing keywords when expanding target symbols.
* 2006-05-16 David Smith <dsmith@redhat.com>dsmith2006-05-161-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.cxx (parser::parser): Added initializer for 'context' member variable. (tt2str): Added support for new tok_keyword type. (operator <<): Ignores keyword content when outputting error message. (lexer::scan): Recognizes keywords, such as 'probe', 'global', 'function', etc. and classifies them as type 'tok_keyword'. This causes keywords to become reserved so they cannot be used for function names, variable names, etc. (parser::parse): Changed tok_identifier to tok_keyword when looking for "probe", "global", or "function". Also sets context member variable which remembers if we're in probe, global, function, or embedded context. (parser::parse_probe, parser::parse_statement) (parser::parse_global, parser::parse_functiondecl) (parser::parse_if_statement, parser::parse_delete_statement) (parser::parse_break_statement, parser::parse_continue_statement) (parser::parse_for_loop, parser::parse_while_loop) (parser::parse_foreach_loop, parser::parse_array_in): Looks for tok_keyword instead of tok_identifier. (parser::parse_probe_point): Allows keywords as part of a probe name, since "return" and "function" are keywords. (parser::parse_return_statement): Looks for tok_keyword instead of tok_identifier. Make sure we're in function context. (parser::parse_next_statement): Looks for tok_keyword instead of tok_identifier. Make sure we're in probe context. * parse.h: Added parse_context enum. Added 'tok_keyword' to token_type enum. Added parse_context 'context' member variable to parser class. * stap.1.in: Because the string() function has been removed, the 'string()' function reference has been changed to a 'sprint()' function reference. * stapex.5.in: Ditto. * stapfuncs.5.in: The description of the string() and hexstring() functions has been removed. * testsuite/buildok/context_test.stp: Calls to the string() function were converted to sprint() function calls. * testsuite/buildok/fifteen.stp: Ditto. * testsuite/buildok/nineteen.stp: Ditto. * testsuite/buildok/process_test.stp: Ditto. * testsuite/buildok/task_test.stp: Ditto. * testsuite/buildok/timestamp.stp: Ditto. * testsuite/buildok/twentyone.stp: Ditto. * testsuite/semok/args.stp: Ditto. * testsuite/semok/seven.stp: Ditto. * testsuite/buildok/fourteen.stp: Calls to log()/string() were converted to a call to printf(). * testsuite/buildok/sixteen.stp: Ditto. * testsuite/buildok/thirteen.stp: Ditto. * testsuite/buildok/twentythree.stp: Ditto. * testsuite/buildok/twentytwo.stp: Ditto. * testsuite/buildok/seven.stp: Calls to the string() function were converted to sprint() calls. Calls to the hexstring() function were converted to sprintf() calls. * testsuite/semok/eleven.stp: Ditto. * testsuite/buildok/seventeen.stp: Calls to log()/hexstring() were converted to a call to printf(). * testsuite/semko/nineteen.stp: Ditto. * testsuite/parseok/three.stp: Because keywords are reserved, a variable named 'string' was renamed to 'str'. * testsuite/parseok/two.stp: Because keywords are reserved, a variable named 'global' was renamed to 'gbl'. * testsuite/transko/two.stp: Because the parser now checks for 'next' and 'return' statement context, a 'next' statement was removed from a function and a 'return' statement was removed from a probe.
* Print out information to make it easier to determine which probewcohen2006-05-091-0/+1
| | | | in script associated with timing information.
* 2006-02-23 Frank Ch. Eigler <fche@elastic.org>fche2006-02-231-1/+2
| | | | | | | | | | | | | | | PR 1304 * parse.cxx (lexer): Take systemtap_session argument. (lexer::scan): Support $1..$NNNN and @1...@NNNN expansion. * stap.1.in: Document this. * testsuite/semok/args.stp: New test. * translate.cxx (var::init, emit_global): Emit code to allow named module parameters to initialize global string/number scalars. * stap.1.in: Don't document this yet. PR 2334 * main.cxx (main): Clarify "-v" option repeatibility. * stap.1.in: Ditto.
* 2005-11-23 Graydon Hoare <graydon@redhat.com>graydon2005-11-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elaborate.h (get_symbol_within_expression): Make visible. * elaborate.cxx (get_symbol_within_expression): Make non-static. (stat_decl_collector): New struct. (semantic_pass_stats): New semantic pass. (semantic_pass): Call it. (semantic_pass_symbols): Remove collection of statistic_decls from files. (visit_stat_op): Only fail if inferred type is not pe_long. * parse.cxx (parser::parse): Don't pass per-file statistic_decl into parse_global. (parser::parse_global): Don't parse global statistic_decls, they're obsolete. * parse.hh (parser::parse_global): Adjust signature to match. * session.h (statistic_decl::operator==): New method. * staptree.h (print_format::is_empty): New method. (stapfile::stat_decls): Remove field. * staptree.cxx (string_to_components): Fix bugs in format-string parser. * translate.cxx (var): Make private fields protected. (var::init): Support HIST_NONE stats. (aggvar): New struct. (mapvar::is_parallel): New method. (mapvar::call_prefix): Use it. (mapvar::calculate_aggregate): New method. (mapvar::fetch_existing_aggregate): New method. (mapvar::get): Support pe_stats. (mapvar::init): Use is_parallel(), and support HIST_NONE. (itervar::itervar): Only fault on pe_unknown. (itervar::start): Use mapvar::is_parallel and mapvar::fetch_existing_aggregate. (emit_map_type_instantiations): Include alloc.c before pmap-gen.c. Include pmap-gen.c for pe_stats maps. (c_unparser::gensym_aggregate): New method. (c_unparser::visit_foreach_loop): Handle mapvar::is_parallel case. (arrayindex_downcaster): New struct. (expression_is_arrayindex): New function. (c_tmpcounter::visit_stat_op): New method. (c_unparser::visit_stat_op): Implement. (c_unparser::visit_hist_op): Add commentary, still not implemented. * testsuite/buildok/stat_{insert,extract}.stp: New tests. * testsuite/semok/ten.stp: Correct for changes to global declarations. * testsuite/semko/*.stp: Likewise.
* 2005-11-13 Graydon Hoare <graydon@redhat.com>graydon2005-11-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * staptree.h (struct indexable): New struct. (classify_indexable): New function. (classify_const_indexable): New function. (struct symbol): Implement indexable. (struct arrayindex): Take indexable as base. (struct foreach_loop): Take indexable as base. (struct print_format): New struct. (enum stat_component_type): New enum. (struct stat_op): New struct. (enum historgram_type): New enum. (struct hist_op): New struct. (struct visitor) (struct traversing_visitor) (struct throwing_visitor) (struct deep_copy_visitor): Add new visitor methods. (require): Specialize for indexable*. * staptree.cxx (print_format::*) (stat_op::*) (hist_op::*) (indexable::*) (traversing_visitor::*) (throwing_visitor::*) (deep_copy_visitor::*) (classify_indexable) (classify_const_indexable): Implement (deep_copy_visitor::*): Update to use indexables. * parse.h (parser::parse_indexable): New method. (parser::parse_hist_op_or_bare_name): New method. * parse.cxx (lexer::scan): Accept @ in identifiers. (parser::parse_array_in) (parser::parse_foreach_loop): Call parse_indexable. (parser::parse_hist_op_or_bare_name): Implement. (parser::parse_indexable): Implement. (parser::parse_symbol): Accept printf, stat_ops, hist_ops. * elaborate.h (struct typeresolution_info): Add methods for visiting print_format, stat_op, hist_op. * elaborate.cxx (symbol_fetcher): New class. (get_symbol_within_expression): New function. (get_symbol_within_indexable): New function. (mutated_var_collector): Replace mutated_map_collector. (no_var_mutation_during_iteration_check): Replace no_map_mutation_during_iteration_check. (semantic_pass_vars): Replace semantic_pass_maps. (semantic_pass): Update call accordingly. (symresolution_info::*) Add new visitors, teach about indexables (typeresolution_info::*) Likewise. * translate.cxx (c_unparser::getiter): Take symbol, not foreach_loop. (c_unparser::*) Add new visitors, teach about indexables. (c_tmpcounter::*) (delete_statement_operand_visitor::visit_arrayindex) (c_tmpcounter_assignment::*) (c_unparser_assignment::*): Likewise. (hist_op_downcaster): New struct. (expression_is_hist_op): New function. * testsuite/buildok/printf.stp: New test for print_format.
* 2005-11-01 Frank Ch. Eigler <fche@elastic.org>fche2005-11-011-5/+13
| | | | | | | | | | | | | | | | | | | | 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.
* 2005-10-20 Graydon Hoare <graydon@redhat.com>graydon2005-10-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR 917 (incomplete) * staptree.h (struct statistic_decl): New struct. (stapfile::stat_decls): New member. * parse.h, parse.cxx (parser::expect_known): Fix typo. (parser::expect_number): New method. (parser::parse_global): Parse global statistic_decls. * elaborate.h (systemtap_session::stat_decls): New member. * elaborate.cxx (semantic_pass_symbols): Copy per-file stat_decls to session-wide. (typeresolution_info::visit_assignment): Detect some semantic stats errors in type resolution pass. * translate.cxx (var::sd): New private member. (var::var): Initialize it. (var::sdecl): New accessor. (var::init): Handle stats values. (mapvar::mapvar): Pass through statistic_decl to var ctor. (mapvar::get): Test for long explicitly. (mapvar::set): Likewise. (mapvar::init): Handle stats values. (c_unparser::emit_common_header): Remove typedef of stats_t, include stat.c when necessary. (mapvar::key_typename): Typo. (c_unparser::emit_map_type_instantiations): Thinko: value_typename not key_typename. (c_unparser::c_typename): Implementation typename is "Stat", not "stats_t". (c_unparser::c_assign): Fix bad error message. (c_unparser_assignment::c_assignop): Handle operator <<<. (c_unparser::getvar): Feed session statistic_decl into var. (c_unparser::getmap): Likewise. (c_unparser::visit_assignment): Handle operator <<<. (c_tmpcounter_assignment::visit_symbol): Derive type from rvalue when present. (c_unparser_assignment::visit_symbol) (c_tmpcounter_assignment::visit_arrayindex) (c_unparser_assignment::load_map_indices): Likewise. (c_unparser::visit_arrayindex): Likewise, and Prohibit statistic rvalues. (c_unparser_assignment::visit_arrayindex): Handle operator <<<. * testsuite/semko/twentyfour.stp: * testsuite/semko/twentyfive.stp: * testsuite/semko/twentysix.stp: * testsuite/semko/twentyseven.stp: * testsuite/semko/twentyeight.stp: * testsuite/semko/twentynine.stp: * testsuite/semko/thirty.stp: * testsuite/semko/thirtyone.stp: New tests for prohibited statistic contexts. * testsuite/buildok/twentytwo.stp: New test for legal statistic contexts.
* 2005-08-09 Graydon Hoare <graydon@redhat.com>graydon2005-08-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * staptree.{cxx,h} (target_symbol): New struct. (*_visitor::visit_target_symbol): Support it. (visitor::active_lvalues) (visitor::is_active_lvalue) (visitor::push_active_lvalue) (visitor::pop_active_lvalue): Support lvalue-detection. (delete_statement::visit) (pre_crement::visit) (post_crement::visit) (assignment::visit): Push and pop lvalue expressions. * elaborate.{cxx,h} (lvalule_aware_traversing_visitor): Remove class. (no_map_mutation_during_iteration_check) (mutated_map_collector): Update lvalue logic. (typeresolution_info::visit_target_symbol): Add, throw error. * parse.{cxx,h} (tt2str) (tok_is) (parser::expect_*) (parser::peek_*): New helpers. (parser::parse_symbol): Rewrite, support target_symbols. * translate.cxx (c_unparser::visit_target_symbol): Implement. * tapsets.cxx (var_expanding_copy_visitor): Update lvalue logic, change visit_symbol to visit_target_symbol.
* 2005-07-28 Frank Ch. Eigler <fche@redhat.com>fche2005-07-281-5/+6
| | | | | | | | | | | | | | | | | | | translator/1120 * main.cxx (main): Preset -R and -I options from environment variables (if set). Pass guru mode flags to parser. * parse.cxx (privileged): New parser operation flag. Update callers. (parse_embeddedcode): Throw an error if !privileged. (parse_functiondecl): Change signature. Prevent duplicates. (parse_globals): Ditto. * parse.h: Corresponding changes. * tapset/*.stp: Beginnings of real tapset library, to replace previous builtins. * tapsets.cxx: Greatly reduce verbose mode output. * Makefile.am: Install & dist it. * runtest.sh: Refer to it. * Makefile.in, aclocal.m4: Regenerated. * testsuite/*/*.stp: Set guru mode via /bin/sh if needed. * testusite/*/*ko.stp: Homogenize shell scripts.
* 2005-07-26 Frank Ch. Eigler <fche@redhat.com>fche2005-07-261-3/+5
| | | | | | | | | | | | | | | | | | | | | Support %{ embedded-c %} * staptree.h (embeddedcode): New statement subtype. Stub support in visitors. * staptree.cxx: Ditto. * parse.cxx: Parse %{ / %}. Accept "_" as identifier leading char. (parse_probe): Simplify calling convention. * elaborate.h: Store embedded code. * elaborate.cxx: Pass it. * translate.cxx: Transcribe it. Return some dropped module init/exit code. * Makefile.am: Add buildok/buildko tests. * Makefile.in: Regenerated. * main.cxx: Return EXIT_SUCCESS/FAILURE even for weird rc. * testsuite/parseok/nine.stp: Test _identifiers. * testsuite/transko/*.stp: Tweak to force -p3 rather than -p2 errors. * testsuite/semok/transko.stp: ... and keep it that way in the future. * testsuite/parse*/*: Some new tests for %{ %}. * testsuite/build*/*: New tests for -p4.
* 2005-06-27 Graydon Hoare <graydon@redhat.com>graydon2005-06-291-1/+1
| | | | | | | | | | | | | | | * staptree.{h,cxx} (probe_alias): New structure. * parse.{h,cxx} (parser::parse): Parse probes or probe aliases. (parser::parse_probe): Likewise. * tapsets.{h,cxx}: (derived_probe_builder): (match_key): (match_node): (alias_derived_probe): Move from here, * elaborate.{h,cxx}: to here. * elaborate.h (systemtap_session::pattern_root): New member. (register_library_aliases): New function. * tapsets.cxx: Build one dwarf_derived_probe per target address.
* 2005-06-08 Frank Ch. Eigler <fche@redhat.com>fche2005-06-081-1/+6
| | | | | | | | | | | | | | | systemtap/916 Implement all basic scalar operators, including modify-assignment. * parse.cxx (lexer): Allow multi-character lookahead in order to scan 1/2/3-character operators. (parse_boolean_or/and/xor/shift): New routines. * translate.cxx (visit_assignment, visit_binary_expression, visit_*_crement): Generally rewrote. (visit_*): Added more parentheses in output. (emit_module_init): Initialize globals. * staptree.h, elaborate.cxx, elaborate.h: Remove exponentiation. * main.cxx (main): Add an end-of-line to output file. * testsuite/*: Several new tests.
* 2005-06-05 Frank Ch. Eigler <fche@elastic.org>fche2005-06-051-0/+4
| | | | | | | | | | | Implement for/next/continue/break/while statements. * staptree.h: Declare new 0-arity statement types. Tweak for_loop. * parse.cxx: Parse them all. * translate.cxx (c_unparser): Maintain break/continue label stack. (visit_for_loop, *_statement): New implementations. * elaborate.*, staptree.cxx: Mechanical changes. * testsuite/parseok/ten.stp, semko/twelve.stp, transko/two.stp, transok/five.stp: New tests.
* 2005-06-02 Frank Ch. Eigler <fche@redhat.com>fche2005-06-021-2/+10
| | | | | | | | | | | | | | | | Parse foreach construct. Added fuller copyright notices throughout. * staptree.h (foreach_loop): New tree node type. * staptree.cxx: Print it, visit it, love it, leave it. * parse.cxx: Parse it. (parse_stmt_block): Don't require ";" separators between statements. (parse_array_in): Use [] as index group operator instead of (). * elaborate.cxx (visit_foreach_loop): New code. * translate.cxx: Slightly tighten errorcount/actioncount handling. * main.cxx: Accept "-" as script file name standing for stdin. (visit_arrayindex): Switch to simpler set_arity call. * configure.ac: Generate DATE macro. * Makefile.in, configure, config.in: Regenerated. * testsuite/*: New/updated tests for syntax changes, foreach ().
* 2005-05-30 Frank Ch. Eigler <fche@redhat.com>fche2005-05-301-1/+0
| | | | | | | | | | | | | | | | | More fully parse & elaborate "expr in array" construct. * staptree.h (array_in): Make this unary. Update .cxx to match. * parse.cxx (parse_array_in): Rewrite. (parse_symbol_plain): Removed. Update .h to match. * elaborate.cxx (typeresolution_info::visit_array_in): New function. (find_array): Tentatively, accept arity=0. * translate.cxx (c_unparser::c_assign): New functions to eliminate much ugly duplication. Use throughout. (visit_symbol): Correct function formal argument search. (c_tmpcounter*::visit): Add missing recursion in several functions. * testsuite/*: Add new tests for array-in construct. Add the first "transok" test. * Makefile.am: Add transok tests. * Makefile.in: Regenerated.
* * at long last, a more full-bodied snapshotfche2005-05-211-1/+9
| | | | | | | | | | | | 2005-05-20 Frank Ch. Eigler <fche@redhat.com> Many changes throughout. Partial sketch of translation output. * elaborate.*: Elaboration pass. * translate.*: Translation pass. * staptree.*: Simplified for visitor concept. * main.cxx: Translator mainline. * *test.cxx: Removed. * testsuite/*: Some new tests, some changed for newer syntax.
* * preliminaries for code generation logicfche2005-05-051-0/+3
| | | | | | | | | | | | | | | | | | | | | 2005-05-05 Frank Ch. Eigler <fche@redhat.com> * parse.cxx (parse): Add helper methods. (lexer::scan, parse_assignment): Parse "<<<" operator. Fix assignment associativity. (parse_symbol): Permit function with empty arg list. (parse_global, parse_statement, parse_functiondecl): Expect unconsumed leading keyword. (parse_global): Don't use ";" termination. * parse.h: Corresponding changes. * staptree.cxx (binary_expression::resolve_types): Fix <<< type inference. (translator_output): Improve pretty-printing. (*): Add general visitors to statement/expression types. * staptree.h: Corresponding changes. Tweak symresolution_info fields. Add semantic_error class. * semtest.cxx: Adapt to this. * testsuite/parseok/two.stp, semok/*.stp: Adapt to syntax changes.
* 2005-03-15 Frank Ch. Eigler <fche@redhat.com>fche2005-03-151-1/+1
| | | | | | | | | | | | | | * TODO: New file. Include some probe-point-provider syntax examples. * parse.cxx (lexer::scan, parser::parse_literal): Support hex, octal numbers via strtol. (parse_probe, parse_probe_point): Modify for dotted syntax. * staptree.cxx: Ditto. * parsetest.cxx, semtest.cxx: Print parse/sem results even if .stp files were given on command line. * parse.h, staptree.h: Rename probe_point_spec -> probe_point. * runtest.sh: New test-runner front-end script. * Makefile.am: Use it for TESTS_ENVIRONMENT. * testsuite/*: Update probe point syntax. Add a bunch of new tests.
* 2005-03-04 Frank Ch. Eigler <fche@redhat.com>fche2005-03-041-0/+2
| | | | | | | | | | | * parse.cxx (scan): Support '$' characters in identifiers. (parse_symbol): Support thread-> / process-> shorthand. * staptree.cxx (symresolution_info::find): Split up into find_scalar, find_array, find_function. (resolve_symbols): Call the above for symbol/arrayindex/functioncall. (find_scalar): Add stub support for synthetic builtin variables. * staptree.h: Corresponding changes. * testsuite/*: Some new tests.
* * some semantic analysisfche2005-03-021-1/+7
| | | | | | | | | | | | | | | | | | | | | 2005-03-01 Frank Ch. Eigler <fche@redhat.com> * parse.cxx: Implement left-associativity for several types of operators. Add some more statement types. Parse functions. Be able to print tokens. Simplify error generating functions. Save tokens in all parse tree nodes. * parse.h: Corresponding changes. * staptree.cxx: Move tree-printing functions here. Add many new functions for symbol and type resolution. * staptree.h: Corresponding changes. * semtest.cxx: New semantic analysis pass & test driver. * testsuite/sem*/*: New tests. * parsetest.cxx: Separated parse test driver. * testsuite/parse*/*: Adapt tests to parsetest driver. * Makefile.am: Build semtest. Run its tests. * Makefile.in: Regenerated. * parse.cxx, parse.h: New files: parser.
* * parser prototype snapshotfche2005-02-121-0/+102