Changeset 37
- Timestamp:
- Aug 4, 2010, 4:10:35 PM (14 years ago)
- Location:
- branches/DelphiToC
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/Analyze/UPascalParser.pas
r36 r37 6 6 7 7 uses 8 Windows, Messages,SysUtils, Variants, Classes, Graphics, Controls, Forms,8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 9 Dialogs, StdCtrls, UPascalSource, FileUtil; 10 10 … … 183 183 var 184 184 I: Integer; 185 //II: Integer;185 II: Integer; 186 186 J: Integer; 187 187 const 188 188 SpecChar: set of char = [';', '.', ',', ':', '(', ')', '[', ']', '+', '-', '/', '*', 189 189 '^', '=', '<' , '>' , '@']; 190 DoubleSpecChar : array[ 1..7] of string = (':=', '..', '<=', '>=', '<>', '+=', '-=');190 DoubleSpecChar : array[0..6] of string = (':=', '..', '<=', '>=', '<>', '+=', '-='); 191 191 begin 192 192 Result := ''; … … 217 217 if (Text[J] in SpecChar) then begin 218 218 if (Text[J + 1] in SpecChar) then begin 219 for I := 0 to High(DoubleSpecChar) do220 if Copy(Text, J, 2) = DoubleSpecChar[I ] then begin219 for II := 0 to High(DoubleSpecChar) do 220 if Copy(Text, J, 2) = DoubleSpecChar[II] then begin 221 221 Result := Copy(Text, J, 2); 222 222 Inc(J, 2); … … 549 549 begin 550 550 with Parser do begin 551 if NextCode = 'program' then ParseProgram(Parser) 552 else if NextCode = 'unit' then ParseUnit(Parser) 551 if NextCode = 'program' then 552 ParseProgram(Parser) 553 else if NextCode = 'unit' then 554 ParseUnit(Parser) 553 555 else ParseProgram(Parser); 554 556 end; -
branches/DelphiToC/DelphiToC.lpi
r36 r37 36 36 </Item1> 37 37 </RequiredPackages> 38 <Units Count=" 9">38 <Units Count="10"> 39 39 <Unit0> 40 40 <Filename Value="DelphiToC.lpr"/> … … 42 42 <EditorIndex Value="4"/> 43 43 <WindowIndex Value="0"/> 44 <TopLine Value=" 1"/>45 <CursorPos X="3 3" Y="16"/>44 <TopLine Value="4"/> 45 <CursorPos X="39" Y="12"/> 46 46 <UsageCount Value="20"/> 47 47 <Loaded Value="True"/> … … 56 56 <EditorIndex Value="1"/> 57 57 <WindowIndex Value="0"/> 58 <TopLine Value="1"/> 59 <CursorPos X="3" Y="8"/> 60 <UsageCount Value="20"/> 61 <Loaded Value="True"/> 58 <TopLine Value="42"/> 59 <CursorPos X="17" Y="49"/> 60 <UsageCount Value="20"/> 61 <Loaded Value="True"/> 62 <LoadedDesigner Value="True"/> 62 63 </Unit1> 63 64 <Unit2> … … 85 86 <EditorIndex Value="3"/> 86 87 <WindowIndex Value="0"/> 87 <TopLine Value=" 1"/>88 <CursorPos X=" 83" Y="9"/>88 <TopLine Value="32"/> 89 <CursorPos X="34" Y="35"/> 89 90 <UsageCount Value="20"/> 90 91 <Loaded Value="True"/> … … 114 115 <EditorIndex Value="2"/> 115 116 <WindowIndex Value="0"/> 116 <TopLine Value=" 1"/>117 <TopLine Value="3"/> 117 118 <CursorPos X="3" Y="8"/> 118 119 <UsageCount Value="20"/> … … 126 127 <EditorIndex Value="0"/> 127 128 <WindowIndex Value="0"/> 128 <TopLine Value="2 49"/>129 <CursorPos X=" 42" Y="256"/>129 <TopLine Value="204"/> 130 <CursorPos X="27" Y="221"/> 130 131 <UsageCount Value="20"/> 131 132 <Loaded Value="True"/> 132 133 </Unit8> 134 <Unit9> 135 <Filename Value="UMainForm.lfm"/> 136 <WindowIndex Value="0"/> 137 <TopLine Value="1"/> 138 <CursorPos X="1" Y="1"/> 139 <UsageCount Value="10"/> 140 <DefaultSyntaxHighlighter Value="LFM"/> 141 </Unit9> 133 142 </Units> 134 <JumpHistory Count=" 13" HistoryIndex="12">143 <JumpHistory Count="30" HistoryIndex="29"> 135 144 <Position1> 136 145 <Filename Value="Analyze\UPascalParser.pas"/> 137 <Caret Line=" 1" Column="1" TopLine="1"/>146 <Caret Line="630" Column="1" TopLine="617"/> 138 147 </Position1> 139 148 <Position2> 140 149 <Filename Value="Analyze\UPascalParser.pas"/> 141 <Caret Line=" 9" Column="46" TopLine="1"/>150 <Caret Line="631" Column="1" TopLine="617"/> 142 151 </Position2> 143 152 <Position3> 144 <Filename Value=" DelphiToC.lpr"/>145 <Caret Line=" 1" Column="1" TopLine="1"/>153 <Filename Value="Analyze\UPascalParser.pas"/> 154 <Caret Line="632" Column="1" TopLine="617"/> 146 155 </Position3> 147 156 <Position4> 148 157 <Filename Value="Analyze\UPascalParser.pas"/> 149 <Caret Line=" 9" Column="45" TopLine="1"/>158 <Caret Line="633" Column="1" TopLine="617"/> 150 159 </Position4> 151 160 <Position5> 152 161 <Filename Value="Analyze\UPascalParser.pas"/> 153 <Caret Line=" 254" Column="5" TopLine="241"/>162 <Caret Line="635" Column="1" TopLine="617"/> 154 163 </Position5> 155 164 <Position6> 156 <Filename Value=" UMainForm.pas"/>157 <Caret Line=" 1" Column="1" TopLine="1"/>165 <Filename Value="Analyze\UPascalParser.pas"/> 166 <Caret Line="637" Column="1" TopLine="617"/> 158 167 </Position6> 159 168 <Position7> 160 <Filename Value=" UMainForm.pas"/>161 <Caret Line=" 20" Column="46" TopLine="7"/>169 <Filename Value="Analyze\UPascalParser.pas"/> 170 <Caret Line="639" Column="1" TopLine="618"/> 162 171 </Position7> 163 172 <Position8> 164 <Filename Value=" Produce\UCSource.pas"/>165 <Caret Line=" 1" Column="1" TopLine="1"/>173 <Filename Value="Analyze\UPascalParser.pas"/> 174 <Caret Line="640" Column="1" TopLine="619"/> 166 175 </Position8> 167 176 <Position9> 168 <Filename Value=" Produce\UCSource.pas"/>169 <Caret Line=" 9" Column="22" TopLine="1"/>177 <Filename Value="Analyze\UPascalParser.pas"/> 178 <Caret Line="220" Column="1" TopLine="207"/> 170 179 </Position9> 171 180 <Position10> 172 <Filename Value=" UPascalCompiler.pas"/>173 <Caret Line=" 1" Column="1" TopLine="1"/>181 <Filename Value="Analyze\UPascalParser.pas"/> 182 <Caret Line="640" Column="1" TopLine="627"/> 174 183 </Position10> 175 184 <Position11> 176 <Filename Value=" UPascalCompiler.pas"/>177 <Caret Line=" 8" Column="3" TopLine="1"/>185 <Filename Value="Analyze\UPascalParser.pas"/> 186 <Caret Line="683" Column="38" TopLine="665"/> 178 187 </Position11> 179 188 <Position12> 180 189 <Filename Value="Analyze\UPascalParser.pas"/> 181 <Caret Line=" 258" Column="16" TopLine="241"/>190 <Caret Line="687" Column="1" TopLine="666"/> 182 191 </Position12> 183 192 <Position13> 184 193 <Filename Value="Analyze\UPascalParser.pas"/> 185 <Caret Line=" 413" Column="39" TopLine="400"/>194 <Caret Line="220" Column="33" TopLine="216"/> 186 195 </Position13> 196 <Position14> 197 <Filename Value="Analyze\UPascalParser.pas"/> 198 <Caret Line="549" Column="1" TopLine="536"/> 199 </Position14> 200 <Position15> 201 <Filename Value="Analyze\UPascalParser.pas"/> 202 <Caret Line="220" Column="1" TopLine="207"/> 203 </Position15> 204 <Position16> 205 <Filename Value="Analyze\UPascalParser.pas"/> 206 <Caret Line="549" Column="1" TopLine="536"/> 207 </Position16> 208 <Position17> 209 <Filename Value="Analyze\UPascalParser.pas"/> 210 <Caret Line="550" Column="1" TopLine="536"/> 211 </Position17> 212 <Position18> 213 <Filename Value="Analyze\UPascalParser.pas"/> 214 <Caret Line="551" Column="1" TopLine="536"/> 215 </Position18> 216 <Position19> 217 <Filename Value="Analyze\UPascalParser.pas"/> 218 <Caret Line="552" Column="1" TopLine="536"/> 219 </Position19> 220 <Position20> 221 <Filename Value="Analyze\UPascalParser.pas"/> 222 <Caret Line="562" Column="1" TopLine="549"/> 223 </Position20> 224 <Position21> 225 <Filename Value="Analyze\UPascalParser.pas"/> 226 <Caret Line="563" Column="1" TopLine="549"/> 227 </Position21> 228 <Position22> 229 <Filename Value="Analyze\UPascalParser.pas"/> 230 <Caret Line="564" Column="1" TopLine="549"/> 231 </Position22> 232 <Position23> 233 <Filename Value="Analyze\UPascalParser.pas"/> 234 <Caret Line="565" Column="1" TopLine="549"/> 235 </Position23> 236 <Position24> 237 <Filename Value="Analyze\UPascalParser.pas"/> 238 <Caret Line="566" Column="1" TopLine="561"/> 239 </Position24> 240 <Position25> 241 <Filename Value="Analyze\UPascalParser.pas"/> 242 <Caret Line="567" Column="1" TopLine="561"/> 243 </Position25> 244 <Position26> 245 <Filename Value="Analyze\UPascalParser.pas"/> 246 <Caret Line="568" Column="1" TopLine="561"/> 247 </Position26> 248 <Position27> 249 <Filename Value="Analyze\UPascalParser.pas"/> 250 <Caret Line="572" Column="1" TopLine="561"/> 251 </Position27> 252 <Position28> 253 <Filename Value="Analyze\UPascalParser.pas"/> 254 <Caret Line="579" Column="1" TopLine="561"/> 255 </Position28> 256 <Position29> 257 <Filename Value="Analyze\UPascalParser.pas"/> 258 <Caret Line="219" Column="1" TopLine="206"/> 259 </Position29> 260 <Position30> 261 <Filename Value="Analyze\UPascalParser.pas"/> 262 <Caret Line="220" Column="36" TopLine="206"/> 263 </Position30> 187 264 </JumpHistory> 188 265 </ProjectOptions> … … 209 286 <UseHeaptrc Value="True"/> 210 287 </Debugging> 288 <Options> 289 <Win32> 290 <GraphicApplication Value="True"/> 291 </Win32> 292 </Options> 211 293 </Linking> 212 294 <Other> … … 218 300 </CompilerOptions> 219 301 <Debugging> 302 <BreakPoints Count="2"> 303 <Item1> 304 <Source Value="Analyze\UPascalParser.pas"/> 305 <Line Value="549"/> 306 </Item1> 307 <Item2> 308 <Source Value="Analyze\UPascalParser.pas"/> 309 <Line Value="219"/> 310 </Item2> 311 </BreakPoints> 220 312 <Exceptions Count="3"> 221 313 <Item1> -
branches/DelphiToC/DelphiToC.lpr
r36 r37 4 4 5 5 uses 6 Forms, Interfaces, 6 {$IFDEF UNIX}{$IFDEF UseCThreads} 7 cthreads, 8 {$ENDIF}{$ENDIF} 9 Forms, Interfaces, SysUtils, 7 10 UMainForm in 'UMainForm.pas' {MainForm}, 8 11 UTextSource in 'UTextSource.pas', … … 16 19 {$R *.res} 17 20 18 {$WARN SYMBOL_PLATFORM OFF}19 21 begin 22 // Heap trace 23 DeleteFile(ExtractFilePath(ParamStr(0)) + 'heaptrclog.trc'); 24 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + 'heaptrclog.trc'); 25 20 26 Application.Initialize; 21 27 Application.CreateForm(TMainForm, MainForm); -
branches/DelphiToC/UMainForm.lfm
r36 r37 1 1 object MainForm: TMainForm 2 Left = 02 Left = 83 3 3 Height = 535 4 Top = 04 Top = 68 5 5 Width = 883 6 6 Caption = 'Pascal Compiler AVR' … … 64 64 Width = 298 65 65 Anchors = [akTop, akLeft, akBottom] 66 DefaultItemHeight = 15 66 67 Indent = 19 67 68 TabOrder = 4 -
branches/DelphiToC/UMainForm.pas
r36 r37 9 9 Dialogs, StdCtrls, UPascalSource, UPascalCompiler, UAssemblerSource, 10 10 UCSource, ComCtrls; 11 12 const 13 ExampleFileName = '../../Example.pas'; 11 14 12 15 type … … 125 128 procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); 126 129 begin 127 Memo1.Lines.SaveToFile( 'Example.pas');130 Memo1.Lines.SaveToFile(ExampleFileName); 128 131 end; 129 132 … … 141 144 procedure TMainForm.FormShow(Sender: TObject); 142 145 begin 143 Memo1.Lines.LoadFromFile( 'Example.pas');146 Memo1.Lines.LoadFromFile(ExampleFileName); 144 147 Button1Click(Self); 145 148 end;
Note:
See TracChangeset
for help on using the changeset viewer.