mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:29:13 +02:00
* Fix compilation
git-svn-id: trunk@36817 -
This commit is contained in:
parent
1729d6a848
commit
cccff83bab
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="10"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<SaveOnlyProjectUnits Value="True"/>
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
@ -19,9 +19,6 @@
|
|||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
</i18n>
|
</i18n>
|
||||||
<VersionInfo>
|
|
||||||
<StringTable ProductVersion=""/>
|
|
||||||
</VersionInfo>
|
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
@ -37,12 +34,10 @@
|
|||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="pas2js.pp"/>
|
<Filename Value="pas2js.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pas2js"/>
|
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="fppas2js.pp"/>
|
<Filename Value="fppas2js.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="fppas2js"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
@ -55,12 +50,6 @@
|
|||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<MsgFileName Value=""/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="3">
|
<Exceptions Count="3">
|
||||||
|
@ -18,79 +18,50 @@
|
|||||||
program pas2js;
|
program pas2js;
|
||||||
|
|
||||||
uses
|
uses
|
||||||
sysutils, classes, pparser, fppas2js, pastree, jstree, jswriter;
|
sysutils, classes, pparser, fppas2js, pastree, jstree, jswriter, pasresolver;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
{ TContainer }
|
|
||||||
|
|
||||||
TContainer = Class(TPasTreeContainer)
|
|
||||||
|
|
||||||
public
|
|
||||||
function CreateElement(AClass: TPTreeElement; const AName: String;
|
|
||||||
AParent: TPasElement; AVisibility: TPasMemberVisibility;
|
|
||||||
const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
|
|
||||||
overload; override;
|
|
||||||
function FindElement(const AName: String): TPasElement; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TConvertPascal }
|
{ TConvertPascal }
|
||||||
|
|
||||||
TConvertPascal = Class(TComponent)
|
TConvertPascal = Class(TComponent)
|
||||||
Procedure ConvertSource(ASource, ADest : String);
|
Procedure ConvertSource(ASource, ADest : String);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TContainer }
|
|
||||||
|
|
||||||
function TContainer.CreateElement(AClass: TPTreeElement; const AName: String;
|
|
||||||
AParent: TPasElement; AVisibility: TPasMemberVisibility;
|
|
||||||
const ASourceFilename: String; ASourceLinenumber: Integer): TPasElement;
|
|
||||||
begin
|
|
||||||
Result:=AClass.Create(AName,AParent);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TContainer.FindElement(const AName: String): TPasElement;
|
|
||||||
begin
|
|
||||||
Result:=Nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TConvertPascal }
|
{ TConvertPascal }
|
||||||
|
|
||||||
Procedure TConvertPascal.ConvertSource(ASource, ADest: String);
|
Procedure TConvertPascal.ConvertSource(ASource, ADest: String);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
p : TPasParser;
|
C : TPas2JSResolver;
|
||||||
C : TPAsTreeContainer;
|
|
||||||
M : TPasModule;
|
M : TPasModule;
|
||||||
CV : TPasToJSConverter;
|
CV : TPasToJSConverter;
|
||||||
JS : TJSElement;
|
JS : TJSElement;
|
||||||
W : TJSWriter;
|
W : TJSWriter;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
C:=TContainer.Create;
|
W:=nil;
|
||||||
|
M:=Nil;
|
||||||
|
CV:=Nil;
|
||||||
|
C:=TPas2JSResolver.Create;
|
||||||
try
|
try
|
||||||
M:=ParseSource(C,ASource,'','',True);
|
M:=ParseSource(C,ASource,'','',[poUseStreams]);
|
||||||
try
|
CV:=TPasToJSConverter.Create;
|
||||||
CV:=TPasToJSConverter.Create;
|
JS:=CV.ConvertPasElement(M,C);
|
||||||
try
|
If JS=nil then
|
||||||
JS:=CV.ConvertElement(M);
|
Writeln('No result')
|
||||||
If JS=nil then
|
else
|
||||||
Writeln('No result');
|
begin
|
||||||
finally
|
|
||||||
CV.Free;
|
|
||||||
end;
|
|
||||||
W:=TJSWriter.Create(ADest);
|
W:=TJSWriter.Create(ADest);
|
||||||
try
|
W.Options:=[woUseUTF8,woCompactArrayLiterals,woCompactObjectLiterals,woCompactArguments];
|
||||||
W.Options:=[woUseUTF8,woCompactArrayLiterals,woCompactObjectLiterals,woCompactArguments];
|
W.IndentSize:=2;
|
||||||
W.IndentSize:=2;
|
W.WriteJS(JS);
|
||||||
W.WriteJS(JS);
|
end
|
||||||
finally
|
|
||||||
W.Free;
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
M.Free;
|
|
||||||
end;
|
|
||||||
finally
|
finally
|
||||||
|
W.Free;
|
||||||
|
CV.Free;
|
||||||
|
M.Free;
|
||||||
C.Free;
|
C.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user