andremussche / semanticmergedelphi Goto Github PK
View Code? Open in Web Editor NEWPascal parser for PlasticSCM SemanticMerge tool
Pascal parser for PlasticSCM SemanticMerge tool
Hi,
I'm extending PlasticSCM to accept input from external parsers the same way SemanticMerge does, and I've found a minor issue: If I try to parse a single file containing just a procedure, the parser detects it as a 'unit' element instead of a procedure. I know that this is not the correct Delphi syntax, but it's useful for semantic method history inside PlasticSCM to display differences between two given revisions of the same procedure/function/etc. It would be great if the SemanticMergeDelphi parser supported this.
Let me show you an example. This file:
procedure THttpConnectionWinHttp.Configure;
var
i: Integer;
ProxyServer: string;
begin
if FAcceptTypes <> EmptyStr then
FWinHttpRequest.SetRequestHeader('Accept', FAcceptTypes);
if FAcceptedLanguages <> EmptyStr then
FWinHttpRequest.SetRequestHeader('Accept-Language', FAcceptedLanguages);
if FContentTypes <> EmptyStr then
FWinHttpRequest.SetRequestHeader('Content-Type', FContentTypes);
for i := 0 to FHeaders.Count-1 do
begin
FWinHttpRequest.SetRequestHeader(FHeaders.Names[i], FHeaders.ValueFromIndex[i]);
end;
FWinHttpRequest.SetTimeouts(0,
FConnectTimeout,
FSendTimeout,
FReceiveTimeout);
if ProxyActive then
begin
ProxyServer := GetProxyServer;
if ProxyServer <> '' then
begin
FWinHttpRequest.SetProxy(HTTPREQUEST_PROXYSETTING_PROXY, ProxyServer, GetProxyOverride);
if FProxyCredentials.Informed then
FWinHttpRequest.SetCredentials(FProxyCredentials.UserName, FProxyCredentials.Password,
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY);
end;
end;
end;
Is parsed into this YAML code:
---
type : file
name : \users\miguel\desktop\testfile.pas
locationSpan : {start: [1, 0], end: [0, 0]}
footerSpan : [0, -1]
parsingErrorsDetected : true
children :
- type : unit
name : THttpConnectionWinHttp
locationSpan : {start: [1, 0], end: [1, 32]}
span : [0, 43]
So, as you see, comparing the results of two methods like this will most like result in two units with the same name, so they'll be detected a an unchanged method.
If you need more detail or help, please don't hesitate to ask!
Regards,
Miguel
Apparently the number of parameters has been changed after this tool was written. According to the SemanticMerge documentation https://users.semanticmerge.com/documentation/external-parsers/external-parsers-guide.shtml#TheexternalparserAPI SemanticMerge writes three lines per file to parse to stdin of the parser:
The Encoding line seems to be new because pas2yaml writes its output to a files named like the encoding rather than the output file:
e.g.
inputfile.pas
UTF-8
outputfile.yaml
creates a file "UTF-8" in the current directory and the goes on to try and read the outputfile.yaml which of course fails.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.