Giter Club home page Giter Club logo

semanticmergedelphi's People

Contributors

andremussche avatar jeroenvandezande avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

semanticmergedelphi's Issues

Unaccurate parsing of files containing single methods

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

does not work with SemanticMerge 2.0

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:

  • Inputfile
  • Encoding
  • Outputfile

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.