Changeset 607
- Timestamp:
- 07/22/08 14:31:43 (4 months ago)
- Files:
-
- trunk/rphp/compiler/parser/php.g (modified) (8 diffs)
- trunk/rphp/compiler/parser/rphp_ast.h (modified) (1 diff)
- trunk/rphp/compiler/parser/rphp_parser.cpp (modified) (4 diffs)
- trunk/rphp/compiler/parser/rphp_parser.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rphp/compiler/parser/php.g
r604 r607 23 23 [: 24 24 25 #include <unistr.h> 25 26 #include <string> 26 27 #include <iostream> … … 60 61 * and any parse*() method can be called. 61 62 */ 62 void tokenize( const std::string& contents );63 void tokenize( const UnicodeString& contents ); 63 64 64 65 enum ProblemType { … … 68 69 }; 69 70 void reportProblem( parser::ProblemType type, const std::string& message ); 70 std::string tokenText(rint64 begin, rint64 end);71 UnicodeString tokenText(rint64 begin, rint64 end); 71 72 void setDebug(bool debug); 72 73 … … 80 81 OnlyNewObject 81 82 }; 82 std::string m_contents;83 UnicodeString m_contents; 83 84 bool m_debug; 84 85 … … 722 723 { 723 724 724 void parser::tokenize( const std::string& contents )725 void parser::tokenize( const UnicodeString& contents ) 725 726 { 726 727 m_contents = contents; … … 750 751 751 752 752 std::string parser::tokenText(rint64 begin, rint64 end)753 UnicodeString parser::tokenText(rint64 begin, rint64 end) 753 754 { 754 755 #ifdef PENDING_THOMAS … … 773 774 void parser::yy_expected_token(int kind, std::size_t token, const char* name) 774 775 { 775 // reportProblem( parser::Error, QString("Expected token \"%1\"").arg(name)); 776 std::string msg = "Expected token "; 777 msg += name; 778 reportProblem( parser::Error, msg ); 776 779 } 777 780 … … 788 791 kDebug() << "index is:" << index; 789 792 token_stream->startPosition(index, &line, &col); 790 std::string tokenValue = tokenText(token.begin, token.end);793 UnicodeString tokenValue = tokenText(token.begin, token.end); 791 794 reportProblem( parser::Error, 792 795 // TODO port me trunk/rphp/compiler/parser/rphp_ast.h
r561 r607 9 9 10 10 11 #include <unistr.h> 11 12 #include <string> 12 13 #include <iostream> trunk/rphp/compiler/parser/rphp_parser.cpp
r603 r607 4 4 #include "rphp_parser.h" 5 5 6 #include <unistr.h> 6 7 7 #include "phplexer.h" 8 8 … … 42 42 43 43 44 std::string parser::tokenText(rint64 begin, rint64 end)44 UnicodeString parser::tokenText(rint64 begin, rint64 end) 45 45 { 46 #ifdef PENDING_THOMAS 46 #ifdef PENDING_THOMAS 47 47 // TODO pending 48 48 return m_contents.mid(begin, end - begin + 1); 49 #endif 49 #endif 50 50 return ""; 51 51 } … … 65 65 void parser::yy_expected_token(int kind, std::size_t token, const char* name) 66 66 { 67 // reportProblem( parser::Error, QString("Expected token \"%1\"").arg(name)); 67 std::string msg = "Expected token "; 68 msg += name; 69 reportProblem( parser::Error, msg ); 68 70 } 69 71 70 72 void parser::yy_expected_symbol(int kind, const char* name) 71 73 { 72 #ifdef PEDNING_THOMAS 74 #ifdef PEDNING_THOMAS 73 75 // TODO pending 74 76 … … 80 82 kDebug() << "index is:" << index; 81 83 token_stream->startPosition(index, &line, &col); 82 std::string tokenValue = tokenText(token.begin, token.end);84 UnicodeString tokenValue = tokenText(token.begin, token.end); 83 85 reportProblem( parser::Error, 84 86 // TODO port me trunk/rphp/compiler/parser/rphp_parser.h
r603 r607 9 9 #include <kdev-pg-allocator.h> 10 10 #include <kdev-pg-token-stream.h> 11 #include <unistr.h>12 11 13 12 namespace rphp … … 242 241 }; 243 242 void reportProblem( parser::ProblemType type, const std::string& message ); 244 std::string tokenText(rint64 begin, rint64 end);243 UnicodeString tokenText(rint64 begin, rint64 end); 245 244 void setDebug(bool debug); 246 245
