Changeset 607

Show
Ignore:
Timestamp:
07/22/08 14:31:43 (4 months ago)
Author:
moenicke
Message:

* replaced some strings in the parser by UnicodeString?, reportProblem will stay std::string based
* regenerated the parser

Files:

Legend:

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

    r604 r607  
    2323[: 
    2424 
     25#include <unistr.h> 
    2526#include <string> 
    2627#include <iostream> 
     
    6061   * and any parse*() method can be called. 
    6162   */ 
    62   void tokenize( const std::string& contents ); 
     63  void tokenize( const UnicodeString& contents ); 
    6364 
    6465  enum ProblemType { 
     
    6869  }; 
    6970  void reportProblem( parser::ProblemType type, const std::string& message ); 
    70   std::string tokenText(rint64 begin, rint64 end); 
     71  UnicodeString tokenText(rint64 begin, rint64 end); 
    7172  void setDebug(bool debug); 
    7273 
     
    8081        OnlyNewObject 
    8182    }; 
    82     std::string m_contents; 
     83    UnicodeString m_contents; 
    8384    bool m_debug; 
    8485 
     
    722723{ 
    723724 
    724 void parser::tokenize( const std::string& contents ) 
     725void parser::tokenize( const UnicodeString& contents ) 
    725726{ 
    726727    m_contents = contents; 
     
    750751 
    751752 
    752 std::string parser::tokenText(rint64 begin, rint64 end) 
     753UnicodeString parser::tokenText(rint64 begin, rint64 end) 
    753754{ 
    754755#ifdef PENDING_THOMAS 
     
    773774void parser::yy_expected_token(int kind, std::size_t token, const char* name) 
    774775{ 
    775 //    reportProblem( parser::Error, QString("Expected token \"%1\"").arg(name)); 
     776    std::string msg = "Expected token "; 
     777    msg += name; 
     778    reportProblem( parser::Error, msg ); 
    776779} 
    777780 
     
    788791    kDebug() << "index is:" << index; 
    789792    token_stream->startPosition(index, &line, &col); 
    790     std::string tokenValue = tokenText(token.begin, token.end); 
     793    UnicodeString tokenValue = tokenText(token.begin, token.end); 
    791794    reportProblem( parser::Error, 
    792795// TODO port me 
  • trunk/rphp/compiler/parser/rphp_ast.h

    r561 r607  
    99 
    1010 
     11#include <unistr.h> 
    1112#include <string> 
    1213#include <iostream> 
  • trunk/rphp/compiler/parser/rphp_parser.cpp

    r603 r607  
    44#include "rphp_parser.h" 
    55 
    6 #include <unistr.h> 
     6 
    77#include "phplexer.h" 
    88 
     
    4242 
    4343 
    44   std::string parser::tokenText(rint64 begin,  rint64 end) 
     44  UnicodeString parser::tokenText(rint64 begin,  rint64 end) 
    4545  { 
    46 #ifdef PENDING_THOMAS 
     46#ifdef PENDING_THOMAS  
    4747    // TODO pending 
    4848    return  m_contents.mid(begin, end - begin + 1); 
    49 #endif 
     49#endif  
    5050    return  ""; 
    5151  } 
     
    6565  void parser::yy_expected_token(int kind,  std::size_t token,  const char* name) 
    6666  { 
    67     //    reportProblem( parser::Error, QString("Expected token \"%1\"").arg(name)); 
     67    std::string msg =  "Expected token "; 
     68    msg +=  name; 
     69    reportProblem( parser::Error,  msg ); 
    6870  } 
    6971 
    7072  void parser::yy_expected_symbol(int kind,  const char* name) 
    7173  { 
    72 #ifdef PEDNING_THOMAS 
     74#ifdef PEDNING_THOMAS  
    7375    // TODO pending 
    7476 
     
    8082    kDebug() <<  "index is:" <<  index; 
    8183    token_stream->startPosition(index,  &line,  &col); 
    82     std::string tokenValue =  tokenText(token.begin,  token.end); 
     84    UnicodeString tokenValue =  tokenText(token.begin,  token.end); 
    8385    reportProblem( parser::Error, 
    8486                   // TODO port me 
  • trunk/rphp/compiler/parser/rphp_parser.h

    r603 r607  
    99#include <kdev-pg-allocator.h> 
    1010#include <kdev-pg-token-stream.h> 
    11 #include <unistr.h> 
    1211 
    1312namespace rphp 
     
    242241      }; 
    243242      void reportProblem( parser::ProblemType type,  const std::string& message ); 
    244       std::string tokenText(rint64 begin,  rint64 end); 
     243      UnicodeString tokenText(rint64 begin,  rint64 end); 
    245244      void setDebug(bool debug); 
    246245