A. Mussche Posted September 11, 2013 Report Share Posted September 11, 2013 Update: empty lines are correctly handled too (see github). But how should comments be treated? Are they included with the span of an item (but which? previous or next?) or as a seperate node? Link to comment Share on other sites More sharing options...
miryamgsm Posted September 11, 2013 Report Share Posted September 11, 2013 Update: empty lines are correctly handled too (see github). But how should comments be treated? Are they included with the span of an item (but which? previous or next?) or as a seperate node? Comments can be written as a separate node, but we recommend to include them as part of the text of the declaration they are referring to. Therefore, the declaration can have leading comments and trailing comments. You have two options to handle the comments: Option I: the declarations can have only one trailing comment. The comment exists if it is in the same line where the declaration ends. Option II: the comments on lines following to declarations must be a part of the trailing comments, until an additional end of line appears (or the next declaration). The next declaration starts where the previous declaration ends, therefore it includes the leading comments. Please, see the attached examples. Míryam Link to comment Share on other sites More sharing options...
miryamgsm Posted September 13, 2013 Report Share Posted September 13, 2013 Hi all, Here, we have the first merge for the Delphi language. Thanks André!! BASE file structure: unit "Unit1" interface "interface" type "type" class "TTest" method "Test" implementation "implementation" method implementation "TTest.Test" Changes done on SRC file: * add method "Source" * add method implementation "TTest.Source" * modify class "TTest" * modify method implementation "TTest.Test" Changes done on DST file: * add method "Dest" * add method implementation "TTest.Dest" * modify class "TTest" The source files, which are used in the example, are attached. The parser is available at https://github.com/andremussche/SemanticMergeDelphi/ Now, we invoke semanticmerge: semanticmergetool.exe -s src.pas -d dst.pas -b base.pas -r output.pas -emt=default -ep=pas2yaml.exe Go to "source diffs" view to see the differences between the base and the source contributor: Go to "destination diffs" view to see the differences between the base and the destination contributor: As we can see, the "TTest" class has been modified in both contributors. Therefore, we need to solve manually the conflict! To do that, go to "pending conflict" view and click the "merge" button. Now, go to "rearrange file" view to check the result And.. of course, our last feature: visual merge! Enjoy! Best regards. Míryam sourcefiles.zip Link to comment Share on other sites More sharing options...
A. Mussche Posted September 16, 2013 Report Share Posted September 16, 2013 small update: more "items" are supported now: - uses list with item per unit - visibility parent (public, private, etc) - properties, fields, functions Also did some refactoring: it should be very easy now to support other types (using AddNewItem and AddNewParent functions) which does all the span determining etc. todo: - globals vars, const, other types (enums etc), global functions - inner class types - class functions, vars, etc? - generics? - better support for comments (everything between 2 items is included in previous span but no algoritm for determining to which (prev or next item) - other pascal language dialects (Oxygene, Smart/op4js, etc) Is there anyone who would like to help to support the remaining language features? Or at least generate a file with all possible Delphi features? Same for oxygene? Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 24, 2013 Report Share Posted September 24, 2013 Hi André, I will download the Git repo and have a look on how hard it would be to add Oxygene specific features... I don't have a Delphi compiler here (unless it compiles on Delphi 7) so I will need you to check my merge requests and see if it compiles... Best Regards, Jeroen Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 24, 2013 Report Share Posted September 24, 2013 Hi I forked the project on Github and I am trying to get the Delphi code to compile on Oxygene (using massive amounts of {$IFDEF}) Once that works then I can start working on adding the Oxygene specific parsing code... We can still compile it in Delphi or we can compile it in .NET (using Oxygene (there is a free commandline compiler)) once that all is finished. Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 26, 2013 Report Share Posted September 26, 2013 Hi André, Can you try to clone this repo: https://github.com/JeroenVandezande/SemanticMergeDelphi And see if it still compiles correctly under Delphi? It now runs on Oxygene and generates the same output file as your exe. If it does compile, would you like to merge this into your repo? then we can both work on it... (I can test it using Oxygene) Best Regards, Jeroen Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 26, 2013 Report Share Posted September 26, 2013 Hi, Can someone give me a little explanation on how to get to those screenshots? When I try to invoke the mergetool I get this message: "Oops! We do not support you language... yet!" Link to comment Share on other sites More sharing options...
miryamgsm Posted September 26, 2013 Report Share Posted September 26, 2013 Hi Jeroen, I invoke semanticmerge this way: semanticmergetool.exe -s src.pas -d dst.pas -b base.pas -r output.pas -emt=default -ep=pas2yaml.exe You should specify the "-ep" option to use the external parser Regards, Míryam Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 26, 2013 Report Share Posted September 26, 2013 Thank you for the hint... Here is a screenshot of the Oxygene exe parsing the example .pas files... I hope Andre can test of the code still compiles on Delphi so we can merge the repos... Best Regards, Jeroen Link to comment Share on other sites More sharing options...
A. Mussche Posted September 26, 2013 Report Share Posted September 26, 2013 I hope Andre can test of the code still compiles on Delphi so we can merge the repos... sorry, I have troubles with VPN to my work PC, hopefully tomorrow, otherwise monday. anyway, this is very nice, it would allow to load the .net assembly directly in plastic/semanticmerge? Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 26, 2013 Report Share Posted September 26, 2013 Hi, Technically yes, The generated assembly is a 100% .NET 4.0 dll But for now I created an exe that does the job (same as the Delphi exe) Thank you for testing the source! I am now working on adding some Oxygene syntax stuff (like 'method') but I have a hard time getting it in there... There is function Func9 to Func191, they are also put into an array, but I don't understand how they are called... If I want to add another function 'Func192' how does it work? Best Regards, Jeroen Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 26, 2013 Report Share Posted September 26, 2013 Ah, I figured it out, the array indexer for that method array is a hash value of the identifier... I got 'Namespace' working (is the same as Unit) Link to comment Share on other sites More sharing options...
A. Mussche Posted September 27, 2013 Report Share Posted September 27, 2013 can you make an official "pull request"? then I can merge it back into my repo (btw: with some small fixes I got it compiling again!) Can you try to clone this repo: https://github.com/JeroenVandezande/SemanticMergeDelphi Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 27, 2013 Report Share Posted September 27, 2013 I created a merge request Link to comment Share on other sites More sharing options...
A. Mussche Posted September 27, 2013 Report Share Posted September 27, 2013 I created a merge request thanks, I have merged + fixed it now 2 Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 27, 2013 Report Share Posted September 27, 2013 some minor compilation errors happened, so I fixed them and created a new pull request Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 27, 2013 Report Share Posted September 27, 2013 How do you want to proceed? using two repos and sync them using merge requests? Or do we both work on your repo? Link to comment Share on other sites More sharing options...
A. Mussche Posted September 27, 2013 Report Share Posted September 27, 2013 How do you want to proceed? using two repos and sync them using merge requests? Or do we both work on your repo? I have added you to my repo better use one instead of forking and pulling all the time maybe using branches for larger/breaking changes? Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 28, 2013 Report Share Posted September 28, 2013 good idea... Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted September 28, 2013 Report Share Posted September 28, 2013 Hi, I have a suggestion... Would it be a good idea to have an extra field in the YAML output? When a node has children this field can indicate if the order of the children is important or not... This can then be used by you guys to know if this can be swapped around in a file... for example: the order of the uses clause can influence how the software works, but the order of the methods in the interface section does not... Best Regards, Jeroen Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted October 8, 2013 Report Share Posted October 8, 2013 any reactions to this?? Link to comment Share on other sites More sharing options...
miryamgsm Posted October 9, 2013 Report Share Posted October 9, 2013 Hi Jeroen, First of all thank you for your suggestion. I suppose that the only difference for those "order aware" children would be not to apply automatically the moved-moved conflicts, right? Are the "use clauses" the only declarations of this type in Delphy language? In addition, could you provide us a source code example to better study the case? Thanks in advance. Best regards Míryam Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted October 10, 2013 Report Share Posted October 10, 2013 Hi, Well of course it all depends on how far the parser will go suppose we would parse a enum then the members order would be important. I guess it could be used when for example one dev cleans up a file a bit (by moving methods that belong together) and another one adds a method. This is mostly a case that gives a lot of conflicts in normal diff tools... examples: base: TMyColors = public enum(red, green, blue); dev1: TMyColors = public enum(red, green, orange, blue); dev2: TMyColors = public enum(red, green, purple, blue); This is a conflict a developer must solve Best Regards, Jeroen Link to comment Share on other sites More sharing options...
Jeroen Vandezande Posted January 4, 2014 Report Share Posted January 4, 2014 Is this project dead? I don't see any more commits on the repo... Link to comment Share on other sites More sharing options...
Recommended Posts