Changeset 45 for branches/DelphiToC
- Timestamp:
- Aug 9, 2010, 10:34:09 AM (14 years ago)
- Location:
- branches/DelphiToC
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/Analyze/UPascalParser.pas
r44 r45 10 10 11 11 type 12 EEndOfData = class(Exception);13 14 TBaseParser = class;15 16 12 TOnErrorMessage = procedure (Text: string) of object; 17 13 … … 543 539 begin 544 540 with SourceCode do begin 545 ParseModule(TModule(Modules[0])); 541 for I := 0 to Modules.Count - 1 do 542 ParseModule(TModule(Modules[I])); 546 543 end; 547 544 end; -
branches/DelphiToC/DelphiToC.lpi
r44 r45 77 77 <EditorIndex Value="5"/> 78 78 <WindowIndex Value="0"/> 79 <TopLine Value="2 94"/>80 <CursorPos X=" 25" Y="296"/>79 <TopLine Value="268"/> 80 <CursorPos X="14" Y="251"/> 81 81 <UsageCount Value="103"/> 82 82 <Loaded Value="True"/> … … 88 88 <EditorIndex Value="10"/> 89 89 <WindowIndex Value="0"/> 90 <TopLine Value=" 25"/>91 <CursorPos X="1 " Y="38"/>90 <TopLine Value="36"/> 91 <CursorPos X="16" Y="40"/> 92 92 <UsageCount Value="103"/> 93 93 <Loaded Value="True"/> … … 133 133 <EditorIndex Value="0"/> 134 134 <WindowIndex Value="0"/> 135 <TopLine Value="5 40"/>136 <CursorPos X=" 3" Y="544"/>135 <TopLine Value="528"/> 136 <CursorPos X="1" Y="541"/> 137 137 <UsageCount Value="103"/> 138 138 <Loaded Value="True"/> … … 143 143 <TopLine Value="1"/> 144 144 <CursorPos X="1" Y="1"/> 145 <UsageCount Value=" 2"/>145 <UsageCount Value="1"/> 146 146 <DefaultSyntaxHighlighter Value="LFM"/> 147 147 </Unit9> … … 153 153 <TopLine Value="68"/> 154 154 <CursorPos X="14" Y="90"/> 155 <UsageCount Value="5 1"/>155 <UsageCount Value="52"/> 156 156 <Loaded Value="True"/> 157 157 </Unit10> … … 162 162 <TopLine Value="1555"/> 163 163 <CursorPos X="1" Y="1"/> 164 <UsageCount Value=" 6"/>164 <UsageCount Value="5"/> 165 165 </Unit11> 166 166 <Unit12> … … 170 170 <TopLine Value="61"/> 171 171 <CursorPos X="7" Y="68"/> 172 <UsageCount Value="3 4"/>172 <UsageCount Value="35"/> 173 173 <Loaded Value="True"/> 174 174 </Unit12> … … 179 179 <TopLine Value="139"/> 180 180 <CursorPos X="16" Y="146"/> 181 <UsageCount Value="3 4"/>181 <UsageCount Value="35"/> 182 182 <Loaded Value="True"/> 183 183 </Unit13> … … 187 187 <TopLine Value="934"/> 188 188 <CursorPos X="10" Y="947"/> 189 <UsageCount Value=" 10"/>189 <UsageCount Value="9"/> 190 190 </Unit14> 191 191 <Unit15> … … 194 194 <TopLine Value="834"/> 195 195 <CursorPos X="11" Y="847"/> 196 <UsageCount Value=" 6"/>196 <UsageCount Value="5"/> 197 197 </Unit15> 198 198 <Unit16> … … 201 201 <TopLine Value="153"/> 202 202 <CursorPos X="8" Y="166"/> 203 <UsageCount Value=" 9"/>203 <UsageCount Value="8"/> 204 204 </Unit16> 205 205 <Unit17> … … 209 209 <EditorIndex Value="2"/> 210 210 <WindowIndex Value="0"/> 211 <TopLine Value="1 98"/>212 <CursorPos X="1" Y="2 15"/>211 <TopLine Value="189"/> 212 <CursorPos X="1" Y="202"/> 213 213 <UsageCount Value="65"/> 214 214 <Loaded Value="True"/> … … 220 220 <TopLine Value="2656"/> 221 221 <CursorPos X="3" Y="2669"/> 222 <UsageCount Value=" 6"/>222 <UsageCount Value="5"/> 223 223 </Unit18> 224 224 </Units> 225 225 <JumpHistory Count="30" HistoryIndex="29"> 226 226 <Position1> 227 <Filename Value=" Visual\USourceTree.pas"/>228 <Caret Line=" 228" Column="1" TopLine="220"/>227 <Filename Value="Analyze\UPascalParser.pas"/> 228 <Caret Line="554" Column="1" TopLine="539"/> 229 229 </Position1> 230 230 <Position2> 231 <Filename Value=" Visual\USourceTree.pas"/>232 <Caret Line=" 211" Column="22" TopLine="198"/>231 <Filename Value="Analyze\UPascalParser.pas"/> 232 <Caret Line="556" Column="1" TopLine="539"/> 233 233 </Position2> 234 234 <Position3> 235 <Filename Value=" Visual\USourceTree.pas"/>236 <Caret Line=" 24" Column="15" TopLine="11"/>235 <Filename Value="Analyze\UPascalParser.pas"/> 236 <Caret Line="558" Column="1" TopLine="539"/> 237 237 </Position3> 238 238 <Position4> 239 <Filename Value=" Visual\USourceTree.pas"/>240 <Caret Line=" 211" Column="16" TopLine="198"/>239 <Filename Value="Analyze\UPascalParser.pas"/> 240 <Caret Line="559" Column="1" TopLine="539"/> 241 241 </Position4> 242 242 <Position5> 243 <Filename Value=" Visual\USourceTree.pas"/>244 <Caret Line=" 228" Column="32" TopLine="215"/>243 <Filename Value="Analyze\UPascalParser.pas"/> 244 <Caret Line="599" Column="1" TopLine="586"/> 245 245 </Position5> 246 246 <Position6> 247 <Filename Value=" Visual\USourceTree.pas"/>248 <Caret Line=" 237" Column="1" TopLine="216"/>247 <Filename Value="Analyze\UPascalParser.pas"/> 248 <Caret Line="600" Column="1" TopLine="586"/> 249 249 </Position6> 250 250 <Position7> 251 <Filename Value=" Visual\USourceTree.pas"/>252 <Caret Line=" 238" Column="1" TopLine="217"/>251 <Filename Value="Analyze\UPascalParser.pas"/> 252 <Caret Line="602" Column="1" TopLine="589"/> 253 253 </Position7> 254 254 <Position8> 255 <Filename Value=" Visual\USourceTree.pas"/>256 <Caret Line=" 239" Column="1" TopLine="218"/>255 <Filename Value="Analyze\UPascalParser.pas"/> 256 <Caret Line="603" Column="1" TopLine="589"/> 257 257 </Position8> 258 258 <Position9> 259 <Filename Value=" Visual\USourceTree.pas"/>260 <Caret Line=" 202" Column="1" TopLine="189"/>259 <Filename Value="Analyze\UPascalParser.pas"/> 260 <Caret Line="604" Column="1" TopLine="589"/> 261 261 </Position9> 262 262 <Position10> 263 <Filename Value=" Visual\USourceTree.pas"/>264 <Caret Line=" 203" Column="1" TopLine="189"/>263 <Filename Value="Analyze\UPascalParser.pas"/> 264 <Caret Line="605" Column="1" TopLine="595"/> 265 265 </Position10> 266 266 <Position11> 267 <Filename Value=" Visual\USourceTree.pas"/>268 <Caret Line=" 205" Column="1" TopLine="189"/>267 <Filename Value="Analyze\UPascalParser.pas"/> 268 <Caret Line="606" Column="1" TopLine="595"/> 269 269 </Position11> 270 270 <Position12> 271 <Filename Value=" Visual\USourceTree.pas"/>272 <Caret Line=" 209" Column="1" TopLine="195"/>271 <Filename Value="Analyze\UPascalParser.pas"/> 272 <Caret Line="607" Column="1" TopLine="595"/> 273 273 </Position12> 274 274 <Position13> 275 <Filename Value=" Visual\USourceTree.pas"/>276 <Caret Line=" 210" Column="20" TopLine="195"/>275 <Filename Value="Analyze\UPascalParser.pas"/> 276 <Caret Line="608" Column="1" TopLine="595"/> 277 277 </Position13> 278 278 <Position14> 279 <Filename Value=" Visual\USourceTree.pas"/>280 <Caret Line=" 235" Column="1" TopLine="222"/>279 <Filename Value="Analyze\UPascalParser.pas"/> 280 <Caret Line="610" Column="1" TopLine="595"/> 281 281 </Position14> 282 282 <Position15> 283 <Filename Value=" Visual\USourceTree.pas"/>284 <Caret Line=" 236" Column="1" TopLine="222"/>283 <Filename Value="Analyze\UPascalParser.pas"/> 284 <Caret Line="611" Column="1" TopLine="595"/> 285 285 </Position15> 286 286 <Position16> 287 <Filename Value=" Visual\USourceTree.pas"/>288 <Caret Line=" 237" Column="1" TopLine="222"/>287 <Filename Value="Analyze\UPascalParser.pas"/> 288 <Caret Line="612" Column="1" TopLine="595"/> 289 289 </Position16> 290 290 <Position17> 291 <Filename Value=" Visual\USourceTree.pas"/>292 <Caret Line=" 202" Column="1" TopLine="201"/>291 <Filename Value="Analyze\UPascalParser.pas"/> 292 <Caret Line="613" Column="1" TopLine="595"/> 293 293 </Position17> 294 294 <Position18> 295 <Filename Value=" Visual\USourceTree.pas"/>296 <Caret Line=" 203" Column="1" TopLine="198"/>295 <Filename Value="Analyze\UPascalParser.pas"/> 296 <Caret Line="614" Column="1" TopLine="595"/> 297 297 </Position18> 298 298 <Position19> 299 <Filename Value=" Visual\USourceTree.pas"/>300 <Caret Line=" 205" Column="1" TopLine="198"/>299 <Filename Value="Analyze\UPascalParser.pas"/> 300 <Caret Line="615" Column="1" TopLine="595"/> 301 301 </Position19> 302 302 <Position20> 303 <Filename Value=" Visual\USourceTree.pas"/>304 <Caret Line=" 209" Column="1" TopLine="198"/>303 <Filename Value="Analyze\UPascalParser.pas"/> 304 <Caret Line="620" Column="1" TopLine="599"/> 305 305 </Position20> 306 306 <Position21> 307 <Filename Value=" Visual\USourceTree.pas"/>308 <Caret Line=" 210" Column="1" TopLine="198"/>307 <Filename Value="Analyze\UPascalParser.pas"/> 308 <Caret Line="621" Column="1" TopLine="600"/> 309 309 </Position21> 310 310 <Position22> 311 <Filename Value=" Visual\USourceTree.pas"/>312 <Caret Line=" 211" Column="1" TopLine="198"/>311 <Filename Value="Analyze\UPascalParser.pas"/> 312 <Caret Line="622" Column="43" TopLine="610"/> 313 313 </Position22> 314 314 <Position23> 315 <Filename Value=" Visual\USourceTree.pas"/>316 <Caret Line=" 212" Column="1" TopLine="198"/>315 <Filename Value="UPascalSource.pas"/> 316 <Caret Line="417" Column="1" TopLine="404"/> 317 317 </Position23> 318 318 <Position24> 319 <Filename Value=" Visual\USourceTree.pas"/>320 <Caret Line=" 213" Column="1" TopLine="198"/>319 <Filename Value="UPascalSource.pas"/> 320 <Caret Line="418" Column="1" TopLine="404"/> 321 321 </Position24> 322 322 <Position25> 323 <Filename Value=" Visual\USourceTree.pas"/>324 <Caret Line=" 214" Column="1" TopLine="198"/>323 <Filename Value="UPascalSource.pas"/> 324 <Caret Line="419" Column="1" TopLine="404"/> 325 325 </Position25> 326 326 <Position26> 327 <Filename Value=" Analyze\UPascalParser.pas"/>328 <Caret Line=" 625" Column="33" TopLine="610"/>327 <Filename Value="UPascalSource.pas"/> 328 <Caret Line="420" Column="1" TopLine="404"/> 329 329 </Position26> 330 330 <Position27> 331 <Filename Value=" Analyze\UPascalParser.pas"/>332 <Caret Line=" 605" Column="16" TopLine="604"/>331 <Filename Value="UPascalSource.pas"/> 332 <Caret Line="421" Column="1" TopLine="404"/> 333 333 </Position27> 334 334 <Position28> 335 <Filename Value=" Analyze\UPascalParser.pas"/>336 <Caret Line=" 606" Column="23" TopLine="589"/>335 <Filename Value="UPascalSource.pas"/> 336 <Caret Line="417" Column="1" TopLine="404"/> 337 337 </Position28> 338 338 <Position29> 339 <Filename Value=" Analyze\UPascalParser.pas"/>340 <Caret Line=" 522" Column="19" TopLine="506"/>339 <Filename Value="UPascalSource.pas"/> 340 <Caret Line="418" Column="1" TopLine="404"/> 341 341 </Position29> 342 342 <Position30> 343 <Filename Value=" Analyze\UPascalParser.pas"/>344 <Caret Line=" 562" Column="22" TopLine="551"/>343 <Filename Value="UPascalSource.pas"/> 344 <Caret Line="251" Column="14" TopLine="268"/> 345 345 </Position30> 346 346 </JumpHistory> … … 383 383 </CompilerOptions> 384 384 <Debugging> 385 <BreakPoints Count="3">386 <Item1>387 <Source Value="Visual\USourceTree.pas"/>388 <Line Value="234"/>389 </Item1>390 <Item2>391 <Source Value="Visual\USourceTree.pas"/>392 <Line Value="202"/>393 </Item2>394 <Item3>395 <Source Value="Analyze\UPascalParser.pas"/>396 <Line Value="543"/>397 </Item3>398 </BreakPoints>399 385 <Exceptions Count="3"> 400 386 <Item1> -
branches/DelphiToC/UPascalCompiler.pas
r44 r45 18 18 FOnErrorMessage: TOnErrorMessage; 19 19 procedure ErrorMessage(Text: string); 20 procedure Init ;20 procedure InitSystem; 21 21 public 22 22 ProgramCode: TProgram; … … 36 36 procedure TCompiler.Compile; 37 37 begin 38 Init ;38 InitSystem; 39 39 Parser.Init; 40 try 41 Parser.ParseAll(ProgramCode); 42 except 43 on EEndOfData do ; 44 end; 40 Parser.ParseAll(ProgramCode); 45 41 Producer.Produce; 46 42 end; … … 70 66 end; 71 67 72 procedure TCompiler.Init ;68 procedure TCompiler.InitSystem; 73 69 begin 74 70 with Parser do begin -
branches/DelphiToC/UPascalSource.pas
r44 r45 336 336 begin 337 337 I := 0; 338 while (I < Count) and (LowerCase(TConstant(Items[I]).Name) <> Name) do Inc(I);338 while (I < Count) and (LowerCase(TConstant(Items[I]).Name) <> LowerCase(Name)) do Inc(I); 339 339 if I < Count then Result := TConstant(Items[I]) else begin 340 340 if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name) … … 417 417 begin 418 418 I := 0; 419 while (I < Count) and (LowerCase(TType(Items[I]).Name) <> Name) do Inc(I);419 while (I < Count) and (LowerCase(TType(Items[I]).Name) <> LowerCase(Name)) do Inc(I); 420 420 if I < Count then Result := TType(Items[I]) else begin 421 421 if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name) … … 438 438 begin 439 439 I := 0; 440 while (I < Count) and (LowerCase(TVariable(Items[I]).Name) <> Name) do Inc(I);440 while (I < Count) and (LowerCase(TVariable(Items[I]).Name) <> LowerCase(Name)) do Inc(I); 441 441 if I < Count then Result := TVariable(Items[I]) else begin 442 442 if Assigned(Parent.Parent) then … … 463 463 begin 464 464 I := 0; 465 while (I < Count) and (LowerCase(TFunction(Items[I]).Name) <> Name) do Inc(I);465 while (I < Count) and (LowerCase(TFunction(Items[I]).Name) <> LowerCase(Name)) do Inc(I); 466 466 if I < Count then Result := TFunction(Items[I]) else begin 467 467 if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name) … … 533 533 begin 534 534 I := 0; 535 while (I < Count) and (TParameter(Items[I]).Name <> Name) do Inc(I);535 while (I < Count) and (TParameter(Items[I]).Name <> LowerCase(Name)) do Inc(I); 536 536 if I < Count then Result := TParameter(Items[I]) 537 537 else Result := nil;
Note:
See TracChangeset
for help on using the changeset viewer.