src
Public Member Functions | Public Attributes | List of all members
re2c::RuleOp Class Reference

#include <regexp_rule.h>

Inheritance diagram for re2c::RuleOp:
Inheritance graph
[legend]
Collaboration diagram for re2c::RuleOp:
Collaboration graph
[legend]

Public Member Functions

 RuleOp (const Loc &l, RegExp *r1, RegExp *r2, rule_rank_t r, const Code *c, const std::string *cond)
 
void display (std::ostream &o) const
 
void split (std::set< uint32_t > &)
 
uint32_t calc_size () const
 
nfa_state_tcompile (nfa_t &nfa, nfa_state_t *n)
 
 FORBID_COPY (RuleOp)
 
- Public Member Functions inherited from re2c::RegExp
 RegExp ()
 
virtual ~RegExp ()
 
virtual uint32_t fixedLength ()
 
 FORBID_COPY (RegExp)
 

Public Attributes

const Loc loc
 
RegExpctx
 
rule_rank_t rank
 
const Codecode
 
const std::string newcond
 

Additional Inherited Members

- Static Public Attributes inherited from re2c::RegExp
static free_list< RegExp * > vFreeList
 

Detailed Description

Definition at line 13 of file regexp_rule.h.

Constructor & Destructor Documentation

re2c::RuleOp::RuleOp ( const Loc l,
RegExp r1,
RegExp r2,
rule_rank_t  r,
const Code c,
const std::string *  cond 
)
inline

Definition at line 28 of file regexp_rule.h.

35  : loc (l)
36  , exp (r1)
37  , ctx (r2)
38  , rank (r)
39  , code (c)
40  , newcond (cond ? *cond : "")
41  {}
const std::string newcond
Definition: regexp_rule.h:25
const Code * code
Definition: regexp_rule.h:24
RegExp * ctx
Definition: regexp_rule.h:22
rule_rank_t rank
Definition: regexp_rule.h:23
const Loc loc
Definition: regexp_rule.h:16

Member Function Documentation

uint32_t re2c::RuleOp::calc_size ( ) const
virtual

Implements re2c::RegExp.

Definition at line 42 of file calc_size.cc.

43 {
44  const uint32_t n = ctx->calc_size();
45  return exp->calc_size()
46  + (n > 0 ? n + 1 : 0)
47  + 1;
48 }
RegExp * ctx
Definition: regexp_rule.h:22
virtual uint32_t calc_size() const =0

Here is the call graph for this function:

nfa_state_t * re2c::RuleOp::compile ( nfa_t nfa,
nfa_state_t n 
)
virtual

Implements re2c::RegExp.

Definition at line 58 of file nfa.cc.

59 {
60  nfa_state_t *s3 = &nfa.states[nfa.size++];
61  s3->fin(this);
62  if (ctx->calc_size() > 0)
63  {
64  nfa_state_t *s2 = &nfa.states[nfa.size++];
65  s2->ctx(ctx->compile(nfa, s3));
66  s3 = s2;
67  }
68  nfa_state_t *s1 = exp->compile(nfa, s3);
69  return s1;
70 }
virtual nfa_state_t * compile(nfa_t &nfa, nfa_state_t *n)=0
RegExp * ctx
Definition: regexp_rule.h:22
virtual uint32_t calc_size() const =0

Here is the call graph for this function:

void re2c::RuleOp::display ( std::ostream &  o) const
virtual

Implements re2c::RegExp.

Definition at line 45 of file display.cc.

46 {
47  o << exp << "/" << ctx << ";";
48 }
RegExp * ctx
Definition: regexp_rule.h:22
re2c::RuleOp::FORBID_COPY ( RuleOp  )
void re2c::RuleOp::split ( std::set< uint32_t > &  cs)
virtual

Implements re2c::RegExp.

Definition at line 43 of file split.cc.

44 {
45  exp->split (cs);
46  ctx->split (cs);
47 }
virtual void split(std::set< uint32_t > &)=0
RegExp * ctx
Definition: regexp_rule.h:22

Here is the call graph for this function:

Member Data Documentation

const Code* re2c::RuleOp::code

Definition at line 24 of file regexp_rule.h.

RegExp* re2c::RuleOp::ctx

Definition at line 22 of file regexp_rule.h.

const Loc re2c::RuleOp::loc

Definition at line 16 of file regexp_rule.h.

const std::string re2c::RuleOp::newcond

Definition at line 25 of file regexp_rule.h.

rule_rank_t re2c::RuleOp::rank

Definition at line 23 of file regexp_rule.h.


The documentation for this class was generated from the following files: