Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

void RegExpCompiler::Esp (  )  [private]

RDP function

Definition at line 321 of file RegExpCompiler.C.

References alphabet, consume(), error(), Transducer::getInitial(), Transducer::insertNewSingleTransduction(), Transducer::insertTransducer(), isReserved(), Transducer::joinFinals(), Lista(), Transducer::oneOrMore(), Transducer::optional(), postop, Postop(), Transducer::setFinal(), state, token, transducer, and Transducer::zeroOrMore().

Referenced by Term().

{
  Transducer t;
  if(!isReserved(token) || token == '\\' || token == ']')
  {
    Lista();
    consume(']');
    Postop();

    for(set<int>::iterator it = brackets.begin(); 
        it != brackets.end(); it++)
    {
      int mystate = t.getInitial();
      mystate = t.insertNewSingleTransduction(alphabet("", ""), mystate);
      mystate = t.insertNewSingleTransduction(alphabet(*it, *it), mystate);
      t.setFinal(mystate);
    }

    t.joinFinals(alphabet("", ""));
  }
  else if(token == '^')
  {
    consume('^');
    Lista();
    consume(']');
    Postop();
   
    for(int i = 0; i < 256 ;i++)
    {
      if(brackets.find(i) == brackets.end())
      {
        int mystate = t.getInitial();
        mystate = t.insertNewSingleTransduction(alphabet("", ""), mystate);
        mystate = t.insertNewSingleTransduction(alphabet(i, i), mystate);
      t.setFinal(mystate);
      }
    }
    
    t.joinFinals(alphabet("", ""));
  }
  else
  {
    error();
  }

  if(postop == "+")
  {
    t.oneOrMore(alphabet("", ""));     
  }
  else if(postop == "*")
  {
    t.zeroOrMore(alphabet("", ""));
  }
  else if(postop == "?")
  {
    t.optional(alphabet("", ""));
  }
  brackets.clear();
  postop = "";

  state = transducer.insertTransducer(state, t, alphabet("", ""));
}


Generated by  Doxygen 1.6.0   Back to index