Changeset 45 for branches/DelphiToC


Ignore:
Timestamp:
Aug 9, 2010, 10:34:09 AM (14 years ago)
Author:
george
Message:

Fixed comparasion of name of identificators as types, variables, consts, methods using lowercase.

Location:
branches/DelphiToC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/Analyze/UPascalParser.pas

    r44 r45  
    1010
    1111type
    12   EEndOfData = class(Exception);
    13 
    14   TBaseParser = class;
    15 
    1612  TOnErrorMessage = procedure (Text: string) of object;
    1713
     
    543539begin
    544540  with SourceCode do begin
    545     ParseModule(TModule(Modules[0]));
     541    for I := 0 to Modules.Count - 1 do
     542      ParseModule(TModule(Modules[I]));
    546543  end;
    547544end;
  • branches/DelphiToC/DelphiToC.lpi

    r44 r45  
    7777        <EditorIndex Value="5"/>
    7878        <WindowIndex Value="0"/>
    79         <TopLine Value="294"/>
    80         <CursorPos X="25" Y="296"/>
     79        <TopLine Value="268"/>
     80        <CursorPos X="14" Y="251"/>
    8181        <UsageCount Value="103"/>
    8282        <Loaded Value="True"/>
     
    8888        <EditorIndex Value="10"/>
    8989        <WindowIndex Value="0"/>
    90         <TopLine Value="25"/>
    91         <CursorPos X="1" Y="38"/>
     90        <TopLine Value="36"/>
     91        <CursorPos X="16" Y="40"/>
    9292        <UsageCount Value="103"/>
    9393        <Loaded Value="True"/>
     
    133133        <EditorIndex Value="0"/>
    134134        <WindowIndex Value="0"/>
    135         <TopLine Value="540"/>
    136         <CursorPos X="3" Y="544"/>
     135        <TopLine Value="528"/>
     136        <CursorPos X="1" Y="541"/>
    137137        <UsageCount Value="103"/>
    138138        <Loaded Value="True"/>
     
    143143        <TopLine Value="1"/>
    144144        <CursorPos X="1" Y="1"/>
    145         <UsageCount Value="2"/>
     145        <UsageCount Value="1"/>
    146146        <DefaultSyntaxHighlighter Value="LFM"/>
    147147      </Unit9>
     
    153153        <TopLine Value="68"/>
    154154        <CursorPos X="14" Y="90"/>
    155         <UsageCount Value="51"/>
     155        <UsageCount Value="52"/>
    156156        <Loaded Value="True"/>
    157157      </Unit10>
     
    162162        <TopLine Value="1555"/>
    163163        <CursorPos X="1" Y="1"/>
    164         <UsageCount Value="6"/>
     164        <UsageCount Value="5"/>
    165165      </Unit11>
    166166      <Unit12>
     
    170170        <TopLine Value="61"/>
    171171        <CursorPos X="7" Y="68"/>
    172         <UsageCount Value="34"/>
     172        <UsageCount Value="35"/>
    173173        <Loaded Value="True"/>
    174174      </Unit12>
     
    179179        <TopLine Value="139"/>
    180180        <CursorPos X="16" Y="146"/>
    181         <UsageCount Value="34"/>
     181        <UsageCount Value="35"/>
    182182        <Loaded Value="True"/>
    183183      </Unit13>
     
    187187        <TopLine Value="934"/>
    188188        <CursorPos X="10" Y="947"/>
    189         <UsageCount Value="10"/>
     189        <UsageCount Value="9"/>
    190190      </Unit14>
    191191      <Unit15>
     
    194194        <TopLine Value="834"/>
    195195        <CursorPos X="11" Y="847"/>
    196         <UsageCount Value="6"/>
     196        <UsageCount Value="5"/>
    197197      </Unit15>
    198198      <Unit16>
     
    201201        <TopLine Value="153"/>
    202202        <CursorPos X="8" Y="166"/>
    203         <UsageCount Value="9"/>
     203        <UsageCount Value="8"/>
    204204      </Unit16>
    205205      <Unit17>
     
    209209        <EditorIndex Value="2"/>
    210210        <WindowIndex Value="0"/>
    211         <TopLine Value="198"/>
    212         <CursorPos X="1" Y="215"/>
     211        <TopLine Value="189"/>
     212        <CursorPos X="1" Y="202"/>
    213213        <UsageCount Value="65"/>
    214214        <Loaded Value="True"/>
     
    220220        <TopLine Value="2656"/>
    221221        <CursorPos X="3" Y="2669"/>
    222         <UsageCount Value="6"/>
     222        <UsageCount Value="5"/>
    223223      </Unit18>
    224224    </Units>
    225225    <JumpHistory Count="30" HistoryIndex="29">
    226226      <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"/>
    229229      </Position1>
    230230      <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"/>
    233233      </Position2>
    234234      <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"/>
    237237      </Position3>
    238238      <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"/>
    241241      </Position4>
    242242      <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"/>
    245245      </Position5>
    246246      <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"/>
    249249      </Position6>
    250250      <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"/>
    253253      </Position7>
    254254      <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"/>
    257257      </Position8>
    258258      <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"/>
    261261      </Position9>
    262262      <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"/>
    265265      </Position10>
    266266      <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"/>
    269269      </Position11>
    270270      <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"/>
    273273      </Position12>
    274274      <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"/>
    277277      </Position13>
    278278      <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"/>
    281281      </Position14>
    282282      <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"/>
    285285      </Position15>
    286286      <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"/>
    289289      </Position16>
    290290      <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"/>
    293293      </Position17>
    294294      <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"/>
    297297      </Position18>
    298298      <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"/>
    301301      </Position19>
    302302      <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"/>
    305305      </Position20>
    306306      <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"/>
    309309      </Position21>
    310310      <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"/>
    313313      </Position22>
    314314      <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"/>
    317317      </Position23>
    318318      <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"/>
    321321      </Position24>
    322322      <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"/>
    325325      </Position25>
    326326      <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"/>
    329329      </Position26>
    330330      <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"/>
    333333      </Position27>
    334334      <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"/>
    337337      </Position28>
    338338      <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"/>
    341341      </Position29>
    342342      <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"/>
    345345      </Position30>
    346346    </JumpHistory>
     
    383383  </CompilerOptions>
    384384  <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>
    399385    <Exceptions Count="3">
    400386      <Item1>
  • branches/DelphiToC/UPascalCompiler.pas

    r44 r45  
    1818    FOnErrorMessage: TOnErrorMessage;
    1919    procedure ErrorMessage(Text: string);
    20     procedure Init;
     20    procedure InitSystem;
    2121  public
    2222    ProgramCode: TProgram;
     
    3636procedure TCompiler.Compile;
    3737begin
    38   Init;
     38  InitSystem;
    3939  Parser.Init;
    40   try
    41     Parser.ParseAll(ProgramCode);
    42   except
    43     on EEndOfData do ;
    44   end;
     40  Parser.ParseAll(ProgramCode);
    4541  Producer.Produce;
    4642end;
     
    7066end;
    7167
    72 procedure TCompiler.Init;
     68procedure TCompiler.InitSystem;
    7369begin
    7470  with Parser do begin
  • branches/DelphiToC/UPascalSource.pas

    r44 r45  
    336336begin
    337337  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);
    339339  if I < Count then Result := TConstant(Items[I]) else begin
    340340    if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name)
     
    417417begin
    418418  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);
    420420  if I < Count then Result := TType(Items[I]) else begin
    421421    if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name)
     
    438438begin
    439439  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);
    441441  if I < Count then Result := TVariable(Items[I]) else begin
    442442    if Assigned(Parent.Parent) then
     
    463463begin
    464464  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);
    466466  if I < Count then Result := TFunction(Items[I]) else begin
    467467    if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name)
     
    533533begin
    534534  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);
    536536  if I < Count then Result := TParameter(Items[I])
    537537    else Result := nil;
Note: See TracChangeset for help on using the changeset viewer.