Using external parsers with gmaster

Monday, March 19, 2018 12 Comments

gmaster comes pre-built with support for C#, C, C++, VB.Net and Java. But, you are not limited to these five languages; there are ways to develop and install support for additional languages.

We originally developed the external parser support for SemanticMerge, (which is now a key piece in gmaster), so you can check this guide we wrote explaining how to add new languages.

Users have already contributed parsers for Delphi, F#, Go, and a few others.

In this blogpost, I'm going to cover how to install an external parser in gmaster to add semantic support for new languages. For this demonstration, I chose the F# parser.

A semantic diff between two revisions of a F# file

You can refer to the documentation above to learn how to code your own external parser.

Configure gmaster to use an external parser

To install an external parser, you must follow these steps:

  1. Create a file named externalparsers.conf inside gmaster's configuration directory. If you installed gmaster at the default location, the configuration directory is %LOCALAPPDATA%\gmaster\config.
  2. Add to it the configuration of your external parser(s). This is what my configuration file looks like:
    External parsers configuration file

    The format of this configuration file is quite simple. One parser per line, each line including the extension of the file (including the dot), followed by an equal sign, and the full path of the executable, without quotation marks. For example:

    .<extension>=<executable path>

    The same format works if your parser is, for example, written in Java. You could have something like this:

    .myext=java -jar D:\myparser.jar
  3. Once you have your configuration ready, you must restart gmaster for the changes to take effect.

Diffing F# code

Now, every time gmaster tries to open a F# file revision to show its semantic diff, it will first check the externalparsers.conf configuration file. Then, it will execute the parser, et voilá! You are ready to diff your code semantically:

A semantic visual diff inside gmaster
Tip: Remember that you can undock the diff window to make it as big as you want, as I did for the screenshot.

Merging F# code

And here is what a modified-modified conflict looks like in SemanticMerge, correctly detected thanks to the external parser:

A semantic merge using the external parser

Wrapping up

That's all for today. If you have suggestions, doubts or problems, please don't hesitate to leave a comment, or ping us on Twitter at @gmasterscm.

Happy merging!

We develop gmaster, a Git GUI with semantic superpowers. It parses the code to really understand how it was refactored and then diff it and merge it as a human would do, matching methods instead of lines.

If you want to try it, download it from here.

We are also the developers of SemanticMerge and Plastic SCM, a full-featured version control.

12 comments:

  1. Please add 2 spaces in TAB (Options/Editor Options/TAB).

    ReplyDelete
  2. Francisco and Pablo, greetings! I am back from the edge, I have been gone for 3 years+.

    I have been working with Ralf Koban's external parsers for XML and Resx for a while now. Any chance these parsers can become first class citizens through some mechanism yet to be defined?

    I got through the installation process with ease manually, now repeat that across multiple skill levels hundreds or thousands of times. I think you see the issue. Manual build, manual edit ... does not scale. In my current assignment, the adoption rate is near zero, and XML is a pain point. Ralf's contributions are worth your blog, how do you feel about easing the adoption?

    Regards,

    ~Michael

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Webroot Antivirus is the fastest and easiest software to download, install and run.webroo.com/safe In addition, it automatically updates without slowing down your system. Because of which you always get the most protection. So we recommend you to download Webroot Antivirus. Webroot Antivirus detects online threats and blocks them quickly. You can install webroo.com/safe by visiting our website. And you can also download Webrot from windows 10 install webroot with key code . With Webrot's product you will be able to fully protect yourself online and offline For more information visit webroo.com/safe our website.

    ReplyDelete
  5. To activate the webroot safe , you need to redeem your webroot product key which you will find in your registered mail ID. Through webroo.com/safe keycode and webroot geek squad download you can download, install webroot . create a webroot safe account to manage webroot key code and webroo.com/safe activation code key subscription.Create a WebRot secure account to manage the webrot key code and install webrot on the new computer key subscription.Through Webroot geek squad download you can download and install webroot.Visit webroo.com/safe for installing webroot. If you do not have an account, go to Find My Webroot Account and create an account.

    ReplyDelete
  6. Mcafee antivirus is a commonly used antivirus that detects and kills PC infections, enables mail worms, Trojan programs, etc. For a more accurate visit, to save your PC or PC from infection and ensure data, download the Mcafee Antivirus by visiting the mcafee.com/activate website. mcafee activation can be easily processed using the activation code from the mcafee retail card and online on the mcafee.com/activate website page. Click our mcafee.com/activate link for more information.

    To download mcafee antivirus software, go to mcafee.com/activate and follow the easy procedure. Download and install Mcafee antivirus with active key. Learn more about its premium services by visiting mcafee.com/activate and take advantage of Mcafee Antivirus. To avoid any interruptions, visit the link given by us at mcafee.com/activate and follow the instructions.

    ReplyDelete
  7. Download and install Mcafee antivirus with active key by going to mcafee.com/activate . To learn more about its premium services, visit mcafee.com/activate and take advantage of Mcafee Antivirus. To avoid any interruptions, visit the link given at mcafee.com/activate and follow the instructions.

    Download and install Mcafee antivirus with active key by going to mcafee.com/activate . To learn more about its premium services, visit mcafee.com/activate and take advantage of Mcafee Antivirus. To avoid any interruptions, visit the link given at mcafee.com/activate and follow the instructions.

    ReplyDelete
  8. The Amazon My TV Code program requires the customer to have an Amazon account and a streaming device or TV.amazon.com/mytv Amazon Prime Video is available on almost all streaming devices like Roku, Amazon Fire TV, Chromecast. For this you just have to go to Amazon and activate amazon with the help of amazon.com/mytv . You can visit our website amazon.com/mytv for details of the entire process.

    ReplyDelete
  9. Amazon Prime is a subscription service that caters to the media needs of people through the Amazon Prime platform. amazon.com/mytv Notifies visitors about topics such as Register TV, Amazon Prime TV and MyTV code. To register your device on the Amazon website you go to our website amazon.com/mytv and enter the given code. You can do this by installing the Amazon Instant Video application on your smart TV, or the digital media player or video game console connected to your TV by visitingamazon.com/mytv the link amazon my tv provided by us in the description.

    People's media needs can be met through the Amazon Prime platform. Amazon Prime is a subscription service, which can be subscribed by going to the link amazon.com/mytv . To know more about this you can visit the given link amazon.com/mytv and also subscribe. You can use the Amazon Instant Video application on your smart TV or by installing a digital media player or video game console, which will be given by the link amazon.com/mytv in my TV description.

    ReplyDelete
  10. If you are facing issues due to your Fix iPhone cannot get mail, Make sure your phone is connected to the internet. You might need to reset your network settings, which control how your iPhone connects to your cellular network and Wi-Fi. 2.Try logging into your email on a different device, or check with your email service provider to ensure that the system isn't temporarily down.

    ReplyDelete
  11. If you are facing issues due to yahoo account recovery Visit https://login.yahoo.com/forgot in a web browser. This website will help you recover your Yahoo account by sending a confirmation code to your backup email address or phone number. You must have access to your recovery email address or phone number to restore your account.
    AOL sign in | amazon.com/redeem | 123.hp.com/setup | Office setup

    ReplyDelete