Skip to content

Commit

Permalink
Fix a bug that lost tokens in the diff algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Feb 26, 2016
1 parent 8e32ac5 commit bd3e67c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Compiler/Parsers/SimpleModelicaParser.mo
Expand Up @@ -2205,9 +2205,9 @@ algorithm
addedBeforeDeleted := true;
before := List.flatten(listReverse(acc));
end if;
acc := {};
end if;
end for;
acc := {};
then ();
case (Diff.Delete, lst)
algorithm
Expand Down
10 changes: 9 additions & 1 deletion Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -881,8 +881,16 @@ algorithm
if true then
// Do a sanity check
s3 := Dump.unparseStr(Parser.parsestring(s2));
SimCodeFunctionUtil.execStat("sanity parsestring(s2)");
s5 := printActual(treeDiffs, SimpleModelicaParser.parseTreeNodeStr);
s4 := Dump.unparseStr(Parser.parsestring(s5));
try
s4 := Dump.unparseStr(Parser.parsestring(s5));
SimCodeFunctionUtil.execStat("sanity parsestring(s5)");
else
System.writeFile("SanityCheckFail.mo", s5);
Error.addInternalError("Failed to parse merged string (see generated file SanityCheckFail.mo)\n", sourceInfo());
fail();
end try;
if not StringUtil.equalIgnoreSpace(s3, s4) then
Error.addInternalError("After merging the strings, the semantics changed for some reason (will simply return s2):\ns1:\n"+s1+"\ns2:\n"+s2+"\ns3:\n"+s3+"\ns4:\n"+s4+"\ns5:\n"+s5, sourceInfo());
sanityCheckFailed := true;
Expand Down

0 comments on commit bd3e67c

Please sign in to comment.