Changeset 557

Show
Ignore:
Timestamp:
06/21/08 04:20:51 (5 months ago)
Author:
moenicke
Message:

* using std::string now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rphp/compiler/parser/php.g

    r555 r557  
    2323[: 
    2424 
    25 #include <QtCore/QString> 
    26 #include <kdebug.h> 
    27  
    28 namespace Php 
     25namespace RPHP 
    2926{ 
    3027    class Lexer; 
     
    5451   * and any parse*() method can be called. 
    5552   */ 
    56   void tokenize( const QString& contents ); 
     53  void tokenize( const std::string& contents ); 
    5754 
    5855  enum ProblemType { 
     
    6158      Info 
    6259  }; 
    63   void reportProblem( Parser::ProblemType type, const QString& message ); 
    64   QString tokenText(qint64 begin, qint64 end); 
     60  void reportProblem( Parser::ProblemType type, const std::string& message ); 
     61  std::string tokenText(qint64 begin, qint64 end); 
    6562  void setDebug(bool debug); 
    6663 
     
    7471        OnlyNewObject 
    7572    }; 
    76     QString m_contents; 
     73    std::string m_contents; 
    7774    bool m_debug; 
    7875 
     
    717714{ 
    718715 
    719 void Parser::tokenize( const QString& contents ) 
     716void Parser::tokenize( const std::string& contents ) 
    720717{ 
    721718    m_contents = contents; 
     
    745742 
    746743 
    747 QString Parser::tokenText(qint64 begin, qint64 end) 
     744std::string Parser::tokenText(qint64 begin, qint64 end) 
    748745{ 
    749746    return m_contents.mid(begin,end-begin+1); 
     
    751748 
    752749 
    753 void Parser::reportProblem( Parser::ProblemType type, const QString& message ) 
     750void Parser::reportProblem( Parser::ProblemType type, const std::string& message ) 
    754751{ 
    755752    if (type == Error) 
     
    763760 
    764761// custom error recovery 
    765 void Parser::expectedToken(int /*expected*/, qint64 /*where*/, const QString& name) 
    766 
    767     reportProblem( Parser::Error, QString("Expected token \"%1\"").arg(name)); 
     762void Parser::expectedToken(int /*expected*/, qint64 /*where*/, const std::string& name) 
     763
     764// TODO port me 
     765//    reportProblem( Parser::Error, QString("Expected token \"%1\"").arg(name)); 
    768766} 
    769767 
    770 void Parser::expectedSymbol(int /*expectedSymbol*/, const QString& name) 
     768void Parser::expectedSymbol(int /*expectedSymbol*/, const std::string& name) 
    771769{ 
    772770    qint64 line; 
     
    774772    qint64 index = tokenStream->index()-1; 
    775773    Token &token = tokenStream->token(index); 
    776     kDebug() << "token starts at:" << token.begin; 
    777     kDebug() << "index is:" << index; 
     774// TODO port me 
     775//    kDebug() << "token starts at:" << token.begin; 
     776//    kDebug() << "index is:" << index; 
    778777    tokenStream->startPosition(index, &line, &col); 
    779     QString tokenValue = tokenText(token.begin, token.end); 
     778    std::string tokenValue = tokenText(token.begin, token.end); 
    780779    reportProblem( Parser::Error, 
    781                    QString("Expected symbol \"%1\" (current token: \"%2\" [%3] at line: %4 col: %5)") 
     780// TODO port me 
     781//                   QString("Expected symbol \"%1\" (current token: \"%2\" [%3] at line: %4 col: %5)") 
    782782                  .arg(name) 
    783783                  .arg(token.kind != 0 ? tokenValue : "EOF") 
  • trunk/rphp/compiler/parser/rphp_ast.h

    r555 r557  
    1010 
    1111 
    12 #include <QtCore/QString> 
    13 #include <kdebug.h> 
    14  
    15 namespace Php 
     12namespace RPHP 
    1613  { 
    1714 
  • trunk/rphp/compiler/parser/rphp_parser.cpp

    r555 r557  
    1111  { 
    1212 
    13   void Parser::tokenize( const QString& contents ) 
     13  void Parser::tokenize( const std::string& contents ) 
    1414  { 
    1515    m_contents =  contents; 
     
    4343 
    4444 
    45   QString Parser::tokenText(qint64 begin,  qint64 end) 
     45  std::string Parser::tokenText(qint64 begin,  qint64 end) 
    4646  { 
    4747    return  m_contents.mid(begin, end - begin + 1); 
     
    4949 
    5050 
    51   void Parser::reportProblem( Parser::ProblemType type,  const QString& message ) 
     51  void Parser::reportProblem( Parser::ProblemType type,  const std::string& message ) 
    5252  { 
    5353    if  (type ==  Error) 
     
    6161 
    6262  // custom error recovery 
    63   void Parser::expectedToken(int /*expected*/,  qint64 /*where*/,  const QString& name) 
     63  void Parser::expectedToken(int /*expected*/,  qint64 /*where*/,  const std::string& name) 
    6464  { 
    65     reportProblem( Parser::Error,  QString("Expected token \"%1\"").arg(name)); 
     65    // TODO port me 
     66    //    reportProblem( Parser::Error, QString("Expected token \"%1\"").arg(name)); 
    6667  } 
    6768 
    68   void Parser::expectedSymbol(int /*expectedSymbol*/,  const QString& name) 
     69  void Parser::expectedSymbol(int /*expectedSymbol*/,  const std::string& name) 
    6970  { 
    7071    qint64 line; 
     
    7273    qint64 index =  tokenStream->index() - 1; 
    7374    Token &token =  tokenStream->token(index); 
    74     kDebug() <<  "token starts at:" <<  token.begin; 
    75     kDebug() <<  "index is:" <<  index; 
     75    // TODO port me 
     76    //    kDebug() << "token starts at:" << token.begin; 
     77    //    kDebug() << "index is:" << index; 
    7678    tokenStream->startPosition(index,  &line,  &col); 
    77     QString tokenValue =  tokenText(token.begin,  token.end); 
     79    std::string tokenValue =  tokenText(token.begin,  token.end); 
    7880    reportProblem( Parser::Error, 
    79                    QString("Expected symbol \"%1\" (current token: \"%2\" [%3] at line: %4 col: %5)") 
     81                   // TODO port me 
     82                   //                   QString("Expected symbol \"%1\" (current token: \"%2\" [%3] at line: %4 col: %5)") 
    8083                   .arg(name) 
    8184                   .arg(token.kind !=  0 ?  tokenValue :  "EOF") 
  • trunk/rphp/compiler/parser/rphp_parser.h

    r555 r557  
    235235       * and any parse*() method can be called. 
    236236       */ 
    237       void tokenize( const QString& contents ); 
     237      void tokenize( const std::string& contents ); 
    238238 
    239239      enum ProblemType { 
     
    242242        Info 
    243243      }; 
    244       void reportProblem( Parser::ProblemType type,  const QString& message ); 
    245       QString tokenText(qint64 begin,  qint64 end); 
     244      void reportProblem( Parser::ProblemType type,  const std::string& message ); 
     245      std::string tokenText(qint64 begin,  qint64 end); 
    246246      void setDebug(bool debug); 
    247247 
     
    254254        OnlyNewObject 
    255255      }; 
    256       QString m_contents; 
     256      std::string m_contents; 
    257257      bool m_debug; 
    258258