Skip to content

Merging 2 Modelica files #35

@sjoelund

Description

@sjoelund

OpenModelica has:

Interface
function diffModelicaFileListings
  input String before;
  input String after;
  input DiffFormat diffFormat = DiffFormat.color;
  input Boolean failOnSemanticsChange = false "Defaults to returning after instead of hard fail";
  output String result;
end diffModelicaFileListings;

Creates diffs of two strings (before and after) corresponding to Modelica files. The diff is specialized to handle the [list](https://build.openmodelica.org/Documentation/OpenModelica.Scripting.list.html) API moving comments around in the file and introducing or deleting whitespace.

The output can be chosen to be a colored diff (for terminals), XML, or the final text (deletions removed).

The same functionality would be good to have in the language server. We have testcases in https://github.com/OpenModelica/OpenModelica/tree/master/testsuite/openmodelica/diff

And the implementation is in:
https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/Compiler/Parsers/SimpleModelicaParser.mo
https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/Compiler/Util/DiffAlgorithm.mo

The grammar itself should not be all too dissimilar to the tree sitter grammar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions