LCOV - code coverage report
Current view: top level - mnt/wasteland/wcohen/systemtap_write/systemtap/re2c-migrate - stapregex.h (source / functions) Hit Total Coverage
Test: stap.info Lines: 0 3 0.0 %
Date: 2013-03-08 Functions: 0 3 0.0 %
Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : // -*- C++ -*-
       2                 :            : // Copyright (C) 2012-2013 Red Hat Inc.
       3                 :            : //
       4                 :            : // This file is part of systemtap, and is free software.  You can
       5                 :            : // redistribute it and/or modify it under the terms of the GNU General
       6                 :            : // Public License (GPL); either version 2, or (at your option) any
       7                 :            : // later version.
       8                 :            : //
       9                 :            : // ---
      10                 :            : //
      11                 :            : // This file incorporates code from the re2c project; please see
      12                 :            : // re2c-migrate/README for details.
      13                 :            : 
      14                 :            : #ifndef STAPREGEX_H
      15                 :            : #define STAPREGEX_H
      16                 :            : 
      17                 :            : #include <string>
      18                 :            : #include <iostream>
      19                 :            : #include <stdexcept>
      20                 :            : 
      21                 :            : struct systemtap_session; /* from session.h */
      22                 :            : struct translator_output; /* from translate.h */
      23                 :            : namespace re2c {
      24                 :            :   class RegExp; /* from re2c-regex.h */
      25                 :            :   class DFA; /* from re2c-dfa.h */
      26                 :            : };
      27                 :            : 
      28                 :            : struct stapdfa {
      29                 :            :   std::string orig_input;
      30                 :            :   stapdfa (const std::string& func_name, const std::string& re, bool escape = true);
      31                 :            :   ~stapdfa ();
      32                 :            :   void emit_declaration (translator_output *o);
      33                 :            :   void emit_matchop_start (translator_output *o);
      34                 :            :   void emit_matchop_end (translator_output *o);
      35                 :            :   void print (std::ostream& o) const;
      36                 :            : private:
      37                 :            :   re2c::RegExp *prepare_rule(re2c::RegExp *raw);
      38                 :            :   std::string func_name;
      39                 :            :   re2c::RegExp *ast;
      40                 :            :   re2c::DFA *content;
      41                 :            :   static re2c::RegExp *failRE; // hacky thing to attach {return 0;} to
      42                 :            :   static re2c::RegExp *padRE; // hacky thing to pad the output on the left
      43                 :            :   // TODOXXX I hope RegExp instances are really reusable!
      44                 :            : };
      45                 :            : 
      46                 :            : std::ostream& operator << (std::ostream &o, const stapdfa& d);
      47                 :            : 
      48                 :            : struct dfa_parse_error: public std::runtime_error
      49                 :            : {
      50                 :            :   const std::string orig_input;
      51                 :            :   unsigned pos;
      52                 :            :   dfa_parse_error (const std::string& msg, const std::string& orig_input):
      53                 :            :     runtime_error(msg), orig_input(orig_input), pos(0) {}
      54                 :          0 :   dfa_parse_error (const std::string& msg, const std::string& orig_input,
      55                 :            :                    unsigned pos):
      56         [ #  # ]:          0 :     runtime_error(msg), orig_input(orig_input), pos(pos) {}
      57 [ #  # ][ #  # ]:          0 :   ~dfa_parse_error () throw () {}
                 [ #  # ]
      58                 :            : };
      59                 :            : 
      60                 :            : /* Retrieves the corresponding dfa from s->dfas if it is already created: */
      61                 :            : stapdfa *regex_to_stapdfa (systemtap_session *s, const std::string& input, unsigned& counter);
      62                 :            : 
      63                 :            : #endif
      64                 :            : 
      65                 :            : /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */

Generated by: LCOV version 1.9