File: stapregex.h

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (63 lines) | stat: -rw-r--r-- 1,796 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*- C++ -*-
// Copyright (C) 2012-2013 Red Hat Inc.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
//
// ---
//
// This file incorporates code from the re2c project; please see
// the file README.stapregex for details.

#ifndef STAPREGEX_H
#define STAPREGEX_H

#include <string>
#include <iostream>

#include "stapregex-defines.h"

struct systemtap_session; /* from session.h */
struct token; /* from parse.h */
class translator_output; /* from translator-output.h */

namespace stapregex {
  struct regexp; /* from stapregex-tree.h */
  struct dfa; /* from stapregex-dfa.h */
};

struct stapdfa {
  std::string func_name;
  std::string orig_input;
  const token *tok;

  stapdfa (const std::string& func_name, const std::string& re,
           const token *tok = NULL, bool do_unescape = true, bool do_tag = true);
  ~stapdfa ();
  unsigned num_states() const;
  unsigned num_map_items() const;
  unsigned num_tags() const;

  void emit_declaration (translator_output *o) const;
  void emit_matchop_start (translator_output *o) const;
  void emit_matchop_end (translator_output *o) const;

  void print(translator_output *o) const;
  void print(std::ostream& o) const;
private:
  stapregex::regexp *ast;
  stapregex::dfa *content;
  bool do_tag;
};

std::ostream& operator << (std::ostream &o, const stapdfa& d);

/* Creates a dfa if no dfa for the corresponding regex exists yet;
   retrieves the corresponding dfa from s->dfas if already there: */
stapdfa *regex_to_stapdfa (systemtap_session *s, const std::string& input, const token* tok);

#endif

/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */