Skip to content

Commit

Permalink
DelphiXE compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sglienke committed Dec 28, 2014
1 parent 7459fb6 commit 5a2b8da
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Demo/DelphiASTDemo.dpr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program DelphiASTDemo;

uses
Vcl.Forms,
Forms,
uMainForm in 'uMainForm.pas' {Form1};

{$R *.res}
Expand Down
2 changes: 1 addition & 1 deletion Demo/DelphiASTDemo.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_UnitSearchPath>..\Source;..\Source\SimpleParser;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<SanitizedProjectName>DelphiASTDemo</SanitizedProjectName>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
Expand All @@ -48,7 +49,6 @@
<DCC_K>false</DCC_K>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UnitSearchPath>..\Source;..\Source\SimpleParser;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_UsePackage>IndyIPClient;FireDACASADriver;FireDACSqliteDriver;bindcompfmx;FireDACDSDriver;DBXSqliteDriver;vcldbx;FireDACPgDriver;FireDACODBCDriver;RESTBackendComponents;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;FireDACCommon;bindcomp;inetdb;tethering;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapServer;DataSnapCommon;DBXOdbcDriver;vclFireDAC;DataSnapProviderClient;xmlrtl;DataSnapNativeClient;DBXSybaseASEDriver;DbxCommonDriver;svnui;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;DatasnapConnectorsFreePascal;FireDACCommonDriver;MetropolisUILiveTile;bindcompdbx;bindengine;vclactnband;vcldb;soaprtl;vcldsnap;bindcompvcl;vclie;fmxFireDAC;FireDACADSDriver;DBXDb2Driver;vcltouch;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;FireDACMSSQLDriver;FireDAC;dsnap;DBXInformixDriver;fmxase;vcl;IndyCore;IndyIPServer;DataSnapServerMidas;DBXMSSQLDriver;IndyIPCommon;VCLRESTComponents;dsnapcon;FireDACIBDriver;DBXFirebirdDriver;inet;CloudService;DataSnapFireDAC;fmxobj;DataSnapConnectors;FireDACDBXDriver;FireDACMySQLDriver;soapmidas;vclx;soapserver;inetdbxpress;CodeSiteExpressPkg;svn;DBXSybaseASADriver;dsnapxml;FireDACOracleDriver;FireDACInfxDriver;FireDACDb2Driver;fmxdae;RESTComponents;bdertl;FireDACMSAccDriver;dbexpress;DataSnapIndy10ServerTransport;adortl;$(DCC_UsePackage)</DCC_UsePackage>
Expand Down
6 changes: 3 additions & 3 deletions Demo/uMainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.StdCtrls;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;

type
TForm1 = class(TForm)
Expand All @@ -25,7 +25,7 @@ TForm1 = class(TForm)
implementation

uses
DelphiAST, DelphiAST.Writer, DelphiAST.Classes, Xml.XmlDoc;
DelphiAST, DelphiAST.Writer, DelphiAST.Classes, XmlDoc;

{$R *.dfm}

Expand Down
20 changes: 10 additions & 10 deletions Source/DelphiAST.Classes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TExpressionTools = class
implementation

uses
System.SysUtils, DelphiAST.Consts;
SysUtils, DelphiAST.Consts;

type
TOperatorKind = (okUnary, okBinary);
Expand Down Expand Up @@ -184,11 +184,11 @@ class function TExpressionTools.ExprToReverseNotation(Expr: TList<TSyntaxNode>):
if TOperators.IsOpName(Node.Name) then
begin
while (Stack.Count > 0) and TOperators.IsOpName(Stack.Peek.Name) and
(((TOperators[Node.Name].AssocType = atLeft) and
(TOperators[Node.Name].Priority >= TOperators[Stack.Peek.Name].Priority))
(((TOperators.Items[Node.Name].AssocType = atLeft) and
(TOperators.Items[Node.Name].Priority >= TOperators.Items[Stack.Peek.Name].Priority))
or
((TOperators[Node.Name].AssocType = atRight) and
(TOperators[Node.Name].Priority > TOperators[Stack.Peek.Name].Priority)))
((TOperators.Items[Node.Name].AssocType = atRight) and
(TOperators.Items[Node.Name].Priority > TOperators.Items[Stack.Peek.Name].Priority)))
do
Result.Add(Stack.Pop);

Expand Down Expand Up @@ -241,7 +241,7 @@ class procedure TExpressionTools.NodeListToTree(Expr: TList<TSyntaxNode>; Root:
begin
TreeData := TTreeData.Create(Node);
if TOperators.IsOpName(Node.Name) then
case TOperators[Node.Name].Kind of
case TOperators.Items[Node.Name].Kind of
okUnary: TreeData.Child1 := Stack.Pop;
okBinary:
begin
Expand Down Expand Up @@ -280,8 +280,8 @@ class function TExpressionTools.PrepareExpr(ExprNodes: TList<TSyntaxNode>): TObj
Result.Add(TSyntaxNode.Create(sCALL));

if TOperators.IsOpName(PrevNode.Name)
and (TOperators[PrevNode.Name].Kind = okUnary)
and (TOperators[PrevNode.Name].AssocType = atLeft)
and (TOperators.Items[PrevNode.Name].Kind = okUnary)
and (TOperators.Items[PrevNode.Name].AssocType = atLeft)
then
Result.Add(TSyntaxNode.Create(sCALL));
end;
Expand All @@ -292,8 +292,8 @@ class function TExpressionTools.PrepareExpr(ExprNodes: TList<TSyntaxNode>): TObj
Result.Add(TSyntaxNode.Create(sGENERIC));

if TOperators.IsOpName(PrevNode.Name)
and (TOperators[PrevNode.Name].Kind = okUnary)
and (TOperators[PrevNode.Name].AssocType = atLeft)
and (TOperators.Items[PrevNode.Name].Kind = okUnary)
and (TOperators.Items[PrevNode.Name].AssocType = atLeft)
then
Result.Add(TSyntaxNode.Create(sGENERIC));
end;
Expand Down
4 changes: 2 additions & 2 deletions Source/DelphiAST.Writer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
interface

uses
DelphiAST.Classes, Xml.XMLIntf, Generics.Collections;
DelphiAST.Classes, XMLIntf, Generics.Collections;

type
TSyntaxTreeWriter = class
Expand All @@ -17,7 +17,7 @@ TSyntaxTreeWriter = class
implementation

uses
System.SysUtils, Xml.XMLDoc;
SysUtils, XMLDoc;

{ TSyntaxTreeWriter }

Expand Down
4 changes: 2 additions & 2 deletions Source/DelphiAST.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
interface

uses
System.SysUtils, System.Classes, Generics.Collections, SimpleParser,
SysUtils, Classes, Generics.Collections, SimpleParser,
SimpleParser.Lexer.Types, DelphiAST.Classes;

type
Expand Down Expand Up @@ -1335,7 +1335,7 @@ procedure TPasSyntaxTreeBuilder.StringConst;
procedure TPasSyntaxTreeBuilder.StringConstSimple;
begin
//TODO support ptAsciiChar
FStack.AddChild(sLITERAL).SetAttribute(sVALUE, Lexer.Token.DeQuotedString);
FStack.AddChild(sLITERAL).SetAttribute(sVALUE, AnsiDequotedStr(Lexer.Token, ''''));
inherited;
end;

Expand Down
4 changes: 2 additions & 2 deletions Source/SimpleParser/SimpleParser.Lexer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface

uses
//!! pruned uses
SysUtils, Classes, System.Character, SimpleParser.Lexer.Types;
SysUtils, Classes, Character, SimpleParser.Lexer.Types;

var
Identifiers: array[#0..#255] of ByteBool;
Expand Down Expand Up @@ -1761,7 +1761,7 @@ function TmwBasePasLex.IsDefined(const ADefine: string): Boolean;

function TmwBasePasLex.IsIdentifiers(AChar: Char): Boolean;
begin
Result := AChar.IsLetterOrDigit or (AChar = '_');
Result := TCharacter.IsLetterOrDigit(AChar) or (AChar = '_');
end;

procedure TmwBasePasLex.LFProc;
Expand Down
28 changes: 2 additions & 26 deletions Source/SimpleParser/SimpleParser.inc
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
{$IFDEF VER280}
{$DEFINE D8_NEWER}
{$DEFINE D9_NEWER}
{$DEFINE D10_NEWER}
{$DEFINE D11_NEWER}
{$DEFINE D12_NEWER}
{$ENDIF}

{$IFDEF VER270}
{$DEFINE D8_NEWER}
{$DEFINE D9_NEWER}
{$DEFINE D10_NEWER}
{$DEFINE D11_NEWER}
{$DEFINE D12_NEWER}
{$ENDIF}

{$IFDEF VER260}
{$DEFINE D8_NEWER}
{$DEFINE D9_NEWER}
{$DEFINE D10_NEWER}
{$DEFINE D11_NEWER}
{$DEFINE D12_NEWER}
{$ENDIF}

{$IFDEF VER200}
{$IF CompilerVersion >= 20}
{$DEFINE D8_NEWER}
{$DEFINE D9_NEWER}
{$DEFINE D10_NEWER}
{$DEFINE D11_NEWER}
{$DEFINE D12_NEWER}
{$ENDIF}
{$IFEND}

{$IFDEF VER190}
{$DEFINE D8_NEWER}
Expand Down

0 comments on commit 5a2b8da

Please sign in to comment.