Fix using comma decimal separator in multiple argument functions
ClosedPublic

Authored by yurchor on Nov 9 2018, 10:53 AM.

Details

Summary

Using the comma as a decimal separator in multiple argument functions confuses KmPlot parser.

BUG: 267203

https://bugs.kde.org/show_bug.cgi?id=267203

On the other hand, it is natural to separate numbers with comma separator using the comma with space, e.g. "(0,5, 0,5)", so it is enough to replace the "<number>,<number>" sequences with "<number>.<number>" to obtain the correct results.

Test Plan
  1. Plot "f(x) = max(sin(x),cos(x))" in KmPlot with some locale which uses the comma as a decimal separator (according to Wikipedia, this can be a Europian (non-Brittish), Western Asian, Western African or South American locale, e.g. "de", "ca, "es", "uk", "pt_BR"). The result should be correct.
  1. Plot "f(x) = max(0,5∙sin(x),cos(x))" in KmPlot. Everything should be fine as well.

Diff Detail

Repository
R334 KmPlot
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
yurchor created this revision.Nov 9 2018, 10:53 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptNov 9 2018, 10:53 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
yurchor requested review of this revision.Nov 9 2018, 10:53 AM
cfeck requested changes to this revision.Nov 9 2018, 11:54 AM
cfeck added a subscriber: cfeck.
cfeck added inline comments.
kmplot/parser.cpp
1585

\d captures just a single digit.

This revision now requires changes to proceed.Nov 9 2018, 11:54 AM
yurchor marked an inline comment as done.Nov 9 2018, 11:55 AM
yurchor added inline comments.
kmplot/parser.cpp
1585

And that is expected. No need to capture more.

cfeck accepted this revision.Nov 9 2018, 1:52 PM
cfeck added inline comments.
kmplot/parser.cpp
1585

Oh you are right ... my fault :)

This revision is now accepted and ready to land.Nov 9 2018, 1:52 PM
This revision was automatically updated to reflect the committed changes.
yurchor marked an inline comment as done.