Changeset 71
- Timestamp:
- Oct 19, 2010, 1:11:59 PM (14 years ago)
- Location:
- branches/Transpascal
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Transpascal/Compiler/Analyze/UParser.pas
r70 r71 35 35 CodeStreamPosition: integer; 36 36 CodePosition: TPoint; 37 LastTokenPosition: TPoint; 37 LastTokenEnd: TPoint; 38 LastTokenStart: TPoint; 38 39 SourceCodeText: TStringList; 39 40 function IsAlphanumeric(Character: char): boolean; … … 74 75 begin 75 76 if Assigned(FOnErrorMessage) then 76 FOnErrorMessage(Format(Text, Arguments), LastToken Position, FileName);77 FOnErrorMessage(Format(Text, Arguments), LastTokenStart, FileName); 77 78 end; 78 79 … … 80 81 begin 81 82 Log('Expected: ' + Code + ' Readed: ' + FNextToken); 82 if FNextToken <> Code then 83 begin83 if FNextToken <> Code then begin 84 //ReadCode; 84 85 ErrorMessage(SExpectedButFound, [Code, FNextToken]); 85 86 … … 185 186 DoubleSpecChar: array[0..6] of string = (':=', '..', '<=', '>=', '<>', '+=', '-='); 186 187 begin 187 LastTokenPosition := CodePosition; 188 LastTokenStart := LastTokenEnd; 189 LastTokenEnd := CodePosition; 188 190 FNextToken := ''; 189 191 FNextTokenType := ttNone; -
branches/Transpascal/Compiler/Analyze/UPascalParser.pas
r70 r71 6 6 7 7 uses 8 Classes, SysUtils, UParser, USourceCode ;8 Classes, SysUtils, UParser, USourceCode, Dialogs; 9 9 10 10 type … … 61 61 Parser.ProgramCode := ProgramCode; 62 62 Parser.OnGetSource := OnGetSource; 63 if Assigned( FOnGetSource) then begin63 if Assigned(OnGetSource) then begin 64 64 if FOnGetSource(Name, Parser.SourceCodeText) then begin 65 65 Parser.Init; … … 948 948 Module := SourceCode.ParentModule.ParentProgram.Modules.Search(Name); 949 949 Exported := AExported; 950 end else ErrorMessage(SUnitNotFound, [Name]); 950 end else begin 951 ErrorMessage(SUnitNotFound, [Name]); 952 SourceCode.Delete(SourceCode.Count - 1); 953 end; 951 954 end; 952 955 end; … … 962 965 Module := SourceCode.ParentModule.ParentProgram.Modules.Search(Name); 963 966 if not Assigned(Module) then begin 964 if not ParseFile(Name) then ErrorMessage(SUnitNotFound, [Name]); 967 if not ParseFile(Name) then begin 968 ErrorMessage(SUnitNotFound, [Name]); 969 SourceCode.Delete(SourceCode.Count - 1); 970 end; 965 971 end; 966 972 end; -
branches/Transpascal/Compiler/UCompiler.pas
r70 r71 66 66 Parser.SourceCodeText := Source; 67 67 Parser.Init; 68 //ShowMessage(IntToHex(Integer(Addr(Parser.OnGetSource)), 8)); 68 69 NewModule := Parser.ParseModule(ProgramCode); 69 70 ProgramCode.Modules.Add(NewModule); -
branches/Transpascal/Compiler/USourceCode.pas
r68 r71 768 768 I := 0; 769 769 while (I < UsedModules.Count) and (not Assigned(Result)) do begin 770 Result := TUsedModule(UsedModules[I]).Module.SearchType(Name, False); 770 with TUsedModule(UsedModules[I]) do 771 with Module do 772 Result := SearchType(Name, False); 771 773 Inc(I); 772 774 end; -
branches/Transpascal/Forms/UMainForm.pas
r69 r71 105 105 Compiler.Init; 106 106 Compiler.Parser.OnGetSource := GetSource; 107 107 108 if Project.Items.Count > 0 then 108 109 with TProjectFile(Project.Items[0]) do begin -
branches/Transpascal/Transpascal.lpi
r70 r71 51 51 <IsPartOfProject Value="True"/> 52 52 <UnitName Value="Transpascal"/> 53 <EditorIndex Value="18"/> 54 <WindowIndex Value="0"/> 55 <TopLine Value="4"/> 56 <CursorPos X="65" Y="22"/> 53 <WindowIndex Value="0"/> 54 <TopLine Value="7"/> 55 <CursorPos X="29" Y="24"/> 57 56 <UsageCount Value="215"/> 58 <Loaded Value="True"/>59 57 <DefaultSyntaxHighlighter Value="Delphi"/> 60 58 </Unit0> … … 66 64 <ResourceBaseClass Value="Form"/> 67 65 <UnitName Value="UMainForm"/> 68 <IsVisibleTab Value="True"/> 69 <EditorIndex Value="14"/> 70 <WindowIndex Value="0"/> 71 <TopLine Value="1"/> 72 <CursorPos X="77" Y="12"/> 66 <EditorIndex Value="6"/> 67 <WindowIndex Value="0"/> 68 <TopLine Value="99"/> 69 <CursorPos X="1" Y="120"/> 73 70 <UsageCount Value="215"/> 74 71 <Loaded Value="True"/> … … 208 205 <IsPartOfProject Value="True"/> 209 206 <UnitName Value="UProject"/> 210 <EditorIndex Value=" 10"/>211 <WindowIndex Value="0"/> 212 <TopLine Value=" 1"/>207 <EditorIndex Value="5"/> 208 <WindowIndex Value="0"/> 209 <TopLine Value="3"/> 213 210 <CursorPos X="50" Y="10"/> 214 <UsageCount Value=" 89"/>211 <UsageCount Value="92"/> 215 212 <Loaded Value="True"/> 216 213 <DefaultSyntaxHighlighter Value="Delphi"/> … … 226 223 <Filename Value="Compiler\TranspascalCompiler.pas"/> 227 224 <UnitName Value="TranspascalCompiler"/> 228 <EditorIndex Value="0"/>229 225 <WindowIndex Value="0"/> 230 226 <TopLine Value="1"/> 231 227 <CursorPos X="33" Y="1"/> 232 <UsageCount Value="37"/> 233 <Loaded Value="True"/> 228 <UsageCount Value="39"/> 234 229 </Unit20> 235 230 <Unit21> 236 231 <Filename Value="Compiler\UCompiler.pas"/> 237 232 <UnitName Value="UCompiler"/> 238 <EditorIndex Value=" 3"/>239 <WindowIndex Value="0"/> 240 <TopLine Value=" 1"/>241 <CursorPos X=" 51" Y="9"/>242 <UsageCount Value="3 5"/>233 <EditorIndex Value="1"/> 234 <WindowIndex Value="0"/> 235 <TopLine Value="56"/> 236 <CursorPos X="7" Y="68"/> 237 <UsageCount Value="37"/> 243 238 <Loaded Value="True"/> 244 239 </Unit21> … … 246 241 <Filename Value="Compiler\USourceCode.pas"/> 247 242 <UnitName Value="USourceCode"/> 248 <EditorIndex Value="11"/> 249 <WindowIndex Value="0"/> 250 <TopLine Value="757"/> 251 <CursorPos X="1" Y="770"/> 252 <UsageCount Value="34"/> 243 <IsVisibleTab Value="True"/> 244 <EditorIndex Value="7"/> 245 <WindowIndex Value="0"/> 246 <TopLine Value="472"/> 247 <CursorPos X="1" Y="485"/> 248 <UsageCount Value="36"/> 253 249 <Loaded Value="True"/> 254 250 </Unit22> … … 256 252 <Filename Value="Compiler\Analyze\UParser.pas"/> 257 253 <UnitName Value="UParser"/> 258 <EditorIndex Value=" 7"/>259 <WindowIndex Value="0"/> 260 <TopLine Value=" 73"/>261 <CursorPos X=" 63" Y="76"/>262 <UsageCount Value="3 5"/>254 <EditorIndex Value="3"/> 255 <WindowIndex Value="0"/> 256 <TopLine Value="167"/> 257 <CursorPos X="3" Y="169"/> 258 <UsageCount Value="37"/> 263 259 <Loaded Value="True"/> 264 260 </Unit23> … … 277 273 <ResourceBaseClass Value="Form"/> 278 274 <UnitName Value="UProjectManager"/> 279 <EditorIndex Value="2"/>280 275 <WindowIndex Value="0"/> 281 276 <TopLine Value="71"/> 282 277 <CursorPos X="20" Y="76"/> 283 <UsageCount Value="73"/> 284 <Loaded Value="True"/> 285 <LoadedDesigner Value="True"/> 278 <UsageCount Value="76"/> 286 279 <DefaultSyntaxHighlighter Value="Delphi"/> 287 280 </Unit25> … … 292 285 <ResourceBaseClass Value="Form"/> 293 286 <UnitName Value="UCodeForm"/> 294 <EditorIndex Value=" 1"/>287 <EditorIndex Value="0"/> 295 288 <WindowIndex Value="0"/> 296 289 <TopLine Value="7"/> 297 290 <CursorPos X="32" Y="16"/> 298 <UsageCount Value="7 3"/>291 <UsageCount Value="76"/> 299 292 <Loaded Value="True"/> 300 293 <LoadedDesigner Value="True"/> … … 307 300 <ResourceBaseClass Value="Form"/> 308 301 <UnitName Value="UMessagesForm"/> 309 <EditorIndex Value="16"/> 310 <WindowIndex Value="0"/> 311 <TopLine Value="56"/> 302 <WindowIndex Value="0"/> 303 <TopLine Value="61"/> 312 304 <CursorPos X="24" Y="71"/> 313 <UsageCount Value="73"/> 314 <Loaded Value="True"/> 315 <LoadedDesigner Value="True"/> 305 <UsageCount Value="76"/> 316 306 <DefaultSyntaxHighlighter Value="Delphi"/> 317 307 </Unit27> … … 323 313 <ResourceBaseClass Value="Form"/> 324 314 <UnitName Value="UCompiledForm"/> 325 <EditorIndex Value="12"/>326 315 <WindowIndex Value="0"/> 327 316 <TopLine Value="5"/> 328 317 <CursorPos X="28" Y="21"/> 329 <UsageCount Value="72"/> 330 <Loaded Value="True"/> 331 <LoadedDesigner Value="True"/> 318 <UsageCount Value="75"/> 332 319 <DefaultSyntaxHighlighter Value="Delphi"/> 333 320 </Unit28> … … 338 325 <ResourceBaseClass Value="Form"/> 339 326 <UnitName Value="UCodeTreeForm"/> 340 <EditorIndex Value="17"/>341 327 <WindowIndex Value="0"/> 342 328 <TopLine Value="1"/> 343 329 <CursorPos X="1" Y="1"/> 344 <UsageCount Value="72"/> 345 <Loaded Value="True"/> 346 <LoadedDesigner Value="True"/> 330 <UsageCount Value="75"/> 347 331 <DefaultSyntaxHighlighter Value="Delphi"/> 348 332 </Unit29> … … 350 334 <Filename Value="Compiler\Produce\UProducerTreeView.pas"/> 351 335 <UnitName Value="UProducerTreeView"/> 352 <EditorIndex Value="5"/>353 336 <WindowIndex Value="0"/> 354 337 <TopLine Value="291"/> 355 338 <CursorPos X="54" Y="304"/> 356 <UsageCount Value="35"/> 357 <Loaded Value="True"/> 339 <UsageCount Value="37"/> 358 340 </Unit30> 359 341 <Unit31> 360 342 <Filename Value="E:\Programy\Lazarus\components\synedit\synhighlightermulti.pas"/> 361 343 <UnitName Value="SynHighlighterMulti"/> 362 <EditorIndex Value="13"/>363 344 <WindowIndex Value="0"/> 364 345 <TopLine Value="316"/> 365 346 <CursorPos X="14" Y="329"/> 366 <UsageCount Value="35"/> 367 <Loaded Value="True"/> 347 <UsageCount Value="37"/> 368 348 </Unit31> 369 349 <Unit32> 370 350 <Filename Value="E:\Programy\Lazarus\lcl\include\customform.inc"/> 371 <EditorIndex Value="15"/>372 351 <WindowIndex Value="0"/> 373 352 <TopLine Value="1756"/> 374 353 <CursorPos X="31" Y="1770"/> 375 <UsageCount Value="32"/> 376 <Loaded Value="True"/> 354 <UsageCount Value="34"/> 377 355 </Unit32> 378 356 <Unit33> … … 380 358 <IsPartOfProject Value="True"/> 381 359 <UnitName Value="URegistry"/> 382 <UsageCount Value="6 5"/>360 <UsageCount Value="68"/> 383 361 <DefaultSyntaxHighlighter Value="Delphi"/> 384 362 </Unit33> … … 387 365 <IsPartOfProject Value="True"/> 388 366 <UnitName Value="ULastOpenedList"/> 389 <UsageCount Value="6 5"/>367 <UsageCount Value="68"/> 390 368 <DefaultSyntaxHighlighter Value="Delphi"/> 391 369 </Unit34> … … 394 372 <IsPartOfProject Value="True"/> 395 373 <UnitName Value="UApplicationInfo"/> 396 <UsageCount Value="6 4"/>374 <UsageCount Value="67"/> 397 375 <DefaultSyntaxHighlighter Value="Delphi"/> 398 376 </Unit35> … … 400 378 <Filename Value="Compiler\Produce\UProducerC.pas"/> 401 379 <UnitName Value="UProducerC"/> 402 <EditorIndex Value=" 8"/>380 <EditorIndex Value="4"/> 403 381 <WindowIndex Value="0"/> 404 382 <TopLine Value="288"/> 405 383 <CursorPos X="57" Y="302"/> 406 <UsageCount Value="3 1"/>384 <UsageCount Value="33"/> 407 385 <Loaded Value="True"/> 408 386 </Unit36> … … 410 388 <Filename Value="Compiler\Produce\UProducerAsm8051.pas"/> 411 389 <UnitName Value="UProducerAsm8051"/> 412 <EditorIndex Value="9"/>413 390 <WindowIndex Value="0"/> 414 391 <TopLine Value="1"/> 415 392 <CursorPos X="1" Y="1"/> 416 <UsageCount Value="31"/> 417 <Loaded Value="True"/> 393 <UsageCount Value="33"/> 418 394 </Unit37> 419 395 <Unit38> 420 396 <Filename Value="Compiler\Produce\UProducerPascal.pas"/> 421 397 <UnitName Value="UProducerPascal"/> 422 <EditorIndex Value="6"/>423 398 <WindowIndex Value="0"/> 424 399 <TopLine Value="99"/> 425 400 <CursorPos X="57" Y="112"/> 426 <UsageCount Value="28"/> 427 <Loaded Value="True"/> 401 <UsageCount Value="30"/> 428 402 </Unit38> 429 403 <Unit39> … … 435 409 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 436 410 <UnitName Value="UPascalParser"/> 437 <EditorIndex Value=" 4"/>438 <WindowIndex Value="0"/> 439 <TopLine Value=" 1"/>440 <CursorPos X=" 1" Y="1"/>441 <UsageCount Value="1 0"/>411 <EditorIndex Value="2"/> 412 <WindowIndex Value="0"/> 413 <TopLine Value="806"/> 414 <CursorPos X="34" Y="811"/> 415 <UsageCount Value="12"/> 442 416 <Loaded Value="True"/> 443 417 </Unit40> … … 446 420 <Position1> 447 421 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 448 <Caret Line="6 80" Column="13" TopLine="667"/>422 <Caret Line="63" Column="1" TopLine="50"/> 449 423 </Position1> 450 424 <Position2> 451 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>452 <Caret Line=" 702" Column="27" TopLine="689"/>425 <Filename Value="Compiler\UCompiler.pas"/> 426 <Caret Line="68" Column="7" TopLine="56"/> 453 427 </Position2> 454 428 <Position3> 455 429 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 456 <Caret Line=" 709" Column="15" TopLine="696"/>430 <Caret Line="63" Column="1" TopLine="50"/> 457 431 </Position3> 458 432 <Position4> 459 433 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 460 <Caret Line=" 748" Column="27" TopLine="735"/>434 <Caret Line="64" Column="1" TopLine="50"/> 461 435 </Position4> 462 436 <Position5> 463 <Filename Value=" Compiler\Analyze\UPascalParser.pas"/>464 <Caret Line=" 784" Column="41" TopLine="771"/>437 <Filename Value="Forms\UMainForm.pas"/> 438 <Caret Line="120" Column="1" TopLine="99"/> 465 439 </Position5> 466 440 <Position6> 467 441 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 468 <Caret Line=" 799" Column="21" TopLine="786"/>442 <Caret Line="63" Column="1" TopLine="50"/> 469 443 </Position6> 470 444 <Position7> 471 445 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 472 <Caret Line=" 806" Column="19" TopLine="793"/>446 <Caret Line="64" Column="1" TopLine="50"/> 473 447 </Position7> 474 448 <Position8> 475 <Filename Value=" Compiler\Analyze\UPascalParser.pas"/>476 <Caret Line=" 855" Column="35" TopLine="842"/>449 <Filename Value="Forms\UMainForm.pas"/> 450 <Caret Line="120" Column="1" TopLine="99"/> 477 451 </Position8> 478 452 <Position9> 479 453 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 480 <Caret Line=" 860" Column="36" TopLine="847"/>454 <Caret Line="534" Column="47" TopLine="524"/> 481 455 </Position9> 482 456 <Position10> 483 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>484 <Caret Line=" 866" Column="37" TopLine="853"/>457 <Filename Value="Compiler\USourceCode.pas"/> 458 <Caret Line="474" Column="3" TopLine="470"/> 485 459 </Position10> 486 460 <Position11> 487 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>488 <Caret Line=" 885" Column="39" TopLine="872"/>461 <Filename Value="Compiler\USourceCode.pas"/> 462 <Caret Line="473" Column="1" TopLine="468"/> 489 463 </Position11> 490 464 <Position12> 491 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>492 <Caret Line=" 913" Column="17" TopLine="892"/>465 <Filename Value="Compiler\USourceCode.pas"/> 466 <Caret Line="475" Column="1" TopLine="468"/> 493 467 </Position12> 494 468 <Position13> 495 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>496 <Caret Line=" 941" Column="8" TopLine="928"/>469 <Filename Value="Compiler\USourceCode.pas"/> 470 <Caret Line="476" Column="1" TopLine="468"/> 497 471 </Position13> 498 472 <Position14> 499 <Filename Value="Compiler\ Analyze\UPascalParser.pas"/>500 <Caret Line=" 953" Column="9" TopLine="940"/>473 <Filename Value="Compiler\USourceCode.pas"/> 474 <Caret Line="477" Column="1" TopLine="468"/> 501 475 </Position14> 502 476 <Position15> 503 <Filename Value=" Forms\UMainForm.pas"/>504 <Caret Line=" 113" Column="23" TopLine="100"/>477 <Filename Value="Compiler\USourceCode.pas"/> 478 <Caret Line="480" Column="1" TopLine="468"/> 505 479 </Position15> 506 480 <Position16> 507 <Filename Value=" Forms\UMainForm.pas"/>508 <Caret Line=" 14" Column="43" TopLine="1"/>481 <Filename Value="Compiler\USourceCode.pas"/> 482 <Caret Line="484" Column="1" TopLine="468"/> 509 483 </Position16> 510 484 <Position17> 511 <Filename Value=" Forms\UMainForm.pas"/>512 <Caret Line=" 9" Column="22" TopLine="1"/>485 <Filename Value="Compiler\USourceCode.pas"/> 486 <Caret Line="487" Column="1" TopLine="468"/> 513 487 </Position17> 514 488 <Position18> 515 <Filename Value=" Forms\UMainForm.pas"/>516 <Caret Line=" 16" Column="41" TopLine="1"/>489 <Filename Value="Compiler\USourceCode.pas"/> 490 <Caret Line="473" Column="1" TopLine="468"/> 517 491 </Position18> 518 492 <Position19> 519 <Filename Value=" Forms\UMainForm.pas"/>520 <Caret Line=" 9" Column="27" TopLine="1"/>493 <Filename Value="Compiler\USourceCode.pas"/> 494 <Caret Line="475" Column="1" TopLine="468"/> 521 495 </Position19> 522 496 <Position20> 523 <Filename Value="Compiler\U Compiler.pas"/>524 <Caret Line=" 9" Column="36" TopLine="1"/>497 <Filename Value="Compiler\USourceCode.pas"/> 498 <Caret Line="476" Column="1" TopLine="468"/> 525 499 </Position20> 526 500 <Position21> 527 <Filename Value=" Forms\UMainForm.pas"/>528 <Caret Line=" 9" Column="27" TopLine="1"/>501 <Filename Value="Compiler\USourceCode.pas"/> 502 <Caret Line="477" Column="1" TopLine="468"/> 529 503 </Position21> 530 504 <Position22> 531 <Filename Value=" Forms\UMainForm.pas"/>532 <Caret Line=" 9" Column="31" TopLine="1"/>505 <Filename Value="Compiler\USourceCode.pas"/> 506 <Caret Line="480" Column="1" TopLine="468"/> 533 507 </Position22> 534 508 <Position23> 535 <Filename Value=" Forms\UMainForm.pas"/>536 <Caret Line=" 13" Column="37" TopLine="1"/>509 <Filename Value="Compiler\USourceCode.pas"/> 510 <Caret Line="484" Column="1" TopLine="468"/> 537 511 </Position23> 538 512 <Position24> 539 <Filename Value=" Forms\UMainForm.pas"/>540 <Caret Line=" 9" Column="22" TopLine="1"/>513 <Filename Value="Compiler\USourceCode.pas"/> 514 <Caret Line="487" Column="1" TopLine="468"/> 541 515 </Position24> 542 516 <Position25> 543 <Filename Value=" Forms\UMainForm.pas"/>544 <Caret Line=" 13" Column="12" TopLine="2"/>517 <Filename Value="Compiler\USourceCode.pas"/> 518 <Caret Line="473" Column="1" TopLine="468"/> 545 519 </Position25> 546 520 <Position26> 547 <Filename Value=" Forms\UMainForm.pas"/>548 <Caret Line=" 14" Column="34" TopLine="1"/>521 <Filename Value="Compiler\USourceCode.pas"/> 522 <Caret Line="484" Column="1" TopLine="468"/> 549 523 </Position26> 550 524 <Position27> 551 <Filename Value="Compiler\ Analyze\UParser.pas"/>552 <Caret Line=" 289" Column="18" TopLine="269"/>525 <Filename Value="Compiler\USourceCode.pas"/> 526 <Caret Line="487" Column="1" TopLine="468"/> 553 527 </Position27> 554 528 <Position28> 555 <Filename Value="Compiler\Analyze\UPa rser.pas"/>556 <Caret Line=" 76" Column="63" TopLine="73"/>529 <Filename Value="Compiler\Analyze\UPascalParser.pas"/> 530 <Caret Line="811" Column="34" TopLine="806"/> 557 531 </Position28> 558 532 <Position29> 559 533 <Filename Value="Compiler\USourceCode.pas"/> 560 <Caret Line=" 767" Column="9" TopLine="757"/>534 <Caret Line="485" Column="1" TopLine="472"/> 561 535 </Position29> 562 536 <Position30> 563 <Filename Value=" Forms\UMainForm.pas"/>564 <Caret Line=" 9" Column="33" TopLine="1"/>537 <Filename Value="Compiler\USourceCode.pas"/> 538 <Caret Line="487" Column="1" TopLine="472"/> 565 539 </Position30> 566 540 </JumpHistory> … … 608 582 </CompilerOptions> 609 583 <Debugging> 610 <BreakPoints Count="1">611 <Item1>612 <Source Value="Compiler\USourceCode.pas"/>613 <Line Value="770"/>614 </Item1>615 </BreakPoints>616 584 <Exceptions Count="3"> 617 585 <Item1>
Note:
See TracChangeset
for help on using the changeset viewer.