Changeset 616
- Timestamp:
- 07/28/08 11:26:35 (4 months ago)
- Files:
-
- trunk/rphp/compiler/pDriver.cpp (modified) (4 diffs)
- trunk/rphp/compiler/parser/php.g (modified) (3 diffs)
- trunk/rphp/compiler/parser/phplexer.cpp (modified) (25 diffs)
- trunk/rphp/compiler/parser/phplexer.h (modified) (1 diff)
- trunk/rphp/compiler/parser/rphp_ast.h (modified) (3 diffs)
- trunk/rphp/compiler/parser/rphp_default_visitor.cpp (modified) (34 diffs)
- trunk/rphp/compiler/parser/rphp_default_visitor.h (modified) (1 diff)
- trunk/rphp/compiler/parser/rphp_parser.cpp (modified) (4 diffs)
- trunk/rphp/compiler/parser/rphp_parser.h (modified) (7 diffs)
- trunk/rphp/compiler/parser/rphp_visitor.cpp (modified) (1 diff)
- trunk/rphp/compiler/parser/rphp_visitor.h (modified) (1 diff)
- trunk/rphp/frontend/cli/main.cpp (modified) (1 diff)
- trunk/rphp/runtime/include/pHash.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rphp/compiler/pDriver.cpp
r614 r616 6 6 ;; as published by the Free Software Foundation; either version 2 7 7 ;; of the License, or (at your option) any later version. 8 ;; 8 ;; 9 9 ;; This program is distributed in the hope that it will be useful, 10 10 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 11 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 ;; GNU General Public License for more details. 13 ;; 13 ;; 14 14 ;; You should have received a copy of the GNU General Public License 15 15 ;; along with this program; if not, write to the Free Software … … 37 37 * the result of get_token_all (see test-tokenize.php) 38 38 **/ 39 void printToken(int token, const Lexer& lexer, const UnicodeString& content)39 void printToken(int token, const ULexer& lexer, const UnicodeString& content) 40 40 { 41 41 int begin = lexer.tokenBegin(); … … 339 339 } 340 340 } 341 341 342 342 void pDriver::dumpTokens(string fileName) { 343 343 344 344 ifstream inFile; 345 345 346 346 inFile.open(fileName.c_str(), ifstream::in); 347 347 if (!inFile) { … … 357 357 contents += buf; 358 358 } 359 359 360 360 inFile.close(); 361 362 Lexer lexer(0, contents);361 362 ULexer lexer(0, contents); 363 363 int token; 364 while ( (token = lexer.nextTokenKind())) {364 while (token = lexer.nextTokenKind()) { 365 365 printToken(token, lexer, contents); 366 366 } trunk/rphp/compiler/parser/php.g
r609 r616 23 23 [: 24 24 25 #include <uni str.h>25 #include <unicode/unistr.h> 26 26 #include <string> 27 27 #include <iostream> … … 33 33 namespace rphp 34 34 { 35 class Lexer;35 //template <typename StringClass, typename CharClass> class Lexer; 36 36 enum NumericType { 37 37 LongNumber, … … 730 730 { 731 731 m_contents = contents; 732 Lexer lexer( this, contents );732 Lexer<UnicodeString, UChar32> lexer( this, contents ); 733 733 int kind = parser::Token_EOF; 734 734 trunk/rphp/compiler/parser/phplexer.cpp
r614 r616 28 28 #include <iostream> 29 29 #include <string> 30 #include <algorithm> 31 #include <cctype> 30 32 #include "unicode/utypes.h" 31 33 #include "unicode/uchar.h" … … 34 36 // TODO pos and m_curpos the same? 35 37 36 namespace rphp 37 { 38 39 Lexer::Lexer( parser* _parser, const UnicodeString& content ): 38 namespace rphp 39 { 40 41 // generic helpers 42 bool C_isAlNum(char c) { return isalnum(c); } 43 bool C_isDigit(char c) { return isdigit(c); } 44 bool C_isHigh(char c) { return false; } 45 char C_toLower(char c) { return tolower(c); } 46 void S_toLower(std::string& s) { 47 std::transform(s.begin(), s.end(), s.begin(), 48 (int(*)(int)) std::tolower); 49 } 50 51 bool C_isAlNum(UChar32 c) { return u_isalnum(c); } 52 bool C_isDigit(UChar32 c) { return u_isdigit(c); } 53 UChar32 C_toLower(UChar32 c) { return u_tolower(c); } 54 void S_toLower(UnicodeString& s) { s.toLower(); } 55 // 56 57 template <typename StringClass, typename CharClass> 58 Lexer<StringClass, CharClass>::Lexer( parser* _parser, const StringClass& content ): 40 59 m_content( content ), m_parser( _parser ), 41 60 m_curpos( 0 ), m_contentSize( m_content.length() ), … … 46 65 } 47 66 48 int Lexer::state(int deepness) const 67 template <typename StringClass, typename CharClass> 68 int Lexer<StringClass, CharClass>::state(int deepness) const 49 69 { 50 70 … … 52 72 return m_state[ m_state.size() - deepness - 1 ]; 53 73 } 54 void Lexer::printState() 74 75 template <typename StringClass, typename CharClass> 76 void Lexer<StringClass, CharClass>::printState() 55 77 { 56 78 int s = state(); … … 79 101 } 80 102 81 void Lexer::pushState( int state ) 103 template <typename StringClass, typename CharClass> 104 void Lexer<StringClass, CharClass>::pushState( int state ) 82 105 { 83 106 m_state.push_back( state ); … … 85 108 } 86 109 87 void Lexer::popState() 110 template <typename StringClass, typename CharClass> 111 void Lexer<StringClass, CharClass>::popState() 88 112 { 89 113 m_state.pop_back(); … … 91 115 } 92 116 93 int Lexer::nextTokenKind() 117 template <typename StringClass, typename CharClass> 118 int Lexer<StringClass, CharClass>::nextTokenKind() 94 119 { 95 120 int token = parser::Token_INVALID; … … 151 176 m_curpos--; 152 177 } 153 else if (u_isdigit( lookAt( pos ) ) 154 || ( lookAt( pos ) == '.' && u_isdigit( lookAt( pos + 1 ) ) )) 155 { 156 UnicodeString num;bool hasPoint = false; 178 else if (C_isDigit( lookAt( pos ) ) 179 || ( lookAt( pos ) == '.' && C_isDigit( lookAt( pos + 1 ) ) )) 180 { 181 StringClass num; 182 bool hasPoint = false; 157 183 bool hex = false; 158 184 if ( lookAt( pos ) == '0' && ( lookAt( pos + 1 )) == 'x') { … … 162 188 } 163 189 while (m_curpos < m_contentSize && ( 164 u_isdigit( lookAt( pos ) )190 C_isDigit( lookAt( pos ) ) 165 191 || (!hex && !hasPoint && lookAt( pos ) == '.') 166 || (hex && ( u_tolower( lookAt( pos ) ) == 'a' || u_tolower( lookAt( pos ) ) == 'b' ||167 u_tolower( lookAt( pos ) ) == 'c' || u_tolower( lookAt( pos ) ) == 'd' ||168 u_tolower( lookAt( pos ) ) == 'e' || u_tolower( lookAt( pos ) ) == 'f'))))192 || (hex && (C_toLower( lookAt( pos ) ) == 'a' || C_toLower( lookAt( pos ) ) == 'b' || 193 C_toLower( lookAt( pos ) ) == 'c' || C_toLower( lookAt( pos ) ) == 'd' || 194 C_toLower( lookAt( pos ) ) == 'e' || C_toLower( lookAt( pos ) ) == 'f')))) 169 195 { 170 196 if (lookAt( pos ) == '.') hasPoint = true; 171 num.append(lookAt( pos )); 172 pos++; 173 m_curpos++; 174 } 175 if (!hex && u_tolower( lookAt( pos ) ) == 'e' && 176 (u_isdigit( lookAt( pos ) ) || 177 ((lookAt( pos + 1 ) == '-' || lookAt( pos + 1 ) == '+') && u_isdigit( lookAt( pos + 2 ) ) ))) 197 //num.append(lookAt( pos )); 198 num += lookAt( pos ); 199 pos++; 200 m_curpos++; 201 } 202 if (!hex && C_toLower( lookAt( pos ) ) == 'e' && 203 (C_isDigit( lookAt( pos ) ) || 204 ((lookAt( pos + 1 ) == '-' || lookAt( pos + 1 ) == '+') && C_isDigit( lookAt( pos + 2 ) ) ))) 178 205 { 179 206 //exponential number … … 185 212 m_curpos++; 186 213 } 187 while (m_curpos < m_contentSize && ( u_isdigit( lookAt( pos ) ) )) {214 while (m_curpos < m_contentSize && ( C_isDigit( lookAt( pos ) ) )) { 188 215 pos++; 189 216 m_curpos++; … … 247 274 _pos++; 248 275 } 249 UnicodeString name; 250 while (_pos < m_contentSize && u_isalnum( lookAt( pos ) )) 251 { 252 name.append( lookAt( pos ) ); 276 StringClass name; 277 while (_pos < m_contentSize && C_isAlNum( lookAt( pos ) )) 278 { 279 //name.append( lookAt( pos ) ); 280 name += lookAt( pos ); 253 281 pos++; 254 282 _pos++; … … 259 287 _pos++; 260 288 } 261 name = name.toLower(); 289 //name = name.toLower(); 290 S_toLower(name); 262 291 if (lookAt( pos ) == ')') 263 292 { … … 356 385 int _pos = 3; 357 386 while (m_curpos+_pos < m_contentSize && 358 ( u_isalnum( lookAt( pos + _pos ) ) == ' ' || u_isalnum( lookAt( pos + _pos ) ) == '\t'))387 ( C_isAlNum( lookAt( pos + _pos ) ) == ' ' || C_isAlNum( lookAt( pos + _pos ) ) == '\t')) 359 388 { 360 389 _pos++; 361 390 } 362 if ( u_isalnum( lookAt( pos + _pos ) ) || lookAt( pos + _pos ) == '_') //identifier must start with a letter391 if ( C_isAlNum( lookAt( pos + _pos ) ) || lookAt( pos + _pos ) == '_') //identifier must start with a letter 363 392 { 364 m_heredocIdentifier.remove(); 393 //m_heredocIdentifier.remove(); 394 m_heredocIdentifier = ""; 365 395 while (m_curpos+_pos < m_contentSize && 366 ( u_isdigit( lookAt( pos + _pos ) ) || u_isalnum( lookAt( pos + _pos ) ) || lookAt( pos + _pos ) == '_'))396 ( C_isDigit( lookAt( pos + _pos ) ) || C_isAlNum( lookAt( pos + _pos ) ) || lookAt( pos + _pos ) == '_')) 367 397 { 368 m_heredocIdentifier.append( lookAt( pos + _pos ) ); 398 //m_heredocIdentifier.append( lookAt( pos + _pos ) ); 399 m_heredocIdentifier += lookAt( pos + _pos ); 369 400 _pos++; 370 401 } … … 630 661 if (lookAt( pos ) == '$' && !isEscapedWithBackslash(lookAt( pos ), m_curpos+i, m_curpos, pos) 631 662 && (lookAt( pos + 1 ) == '{' 632 || (isValidVariableIdentifier( lookAt( pos + 1 ) ) && ! u_isdigit( lookAt( pos + 1 ) )))) {663 || (isValidVariableIdentifier( lookAt( pos + 1 ) ) && ! C_isDigit( lookAt( pos + 1 ) )))) { 633 664 foundVar = true; 634 665 } … … 677 708 } 678 709 } 679 else if (isValidVariableIdentifier(lookAt( pos )) && ! u_isdigit( lookAt( pos ) ))680 { 681 UnicodeStringname;710 else if (isValidVariableIdentifier(lookAt( pos )) && !C_isDigit( lookAt( pos ) )) 711 { 712 StringClass name; 682 713 while (m_curpos < m_contentSize && (isValidVariableIdentifier(lookAt( pos )))) { 683 name.append(lookAt( pos )); 714 //name.append(lookAt( pos )); 715 name += lookAt( pos ); 684 716 pos++; 685 717 m_curpos++; 686 718 } 687 719 m_curpos--; 688 name = name.toLower(); 720 //name = name.toLower(); 721 S_toLower(name); 689 722 if (name == "echo") { 690 723 token = parser::Token_ECHO; … … 856 889 pos += 2; 857 890 //check if a valid variable follows 858 if ((isValidVariableIdentifier(lookAt( pos )) && ! u_isdigit( lookAt( pos ) )))891 if ((isValidVariableIdentifier(lookAt( pos )) && ! C_isDigit( lookAt( pos ) ))) 859 892 { 860 893 pushState(StringVarname); … … 868 901 } 869 902 else if (state() != StringVariable && lookAt( pos ) == '{' && lookAt( pos + 1 ) == '$' 870 && (isValidVariableIdentifier( lookAt( pos + 2 ) ) && ! u_isdigit( lookAt( pos + 2 ) ) || lookAt( pos + 2 ) == '{'))903 && (isValidVariableIdentifier( lookAt( pos + 2 ) ) && ! C_isDigit( lookAt( pos + 2 ) ) || lookAt( pos + 2 ) == '{')) 871 904 { 872 905 token = parser::Token_CURLY_OPEN; … … 875 908 else if (state() == StringVariable 876 909 && lookAt( pos ) == '-' && lookAt( pos + 1 ) == '>' 877 && isValidVariableIdentifier( lookAt( pos + 2 ) ) && ! u_isdigit( lookAt( pos + 2 ) ))910 && isValidVariableIdentifier( lookAt( pos + 2 ) ) && ! C_isDigit( lookAt( pos + 2 ) )) 878 911 { 879 912 token = parser::Token_OBJECT_OPERATOR; … … 892 925 (lookAt( pos ) == '$' && lookAt( pos + 1 ) == '{' || 893 926 lookAt( pos ) == '{' && lookAt( pos + 1 ) == '$' || 894 lookAt( pos ) == '$' && isValidVariableIdentifier( lookAt( pos + 1 ) ) && ! u_isdigit( lookAt( pos + 1 ) )))927 lookAt( pos ) == '$' && isValidVariableIdentifier( lookAt( pos + 1 ) ) && ! C_isDigit( lookAt( pos + 1 ) ))) 895 928 { 896 929 //variable is next ${var} or {$var} … … 932 965 popState(); 933 966 } 934 else if ( u_isdigit( lookAt( pos ) ))967 else if ( C_isDigit( lookAt( pos ) )) 935 968 { 936 969 token = parser::Token_NUM_STRING; 937 while (m_curpos < m_contentSize && u_isdigit( lookAt( pos ) ))970 while (m_curpos < m_contentSize && C_isDigit( lookAt( pos ) )) 938 971 { 939 972 pos++; … … 1011 1044 } 1012 1045 1013 rint64 Lexer::tokenBegin() const 1046 template <typename StringClass, typename CharClass> 1047 rint64 Lexer<StringClass, CharClass>::tokenBegin() const 1014 1048 { 1015 1049 return m_tokenBegin; 1016 1050 } 1017 1051 1018 rint64 Lexer::tokenEnd() const 1052 template <typename StringClass, typename CharClass> 1053 rint64 Lexer<StringClass, CharClass>::tokenEnd() const 1019 1054 { 1020 1055 return m_tokenEnd; 1021 1056 } 1022 1057 1023 bool Lexer::isHeredocEnd(const UChar32& it, int pos) 1058 template <typename StringClass, typename CharClass> 1059 bool Lexer<StringClass, CharClass>::isHeredocEnd(const CharClass& it, int pos) 1024 1060 { 1025 1061 int identiferLen = m_heredocIdentifier.length(); 1026 UnicodeStringlineStart;1062 StringClass lineStart; 1027 1063 for (int i = 0; i < identiferLen; i++) { 1028 1064 if (m_curpos+i >= m_contentSize) break; 1029 lineStart.append( lookAt( pos + i ) ); 1065 //lineStart.append( lookAt( pos + i ) ); 1066 lineStart += lookAt( pos + i ); 1030 1067 } 1031 1068 if (lineStart == m_heredocIdentifier && … … 1040 1077 1041 1078 //used for strings, to check if " is escaped (\" is, \\" not) 1042 bool Lexer::isEscapedWithBackslash(const UChar32& it, int curPos, int startPos, int pos) 1079 template <typename StringClass, typename CharClass> 1080 bool Lexer<StringClass, CharClass>::isEscapedWithBackslash(const CharClass& it, int curPos, int startPos, int pos) 1043 1081 { 1044 1082 int cnt = 0; … … 1051 1089 } 1052 1090 1053 bool Lexer::processVariable(int pos) 1054 { 1055 UChar32 c2 = lookAt( pos + 1 ); 1056 if ( lookAt( pos ) == '$' && (isValidVariableIdentifier(c2) && ! u_isdigit( c2 ))) 1091 template <typename StringClass, typename CharClass> 1092 bool Lexer<StringClass, CharClass>::processVariable(int pos) 1093 { 1094 CharClass c2 = lookAt( pos + 1 ); 1095 if ( lookAt( pos ) == '$' && (isValidVariableIdentifier(c2) && ! C_isDigit( c2 ))) 1057 1096 { 1058 1097 pos++; … … 1072 1111 } 1073 1112 } 1074 bool Lexer::isValidVariableIdentifier(const UChar32& it) 1113 template <typename StringClass, typename CharClass> 1114 bool Lexer<StringClass, CharClass>::isValidVariableIdentifier(const CharClass& it) 1075 1115 { 1076 1116 // TODO check: it > 0x7f 1077 return u_isalnum( it ) || u_isdigit( it ) || it == '_' || it > 0x7f; 1078 } 1079 1080 void Lexer::createNewline( int pos ) 1117 return C_isAlNum( it ) || C_isDigit( it ) || it == '_' || C_isHigh(it); 1118 } 1119 1120 template <typename StringClass, typename CharClass> 1121 void Lexer<StringClass, CharClass>::createNewline( int pos ) 1081 1122 { 1082 1123 #ifdef PENDING_THOMAS … … 1087 1128 } 1088 1129 1089 } 1090 1130 // implement supported types 1131 template class Lexer<UnicodeString, UChar32>; 1132 template class Lexer<std::string, char>; 1133 1134 } 1135 trunk/rphp/compiler/parser/phplexer.h
r614 r616 24 24 #include "rphp_ast.h" 25 25 #include <vector> 26 #include <unistr.h> 26 #include <string> 27 #include <unicode/unistr.h> 27 28 28 29 namespace rphp 29 30 { 30 31 31 class parser;32 class parser; 32 33 33 /** 34 * Hand-written Lexer that generates the same tokens as php uses. 35 * This includes also a whitespace and comment token. 36 * 37 * For debugging output can be compared to php-tokens using the 38 * test/test-tokenize.php script 39 **/ 40 class Lexer { 41 public: 42 Lexer(parser* _parser, const UnicodeString& contents); 34 /** 35 * Hand-written Lexer that generates the same tokens as php uses. 36 * This includes also a whitespace and comment token. 37 * 38 * For debugging output can be compared to php-tokens using the 39 * test/test-tokenize.php script 40 **/ 41 template <typename StringClass, typename CharClass> 42 class Lexer { 43 public: 44 Lexer(parser* _parser, const StringClass& contents); 43 45 44 int nextTokenKind();45 rint64 tokenBegin() const;46 rint64 tokenEnd() const;46 int nextTokenKind(); 47 rint64 tokenBegin() const; 48 rint64 tokenEnd() const; 47 49 48 private:49 UnicodeStringm_content;50 parser* m_parser;51 int m_curpos;52 int m_contentSize;53 rint64 m_tokenBegin;54 rint64 m_tokenEnd;50 private: 51 StringClass m_content; 52 parser* m_parser; 53 int m_curpos; 54 int m_contentSize; 55 rint64 m_tokenBegin; 56 rint64 m_tokenEnd; 55 57 56 int state(int deepness = 0) const;57 void pushState(int state);58 void popState();59 void printState();58 int state(int deepness = 0) const; 59 void pushState(int state); 60 void popState(); 61 void printState(); 60 62 61 bool processVariable(int pos);62 bool isValidVariableIdentifier(const UChar32& it);63 void createNewline( int pos );64 bool isEscapedWithBackslash(const UChar32& it, int curPos, int startPos, int pos);65 bool isHeredocEnd(const UChar32& it, int pos);63 bool processVariable(int pos); 64 bool isValidVariableIdentifier(const CharClass& it); 65 void createNewline( int pos ); 66 bool isEscapedWithBackslash(const CharClass& it, int curPos, int startPos, int pos); 67 bool isHeredocEnd(const CharClass& it, int pos); 66 68 67 UChar32 lookAt( int pos ){ return m_content.char32At( pos ); } 69 CharClass inline lookAt( int pos ){ 70 return m_content[pos]; 71 } 68 72 69 std::vector<int> m_state; // was: QStack<int> 70 enum State 71 { 72 ErrorState = -1, 73 HtmlState = 0, 74 DefaultState = 1, 75 String = 2, 76 StringVariable = 3, 77 StringVariableBracket = 4, 78 StringVariableObjectOperator = 5, 79 StringVariableCurly = 6, 80 StringVarname = 7, 81 StringHeredoc = 8, 82 StringBacktick = 9 83 }; 84 UnicodeString m_heredocIdentifier; 85 int m_haltCompiler; 86 }; 73 std::vector<int> m_state; // was: QStack<int> 74 enum State 75 { 76 ErrorState = -1, 77 HtmlState = 0, 78 DefaultState = 1, 79 String = 2, 80 StringVariable = 3, 81 StringVariableBracket = 4, 82 StringVariableObjectOperator = 5, 83 StringVariableCurly = 6, 84 StringVarname = 7, 85 StringHeredoc = 8, 86 StringBacktick = 9 87 }; 88 StringClass m_heredocIdentifier; 89 int m_haltCompiler; 90 }; 91 92 // define the two lexers we support: Unicode and std::string based 93 typedef Lexer<UnicodeString, UChar32> ULexer; 94 typedef Lexer<std::string, char> BLexer; 87 95 88 96 } trunk/rphp/compiler/parser/rphp_ast.h
r609 r616 9 9 10 10 11 #include <uni str.h>11 #include <unicode/unistr.h> 12 12 #include <string> 13 13 #include <iostream> … … 19 19 namespace rphp 20 20 { 21 22 class Lexer; 21 //template <typename StringClass, typename CharClass> class Lexer; 23 22 enum NumericType { 24 23 LongNumber, … … 39 38 40 39 struct additiveExpression_ast; 41 42 40 struct additiveExpressionRest_ast; 43 44 41 struct arrayPairValue_ast; 45 46 42 struct assignmentExpression_ast; 47 48 43 struct assignmentExpressionCheckIfVariable_ast; 49 50 44 struct assignmentExpressionEqual_ast; 51 52 45 struct assignmentList_ast; 53 54 46 struct assignmentListElement_ast; 55 56 47 struct baseVariable_ast; 57 58 48 struct baseVariableWithFunctionCalls_ast; 59 60 49 struct bitAndExpression_ast; 61 62 50 struct bitOrExpression_ast; 63 64 51 struct bitXorExpression_ast; 65 66 52 struct booleanAndExpression_ast; 67 68 53 struct booleanOrExpression_ast; 69 70 54 struct caseList_ast; 71 72 55 struct case_item_ast; 73 74 56 struct catch_item_ast; 75 76 57 struct classConstantDeclaration_ast; 77 78 58 struct classDeclarationStatement_ast; 79 80 59 struct classNameReference_ast; 81 82 60 struct classStatement_ast; 83 84 61 struct classVariable_ast; 85 86 62 struct classVariableDeclaration_ast; 87 88 63 struct commonScalar_ast; 89 90 64 struct compoundVariable_ast; 91 92 65 struct compoundVariableWithSimpleIndirectReference_ast; 93 94 66 struct conditionalExpression_ast; 95 96 67 struct ctorArguments_ast; 97 98 68 struct declareItem_ast; 99 100 69 struct declareStatement_ast; 101 102 70 struct dimListItem_ast; 103 104 71 struct dimOffset_ast; 105 106 72 struct dynamicClassNameReference_ast; 107 108 73 struct dynamicClassNameVariableProperties_ast; 109 110 74 struct dynamicClassNameVariableProperty_ast; 111 112 75 struct elseSingle_ast; 113 114 76 struct elseifList_ast; 115 116 77 struct elseifListItem_ast; 117 118 78 struct encaps_ast; 119 120 79 struct encapsList_ast; 121 122 80 struct encapsVar_ast; 123 124 81 struct encapsVarOffset_ast; 125 126 82 struct equalityExpression_ast; 127 128 83 struct equalityExpressionRest_ast; 129 130 84 struct expr_ast; 131 132 85 struct forExpr_ast; 133 134 86 struct forStatement_ast; 135 136 87 struct foreachOptionalArg_ast; 137 138 88 struct foreachStatement_ast; 139 140 89 struct foreachVariable_ast; 141 142 90 struct functionCall_ast; 143 144 91 struct functionCallParameterList_ast; 145 146 92 struct functionCallParameterListElement_ast; 147 148 93 struct functionDeclarationStatement_ast; 149 150 94 struct globalVar_ast; 151 152 95 struct innerStatementList_ast; 153 154 96 struct logicalAndExpression_ast; 155 156 97 struct logicalOrExpression_ast; 157 158 98 struct logicalXorExpression_ast; 159 160 99 struct memberModifier_ast; 161 162 100 struct methodBody_ast; 163 164 101 struct multiplicativeExpression_ast; 165 166 102 struct multiplicativeExpression_rest_ast; 167 168 103 struct newElseSingle_ast; 169 170 104 struct newElseifList_ast; 171 172 105 struct newelseifListItem_ast; 173 174 106 struct objectDimList_ast; 175 176 107 struct objectProperty_ast; 177 178 108 struct parameter_ast; 179 180 109 struct parameterList_ast; 181 182 110 struct postprefixOperator_ast; 183 184 111 struct printExpression_ast; 185 186 112 struct relationalExpression_ast; 187 188 113 struct relationalExpressionRest_ast; 189 190 114 struct scalar_ast; 191 192 115 struct semicolonOrCloseTag_ast; 193 194 116 struct shiftExpression_ast; 195 196 117 struct shiftExpressionRest_ast; 197 198 118 struct start_ast; 199 200 119 struct statement_ast; 201 202 120 struct staticArrayPairValue_ast; 203 204 121 struct staticMember_ast; 205 206 122 struct staticScalar_ast; 207 208 123 struct staticVar_ast; 209 210 124 struct switchCaseList_ast; 211 212 125 struct topStatement_ast; 213 214 126 struct unaryExpression_ast; 215 216 127 struct unaryExpression_not_plusminus_ast; 217 218 128 struct varExpression_ast; 219 220 129 struct varExpressionNewObject_ast; 221 222 130 struct varExpressionNormal_ast; 223 224 131 struct variable_ast; 225 226 132 struct variableName_ast; 227 228 133 struct variableProperty_ast; 229 230 134 struct variableWithoutObjects_ast; 231 232 135 struct whileStatement_ast; 233 136 trunk/rphp/compiler/parser/rphp_default_visitor.cpp
r555 r616 10 10 { 11 11 visit_node(node->expression); 12 13 if (node->additionalExpression_sequence) 14 { 15 const list_node<additiveExpressionRest_ast*> *__it = node->additionalExpression_sequence->to_front(), *__end = __it; 16 17 do 18 { 19 visit_node(__it->element); 20 __it = __it->next; 21 } 22 23 while (__it != __end); 12 if (node->additionalExpression_sequence) 13 { 14 const list_node<additiveExpressionRest_ast*> *__it = node->additionalExpression_sequence->to_front(), *__end = __it; 15 do 16 { 17 visit_node(__it->element); 18 __it = __it->next; 19 } 20 while (__it != __end); 24 21 } 25 22 } … … 55 52 void default_visitor::visit_assignmentList(assignmentList_ast *node) 56 53 { 57 if (node->element_sequence) 58 { 59 const list_node<assignmentListElement_ast*> *__it = node->element_sequence->to_front(), *__end = __it; 60 61 do 62 { 63 visit_node(__it->element); 64 __it = __it->next; 65 } 66 67 while (__it != __end); 54 if (node->element_sequence) 55 { 56 const list_node<assignmentListElement_ast*> *__it = node->element_sequence->to_front(), *__end = __it; 57 do 58 { 59 visit_node(__it->element); 60 __it = __it->next; 61 } 62 while (__it != __end); 68 63 } 69 64 } … … 78 73 { 79 74 visit_node(node->var); 80 81 if (node->offsetItems_sequence) 82 { 83 const list_node<dimListItem_ast*> *__it = node->offsetItems_sequence->to_front(), *__end = __it; 84 85 do 86 { 87 visit_node(__it->element); 88 __it = __it->next; 89 } 90 91 while (__it != __end); 92 } 93 75 if (node->offsetItems_sequence) 76 { 77 const list_node<dimListItem_ast*> *__it = node->offsetItems_sequence->to_front(), *__end = __it; 78 do 79 { 80 visit_node(__it->element); 81 __it = __it->next; 82 } 83 while (__it != __end); 84 } 94 85 visit_node(node->staticMember); 95 86 } … … 103 94 void default_visitor::visit_bitAndExpression(bitAndExpression_ast *node) 104 95 { 105 if (node->expression_sequence) 106 { 107 const list_node<equalityExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 108 109 do 110 { 111 visit_node(__it->element); 112 __it = __it->next; 113 } 114 115 while (__it != __end); 96 if (node->expression_sequence) 97 { 98 const list_node<equalityExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 99 do 100 { 101 visit_node(__it->element); 102 __it = __it->next; 103 } 104 while (__it != __end); 116 105 } 117 106 } … … 119 108 void default_visitor::visit_bitOrExpression(bitOrExpression_ast *node) 120 109 { 121 if (node->expression_sequence) 122 { 123 const list_node<bitXorExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 124 125 do 126 { 127 visit_node(__it->element); 128 __it = __it->next; 129 } 130 131 while (__it != __end); 110 if (node->expression_sequence) 111 { 112 const list_node<bitXorExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 113 do 114 { 115 visit_node(__it->element); 116 __it = __it->next; 117 } 118 while (__it != __end); 132 119 } 133 120 } … … 135 122 void default_visitor::visit_bitXorExpression(bitXorExpression_ast *node) 136 123 { 137 if (node->expression_sequence) 138 { 139 const list_node<bitAndExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 140 141 do 142 { 143 visit_node(__it->element); 144 __it = __it->next; 145 } 146 147 while (__it != __end); 124 if (node->expression_sequence) 125 { 126 const list_node<bitAndExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 127 do 128 { 129 visit_node(__it->element); 130 __it = __it->next; 131 } 132 while (__it != __end); 148 133 } 149 134 } … … 151 136 void default_visitor::visit_booleanAndExpression(booleanAndExpression_ast *node) 152 137 { 153 if (node->expression_sequence) 154 { 155 const list_node<bitOrExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 156 157 do 158 { 159 visit_node(__it->element); 160 __it = __it->next; 161 } 162 163 while (__it != __end); 138 if (node->expression_sequence) 139 { 140 const list_node<bitOrExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 141 do 142 { 143 visit_node(__it->element); 144 __it = __it->next; 145 } 146 while (__it != __end); 164 147 } 165 148 } … … 167 150 void default_visitor::visit_booleanOrExpression(booleanOrExpression_ast *node) 168 151 { 169 if (node->expression_sequence) 170 { 171 const list_node<booleanAndExpression_ast*> *__it = node->expression_sequence->to_front(), *__end = __it; 172 173 do 174 { 175 visit_node(__it->element); 176 __it = __it->next; 177 } 178 179 while (__it != __end);
