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

void RegExpCompiler::Term (  )  [private]

RDP function

Definition at line 189 of file RegExpCompiler.C.

References alphabet, Transducer::clear(), consume(), error(), Esp(), Transducer::getInitial(), Transducer::insertNewSingleTransduction(), Transducer::insertTransducer(), isReserved(), Letra(), letter, Transducer::oneOrMore(), Transducer::optional(), postop, Postop(), S(), Transducer::setFinal(), state, token, transducer, and Transducer::zeroOrMore().

Referenced by RExpr(), and RExprp().

{
  if(!isReserved(token) || token == '\\')
  {
    Transducer t;
    int e = t.getInitial();
    Letra();
    e = t.insertNewSingleTransduction(alphabet(letter, letter), e);
    t.setFinal(e);
    Postop();
    if(postop == "*")
    {
      t.zeroOrMore(alphabet("", ""));
    }
    else if(postop == "+")
    {
      t.oneOrMore(alphabet("", ""));
    }
    else if(postop == "?")
    {
      t.optional(alphabet("", ""));
    }

    postop = "";
    state = transducer.insertTransducer(state, t, alphabet("", ""));
  }
  else if(token == '(')
  {
    Transducer t = transducer;
    int e = state;
    transducer.clear();
    state = transducer.getInitial();
    consume('(');
    S();
    consume(')');
    transducer.setFinal(state);
    Postop();
    if(postop == "*")
    {
      transducer.zeroOrMore(alphabet("", ""));
    }
    else if(postop == "+")
    {
      transducer.oneOrMore(alphabet("", ""));
    }
    else if(postop == "?")
    {
      transducer.optional(alphabet("", ""));
    }

    postop = "";
    state = t.insertTransducer(e, transducer, alphabet("", ""));
    transducer = t;
  }
  else if(token == '[')
  {
    consume('[');
    Esp();
  }
  else
  {
    error();
  }
}


Generated by  Doxygen 1.6.0   Back to index